lkml.org 
[lkml]   [2008]   [Oct]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [rfc] SLOB memory ordering issue
From
Date
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.



\
 
 \ /
  Last update: 2008-10-15 20:03    [W:0.043 / U:0.704 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site