[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Yw6RmxslqPrK22H4@nvidia.com>
Date: Tue, 30 Aug 2022 19:39:23 -0300
From: Jason Gunthorpe <jgg@...dia.com>
To: John Hubbard <jhubbard@...dia.com>
Cc: David Hildenbrand <david@...hat.com>, linux-kernel@...r.kernel.org,
linux-mm@...ck.org, Andrew Morton <akpm@...ux-foundation.org>,
Mel Gorman <mgorman@...e.de>,
"Matthew Wilcox (Oracle)" <willy@...radead.org>,
Andrea Arcangeli <aarcange@...hat.com>,
Hugh Dickins <hughd@...gle.com>, Peter Xu <peterx@...hat.com>
Subject: Re: [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
Powered by blists - more mailing lists