Re: [rfc] SLOB memory ordering issue

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Linus Torvalds
Date: Wednesday, October 15, 2008 - 10:33 am

On Thu, 16 Oct 2008, Nick Piggin wrote:

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
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[rfc] SLOB memory ordering issue, Nick Piggin, (Wed Oct 15, 9:34 am)
Re: [rfc] SLOB memory ordering issue, Nick Piggin, (Wed Oct 15, 9:46 am)
Re: [rfc] SLOB memory ordering issue, Matt Mackall, (Wed Oct 15, 9:54 am)
Re: [rfc] SLOB memory ordering issue, Nick Piggin, (Wed Oct 15, 10:10 am)
Re: [rfc] SLOB memory ordering issue, Linus Torvalds, (Wed Oct 15, 10:33 am)
Re: [rfc] SLOB memory ordering issue, Linus Torvalds, (Wed Oct 15, 10:36 am)
Re: [rfc] SLOB memory ordering issue, Nick Piggin, (Wed Oct 15, 10:45 am)
Re: [rfc] SLOB memory ordering issue, Matt Mackall, (Wed Oct 15, 10:58 am)
Re: [rfc] SLOB memory ordering issue, Linus Torvalds, (Wed Oct 15, 11:03 am)
Re: [rfc] SLOB memory ordering issue, Nick Piggin, (Wed Oct 15, 11:06 am)
Re: [rfc] SLOB memory ordering issue, Nick Piggin, (Wed Oct 15, 11:12 am)
Re: [rfc] SLOB memory ordering issue, Matt Mackall, (Wed Oct 15, 11:19 am)
Re: [rfc] SLOB memory ordering issue, Linus Torvalds, (Wed Oct 15, 11:26 am)
Re: [rfc] SLOB memory ordering issue, Linus Torvalds, (Wed Oct 15, 11:29 am)
Re: [rfc] SLOB memory ordering issue, Nick Piggin, (Wed Oct 15, 11:35 am)
Re: [rfc] SLOB memory ordering issue, Linus Torvalds, (Wed Oct 15, 11:43 am)
Re: [rfc] SLOB memory ordering issue, Nick Piggin, (Wed Oct 15, 11:50 am)
Re: [rfc] SLOB memory ordering issue, Nick Piggin, (Wed Oct 15, 12:19 pm)
Re: [rfc] SLOB memory ordering issue, Linus Torvalds, (Wed Oct 15, 12:47 pm)
Re: [rfc] SLOB memory ordering issue, Linus Torvalds, (Fri Oct 17, 1:29 pm)