Re: [PATCH 1/8] cpumask: Replace cpumask_of_cpu with cpumask_of_cpu_ptr

From: Mike Travis
Date: Wed Jul 23 2008 - 13:45:32 EST


Rusty Russell wrote:
...
>> Another thought I had is perhaps cpumask.h should define something that
>> indicates a "huge NR_CPUS count" that is used globally to trigger things
>> like kmalloc of cpumask variables, instead of declaring them on the
>> stack...? Or (as has been discussed in the past), maybe a new cpumask_t
>> type will be needed?
>
> AFAICT the final answer has to be a get_cpu_mask()/put_cpu_mask(), which
> sleeps and doesn't nest (so we can use a pool allocator). Of course, that
> kind of analysis is non-trivial, so I suggest that's not for this merge
> window...
>
> Want me to try something and see if it boots?
> Rusty.

Hi Rusty,

There are a number of occasions where a function declares a temporary cpumask_t
variable on the stack to hold (say) current->cpus_allowed. I tried a couple of
options early on to a.) reserve one or two cpumask_t variables in the task
struct; and b.) reserve one or two cpumask_t variables per cpu. Both had weird
consequences in some usages and since 4096 is *only* 512 bytes, it didn't seem
worth the effort. Our next iteration will have NR_CPUS=16384 and therefore
removing all stack declared cpumask_t variables is highly desirable.

Your idea of a pool allocator is very interesting... ;-)

Thanks,
Mike
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/