Re: [PATCH] cpumask: alloc blank cpumask left over

Yinghai Lu
2009-06-05T17:47:42Z

Linus Torvalds wrote:
>
> On Fri, 5 Jun 2009, Rusty Russell wrote:
>> OK, here's what I've got in my tree. Ingo, I think this should go in the
>> current -rc to avoid nasty bugs.
>
> Why is the fix not to simply clear it in alloc?
>
>> BTW, the original alloc_cpumask_var did zero; that was dropped after arguments
>> over efficiency and fitting with other interfaces, but I clearly had the old
>> semantics in my head for a while.
>
> How could this ever be a efficiency issue? If you allocate cpumasks so
> often that it's an efficiency problem, it would seem that you have bigger
> issues than the memset. You'll have to initialize them some other way
> anyway, so it's not like you can ever really avoid the dirty cachelines.
>
> IOW, why isn't the fix just to clean up the horrible mess that is
> alloc_cpumask_var_node() once and for all. Why not something like this?
> The end result looks a lot simpler.
>
> Or you could just add in that __GFP_ZERO there, and remove the memset. I
> don't care. But the current code just looks messy and crazy, and that
> FIXME is bogus. The end of the allocation needs to be cleared regardless.

some alloc_cpumask_var or alloc_cpumask_var_node calling are followed by
cpumask_copy etc to assign the allocated cpuamsk_var_t.

about 66% calling are falling to that case.

YH