linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: "Matthew Wilcox (Oracle)" <willy@infradead.org>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: "Matthew Wilcox (Oracle)" <willy@infradead.org>, linux-mm@kvack.org
Subject: [PATCH 4/7] mm: Remove page_ref_sub_return()
Date: Wed, 24 Apr 2024 20:19:09 +0100	[thread overview]
Message-ID: <20240424191914.361554-5-willy@infradead.org> (raw)
In-Reply-To: <20240424191914.361554-1-willy@infradead.org>

With all callers converted to folios, we can act directly on
folio->_refcount.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
 include/linux/page_ref.h | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/include/linux/page_ref.h b/include/linux/page_ref.h
index d7c2d33baa7f..1acf5bac7f50 100644
--- a/include/linux/page_ref.h
+++ b/include/linux/page_ref.h
@@ -139,20 +139,15 @@ static inline void folio_ref_sub(struct folio *folio, int nr)
 	page_ref_sub(&folio->page, nr);
 }
 
-static inline int page_ref_sub_return(struct page *page, int nr)
+static inline int folio_ref_sub_return(struct folio *folio, int nr)
 {
-	int ret = atomic_sub_return(nr, &page->_refcount);
+	int ret = atomic_sub_return(nr, &folio->_refcount);
 
 	if (page_ref_tracepoint_active(page_ref_mod_and_return))
-		__page_ref_mod_and_return(page, -nr, ret);
+		__page_ref_mod_and_return(&folio->page, -nr, ret);
 	return ret;
 }
 
-static inline int folio_ref_sub_return(struct folio *folio, int nr)
-{
-	return page_ref_sub_return(&folio->page, nr);
-}
-
 static inline void page_ref_inc(struct page *page)
 {
 	atomic_inc(&page->_refcount);
-- 
2.43.0



  parent reply	other threads:[~2024-04-24 19:19 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-24 19:19 [PATCH 0/7] More folio compat code removal Matthew Wilcox (Oracle)
2024-04-24 19:19 ` [PATCH 1/7] mm: Remove page_cache_alloc() Matthew Wilcox (Oracle)
2024-04-24 19:19 ` [PATCH 2/7] mm: Remove put_devmap_managed_page() Matthew Wilcox (Oracle)
2024-04-24 19:19 ` [PATCH 3/7] mm: Convert put_devmap_managed_page_refs() to put_devmap_managed_folio_refs() Matthew Wilcox (Oracle)
2024-04-24 19:19 ` Matthew Wilcox (Oracle) [this message]
2024-04-24 19:19 ` [PATCH 5/7] gup: Use folios for gup_devmap Matthew Wilcox (Oracle)
2024-04-25  9:49   ` David Hildenbrand
2024-04-25 12:43     ` Matthew Wilcox
2024-04-24 19:19 ` [PATCH 6/7] mm: Add kernel-doc for folio_mark_accessed() Matthew Wilcox (Oracle)
2024-04-24 19:19 ` [PATCH 7/7] mm: Remove PageReferenced Matthew Wilcox (Oracle)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240424191914.361554-5-willy@infradead.org \
    --to=willy@infradead.org \
    --cc=akpm@linux-foundation.org \
    --cc=linux-mm@kvack.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox