lkml.org 
[lkml]   [2022]   [Aug]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v1 2/3] mm/gup: use gup_can_follow_protnone() also in GUP-fast
On Tue, Aug 30, 2022 at 01:12:53PM -0700, John Hubbard wrote:

> As long as we continue to sort-of-accidentally use atomic_add_unless(),
> which returns a value, instead of atomic_add(), which does not. :)

I should say I didn't have time to carefully check what put_page was
doing, but IIRC it is an atomic_dec_return to decide if it should free
the page.

The conditional is pretty much inherent to the model, because 0 is
special it always has to be checked. Not so accidental

But you might make the case that these could be the relaxed versions
of the atomic...

> Likewise on the put_page() side: we are depending on the somewhat
> accidental (from the perspective of memory barriers) use of
> atomics that return values.
>
> Maybe it would be good to add a little note at each site, to that
> effect?

It would be fantastic if things that are required to be
acquire/releases are documented as acquire/release :)

It is incredibly subtle stuff and all carefully inlined for maximum
performance.

Jason

\
 
 \ /
  Last update: 2022-08-31 00:39    [W:0.075 / U:0.196 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site