On Thu, Feb 06, 2020 at 07:37:27PM -0800, John Hubbard wrote:
An upcoming patch requires subtracting a large chunk of refcounts from a page, and checking what the resulting refcount is. This is a little different than the usual "check for zero refcount" that many of the page ref functions already do. However, it is similar to a few other routines that (like this one) are generally useful for things such as 1-based refcounting.
Add page_ref_sub_return(), that subtracts a chunk of refcounts atomically, and returns an atomic snapshot of the result.
Reviewed-by: Jan Kara jack@suse.cz Signed-off-by: John Hubbard jhubbard@nvidia.com
Acked-by: Kirill A. Shutemov kirill.shutemov@linux.intel.com