[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1224093513.3316.250.camel@calx>
Date: Wed, 15 Oct 2008 12:58:33 -0500
From: Matt Mackall <mpm@...enic.com>
To: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: Nick Piggin <nickpiggin@...oo.com.au>,
Pekka Enberg <penberg@...helsinki.fi>, linux-mm@...ck.org,
linux-kernel@...r.kernel.org
Subject: Re: [rfc] SLOB memory ordering issue
On Wed, 2008-10-15 at 10:36 -0700, Linus Torvalds wrote:
>
> 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.
Right. This is the 99.9% case and is why we should definitely not put an
additional barrier in the allocator.
Lockless users are already on their own with regard to memory ordering
issues, so it makes sense for them to absorb the (often nil) incremental
cost of ensuring object initialization gets flushed.
I feel like we ought to document this in the SLAB API, but at the same
time, I think we'll scare more people than we'll enlighten.
--
Mathematics is the supreme nostalgia of our time.
--
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