The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Matthew Wilcox <willy@infradead.org>
To: "zhaoyang.huang" <zhaoyang.huang@unisoc.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	David Hildenbrand <david@kernel.org>, Zi Yan <ziy@nvidia.com>,
	Lorenzo Stoakes <ljs@kernel.org>, Barry Song <baohua@kernel.org>,
	Baolin Wang <baolin.wang@linux.alibaba.com>,
	Lance Yang <lance.yang@linux.dev>,
	"Liam R . Howlett" <liam@infradead.org>,
	Nico Pache <npache@redhat.com>,
	Ryan Roberts <ryan.roberts@arm.com>, Dev Jain <dev.jain@arm.com>,
	Jaegeuk Kim <jaegeuk@kernel.org>, Chao Yu <chao@kernel.org>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	Zhaoyang Huang <huangzhaoyang@gmail.com>,
	steve.kang@unisoc.com, xiuhong.wang@unisoc.com
Subject: Re: [PATCHv2] mm/huge_memory: do not add dropped split tail folios to LRU
Date: Fri, 12 Jun 2026 06:16:44 +0100	[thread overview]
Message-ID: <aiuWPKy0ncsMIXgW@casper.infradead.org> (raw)
In-Reply-To: <20260612023456.2424044-1-zhaoyang.huang@unisoc.com>

On Fri, Jun 12, 2026 at 10:34:56AM +0800, zhaoyang.huang wrote:
> [2]
> *F: big folio before split
> *T: tail folio after split
> CPU0 (f2fs GC)              CPU1 (split_folio_to_order)          CPU2 (folio_isolate_lru)
> *F: pagecache refs = n
> *F: extra refs = split
> *F: PG_lru set, mapping != NULL
>                             split_folio_to_order(F)
>                               folio_ref_freeze(F, 1)

I'll stop you right there.  folio_ref_freeze() is called with
folio_cache_ref_count(folio) + 1.  That's defined as:

static unsigned int folio_cache_ref_count(const struct folio *folio)
{
        if (folio_test_anon(folio) && !folio_test_swapcache(folio))
                return 0;
        return folio_nr_pages(folio);
}

so you'd have to freeze it with 2^order + 1.  The 2^order is the number of
references the page cache takes on it and the 1 is the reference held by
the caller of split_folio_to_order().  If anybody else has a reference
to it at this point, the call to freeze will fail.


  parent reply	other threads:[~2026-06-12  5:17 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-12  2:34 [PATCHv2] mm/huge_memory: do not add dropped split tail folios to LRU zhaoyang.huang
2026-06-12  2:46 ` Zi Yan
2026-06-12  3:14   ` Zhaoyang Huang
2026-06-12 13:56     ` Zi Yan
2026-06-12 23:35       ` Zhaoyang Huang
2026-06-12  5:16 ` Matthew Wilcox [this message]
2026-06-12  5:52   ` Zhaoyang Huang
2026-06-12 14:12 ` Zi Yan
2026-06-12 23:38   ` Zhaoyang Huang
2026-06-12 23:46     ` Zi Yan
2026-06-12 23:55       ` Zhaoyang Huang
2026-06-15 16:00         ` Zi Yan
2026-06-12 16:34 ` David Hildenbrand (Arm)
2026-06-12 23:46   ` Zhaoyang Huang
2026-06-15 11:25     ` David Hildenbrand (Arm)

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=aiuWPKy0ncsMIXgW@casper.infradead.org \
    --to=willy@infradead.org \
    --cc=akpm@linux-foundation.org \
    --cc=baohua@kernel.org \
    --cc=baolin.wang@linux.alibaba.com \
    --cc=chao@kernel.org \
    --cc=david@kernel.org \
    --cc=dev.jain@arm.com \
    --cc=huangzhaoyang@gmail.com \
    --cc=jaegeuk@kernel.org \
    --cc=lance.yang@linux.dev \
    --cc=liam@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=ljs@kernel.org \
    --cc=npache@redhat.com \
    --cc=ryan.roberts@arm.com \
    --cc=steve.kang@unisoc.com \
    --cc=xiuhong.wang@unisoc.com \
    --cc=zhaoyang.huang@unisoc.com \
    --cc=ziy@nvidia.com \
    /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