[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Sat, 06 Jun 2009 12:22:51 +0300
From: Avi Kivity <avi@...hat.com>
To: Rusty Russell <rusty@...tcorp.com.au>
CC: Yinghai Lu <yinghai@...nel.org>, Ingo Molnar <mingo@...e.hu>,
Andrew Morton <akpm@...ux-foundation.org>,
Thomas Gleixner <tglx@...utronix.de>,
"H. Peter Anvin" <hpa@...or.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
Linus Torvalds <torvalds@...ux-foundation.org>
Subject: Re: [PATCH] cpumask: alloc blank cpumask left over
Rusty Russell wrote:
> On Fri, 5 Jun 2009 03:26:57 pm Yinghai Lu wrote:
>
>> Rusty Russell wrote:
>>
>>> On Fri, 5 Jun 2009 06:31:31 am Yinghai Lu wrote:
>>>
>>>> avoid suprise when MAXSMP is enabled
>>>>
>>>> Signed-off-by: Yinghai Lu <yinghai.lu@...nel.org>
>>>>
>>> I understand the temptation, but two questions arise:
>>> 1) Shouldn't we actually audit to see if any of these are currently
>>> problems,
>>>
>> those are defined as static cpumask_var_t, and if MAXSMP is not used, they
>> are cleared already
>>
>
> OK, here's what I've got in my tree. Ingo, I think this should go in the
> current -rc to avoid nasty bugs.
>
> 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.
>
>
Using __GFP_ZERO is equivalent to using memset() instead of
cpumask_clear(). It's better to call cpumask_clear() or provide an API
to alloc+clear.
Further, what about the non-MAXSMP case:
static inline bool alloc_cpumask_var(cpumask_var_t *mask, gfp_t flags)
{
return true;
}
We explicity clear on MAXSMP and rely on static initialization for the
non-MAXSMP, laying a neat trap for anyone who makes the variable
non-static. Let's be less subtle that that.
--
I have a truly marvellous patch that fixes the bug which this
signature is too narrow to contain.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists