[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.LFD.2.00.0810151033170.3288@nehalem.linux-foundation.org>
Date: Wed, 15 Oct 2008 10:36:15 -0700 (PDT)
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: Nick Piggin <nickpiggin@...oo.com.au>
cc: Matt Mackall <mpm@...enic.com>,
Pekka Enberg <penberg@...helsinki.fi>, linux-mm@...ck.org,
linux-kernel@...r.kernel.org
Subject: Re: [rfc] SLOB memory ordering issue
On Wed, 15 Oct 2008, Linus Torvalds wrote:
>
> If you make an allocation visible to other CPU's, you would need to make
> sure that allocation is stable with a smp_wmb() before you update the
> pointer to that allocation.
Just to clarify a hopefully obvious issue..
The assumption here is that you don't protect things with locking. Of
course, if all people accessing the new pointer always have the
appropriate lock, then memory ordering never matters, since the locks take
care of it.
So _most_ allocators obviously don't need to do any smp_wmb() at all. But
the ones that expose things locklessly (where page tables are just one
example) need to worry.
Again, this is yet another reason to not put things in the allocator. The
allocator cannot know, and shouldn't care. For all the exact same reasons
that the allocator cannot know and shouldn't care whether the ctor results
in a 'final' version or whether the allocator will do some final fixups.
Linus
--
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