Re: [rfc] SLOB memory ordering issue

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

On Thu, 16 Oct 2008, Nick Piggin wrote:

"all writes done to it before it's exposed".


You make tons of assumptions.

You assume that
 (a) unlocked accesses are the normal case and should be something the 
     allocator should prioritize/care about.
 (b) that if you have a ctor, it's the only thing the allocator will do.

I don't think either of those assumptions are at all relevant or 
interesting. Quite the reverse - I'd expect them to be in a very small 
minority.

Now, obviously, on pretty much all machines out there (ie x86[-64] and UP 
ARM), smp_wmb() is a no-op, so in that sense we could certainly say that 
"sure, this is a total special case, but we can add a smp_wmb() anyway 
since it won't cost us anything".

On the other hand, on the machines where it doesn't cost us anything, it 
obviously doesn't _do_ anything either, so that argument is pretty 
dubious. 

And on machines where the memory ordering _can_ matter, it's going to add 
cost to the wrong point.

		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)