[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.LFD.2.00.0810151028110.3288@nehalem.linux-foundation.org>
Date: Wed, 15 Oct 2008 10:33:01 -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 Thu, 16 Oct 2008, Nick Piggin wrote:
>
> Now they allocate these guys, take a lock, then insert them into the
> page tables. The lock is only an acquire barrier, so it can leak past
> stores.
I think that Matt's point was that the code is buggy regardless of any
ctor or not.
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.
So the code that makes a page visible should just always do that
synchronization.
And it has nothing to do with ctors or not. It's true whether you do the
initialization by hand, or whether you use a ctor.
And more importantly, putting the write barrier in the ctor or in the
memory allocator is simply broken. It's not a ctor/allocator issue. Why?
Because even if you have a ctor, there is absolutely *nothing* that says
that the ctor will be sufficient to initialize everything. Most ctors, in
fact, are just initializing the basic fields - the person that does the
allocation should finish things up.
The fact that _some_ people using an allocator with a ctor may not do
anything but the ctor to the page is immaterial.
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