mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Balbir Singh <balbirs@nvidia.com>
To: Kiryl Shutsemau <kirill@shutemov.name>,
	akpm@linux-foundation.org, david@kernel.org, ljs@kernel.org,
	hannes@cmpxchg.org, usama.arif@linux.dev
Cc: lance.yang@linux.dev, ziy@nvidia.com, hughd@google.com,
	baolin.wang@linux.alibaba.com, baohua@kernel.org,
	liam@infradead.org, nico.pache@linux.dev, dev.jain@arm.com,
	ryan.roberts@arm.com, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org,
	"Kiryl Shutsemau (Meta)" <kas@kernel.org>
Subject: Re: [PATCH 0/5] Fix deferred_split_isolate() and clean up __folio_freeze_and_split_unmapped()
Date: Fri, 28 Aug 2026 13:14:02 +1000	[thread overview]
Message-ID: <2662e4be-3581-4162-94b7-e027067b2320@nvidia.com> (raw)
In-Reply-To: <20260826162101.1314941-1-kirill@shutemov.name>

On 8/27/26 2:20 AM, Kiryl Shutsemau wrote:
> From: "Kiryl Shutsemau (Meta)" <kas@kernel.org>
> 
> deferred_split_isolate() probes each queued folio with folio_try_get().
> folio_try_get() failure is treated as a lost race with folio_put().
> 
> It leads to wrong results when !folio_try_get() was not caused by
> folio_put(): for a frozen folio, PG_partially_mapped gets wrongfully
> cleared and the folio dropped from the queue.
> 
> It came up in the review of my collapse RFC series:
> 
>   https://lore.kernel.org/all/20260824131224.73344-1-lance.yang@linux.dev/
> 
> The bug is inert in upstream code:
> 
>   - __folio_split() works around it;
>   - __folio_migrate_mapping() freezes a folio it is about to replace;
>   - reclaim freezes only what try_to_unmap() already unmapped.
> 
> No stable@ needed. But my collapse rework steps on it, so it is worth
> fixing.
> 
> The first patch fixes deferred_split_isolate().
> 
> The second patch removes the workaround for this deferred_split_isolate()
> behaviour from __folio_freeze_and_split_unmapped().
> 
> The other three patches are trivial cleanups in
> __folio_freeze_and_split_unmapped() that I stumbled on while looking at
> it.
> 
> Tested in a VM: split_huge_page_test, folio_split_race_test and cow pass.
> 
> Also ran a test that leaves 16 partially mapped THPs on the deferred split
> queue and drives thp-deferred_split through debugfs, checking
> nr_anon_partially_mapped.
> 
> Kiryl Shutsemau (Meta) (5):
>   mm/huge_memory: do not touch frozen folios in deferred_split_isolate()
>   mm/huge_memory: dequeue the deferred split after the split freeze
>   mm/huge_memory: reduce indent level in
>     __folio_freeze_and_split_unmapped()
>   mm/huge_memory: fold nested ifs in __folio_freeze_and_split_unmapped()
>   mm/huge_memory: turn the swapcache-with-mapping error case into an
>     assert
> 
>  mm/huge_memory.c | 260 ++++++++++++++++++++---------------------------
>  1 file changed, 109 insertions(+), 151 deletions(-)
> 
> 
> base-commit: 33f61b12d297562321533c048e034b1fb21c1cf3

Thanks, any chance you ran hmm-tests on these? If not, I can run them and
provide some testing coverage from a zone device folio perspective

Balbir

      parent reply	other threads:[~2026-08-28  3:14 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-26 16:20 Kiryl Shutsemau
2026-08-26 16:20 ` [PATCH 1/5] mm/huge_memory: do not touch frozen folios in deferred_split_isolate() Kiryl Shutsemau
2026-08-26 16:45   ` Zi Yan
2026-08-27 15:02   ` Johannes Weiner
2026-08-27 15:23   ` David Hildenbrand (Arm)
2026-08-27 15:38     ` Zi Yan
2026-08-27 15:56       ` David Hildenbrand (Arm)
2026-08-27 16:38   ` Usama Arif
2026-08-28  1:57     ` Zi Yan
2026-08-26 16:20 ` [PATCH 2/5] mm/huge_memory: dequeue the deferred split after the split freeze Kiryl Shutsemau
2026-08-26 17:10   ` Zi Yan
2026-08-27 15:25   ` David Hildenbrand (Arm)
2026-08-27 16:59   ` Johannes Weiner
2026-08-26 16:20 ` [PATCH 3/5] mm/huge_memory: reduce indent level in __folio_freeze_and_split_unmapped() Kiryl Shutsemau
2026-08-26 16:34   ` Zi Yan
2026-08-26 16:43     ` Kiryl Shutsemau
2026-08-26 16:21 ` [PATCH 4/5] mm/huge_memory: fold nested ifs " Kiryl Shutsemau
2026-08-26 16:21 ` [PATCH 5/5] mm/huge_memory: turn the swapcache-with-mapping error case into an assert Kiryl Shutsemau
2026-08-28  3:14 ` Balbir Singh [this message]

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=2662e4be-3581-4162-94b7-e027067b2320@nvidia.com \
    --to=balbirs@nvidia.com \
    --cc=akpm@linux-foundation.org \
    --cc=baohua@kernel.org \
    --cc=baolin.wang@linux.alibaba.com \
    --cc=david@kernel.org \
    --cc=dev.jain@arm.com \
    --cc=hannes@cmpxchg.org \
    --cc=hughd@google.com \
    --cc=kas@kernel.org \
    --cc=kirill@shutemov.name \
    --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=nico.pache@linux.dev \
    --cc=ryan.roberts@arm.com \
    --cc=usama.arif@linux.dev \
    --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

all inboxes | Powered by JetHome®