From: Andrew Morton <akpm@linux-foundation.org>
To: mm-commits@vger.kernel.org,willy@infradead.org,akpm@linux-foundation.org
Subject: [merged mm-stable] mm-document-the-folio-refcount-a-little-better.patch removed from -mm tree
Date: Tue, 02 Jun 2026 15:26:59 -0700 [thread overview]
Message-ID: <20260602222700.4E4741F00893@smtp.kernel.org> (raw)
The quilt patch titled
Subject: mm: document the folio refcount a little better
has been removed from the -mm tree. Its filename was
mm-document-the-folio-refcount-a-little-better.patch
This patch was dropped because it was merged into the mm-stable branch
of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
------------------------------------------------------
From: "Matthew Wilcox (Oracle)" <willy@infradead.org>
Subject: mm: document the folio refcount a little better
Date: Tue, 26 May 2026 21:00:30 +0100
Expand the documentation of folio_ref_count() to talk about expected,
temporary and spurious refcounts as well as the concept of freezing.
Link: https://lore.kernel.org/20260526200032.353868-1-willy@infradead.org
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
include/linux/page_ref.h | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
--- a/include/linux/page_ref.h~mm-document-the-folio-refcount-a-little-better
+++ a/include/linux/page_ref.h
@@ -71,6 +71,12 @@ static inline int page_ref_count(const s
* folio_ref_count - The reference count on this folio.
* @folio: The folio.
*
+ * Folios contain a reference count. When that reference count reaches
+ * zero, the folio is referred to as frozen. At this point, it will
+ * usually be returned to the memory allocator, but some parts of the
+ * kernel freeze folios in order to perform unusual operations on them
+ * such as splitting or migration.
+ *
* The refcount is usually incremented by calls to folio_get() and
* decremented by calls to folio_put(). Some typical users of the
* folio refcount:
@@ -82,6 +88,18 @@ static inline int page_ref_count(const s
* - Pipes
* - Direct IO which references this page in the process address space
*
+ * The reference count has three components: expected, temporary and
+ * spurious. The expected reference count of a folio is that which
+ * we would logically expect it to be from just reading the code.
+ * Temporary refcounts are gained by threads which need a temporary
+ * reference to make sure the folio isn't reallocated while they use it.
+ * Spurious refcounts are gained by threads which, thanks to RCU walks
+ * of the page tables or file cache, find a stale pointer to a folio.
+ * These threads will drop the refcount after discoveering the pointer
+ * is stale, but it can surprise other users to see the spurious refcount
+ * on a freshly allocated folio (eg they may see a refcount of 2 instead
+ * of 1).
+ *
* Return: The number of references to this folio.
*/
static inline int folio_ref_count(const struct folio *folio)
_
Patches currently in -mm which might be from willy@infradead.org are
reply other threads:[~2026-06-02 22:27 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20260602222700.4E4741F00893@smtp.kernel.org \
--to=akpm@linux-foundation.org \
--cc=mm-commits@vger.kernel.org \
--cc=willy@infradead.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