mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Muchun Song <songmuchun@bytedance.com>
Cc: Oscar Salvador <osalvador@suse.de>,
	Miaohe Lin <linmiaohe@huawei.com>,
	Muchun Song <muchun.song@linux.dev>,
	David Hildenbrand <david@kernel.org>,
	Mike Rapoport <rppt@kernel.org>,
	Naoya Horiguchi <nao.horiguchi@gmail.com>,
	Joao Martins <joao.m.martins@oracle.com>,
	Lorenzo Stoakes <ljs@kernel.org>,
	Sashiko <sashiko-bot@kernel.org>, Jiaqi Yan <jiaqiyan@google.com>,
	"Jose A . Perez de Azpillaga" <azpijr@gmail.com>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	stable@vger.kernel.org
Subject: Re: [PATCH v3 0/3] mm/hugetlb_vmemmap: Fix HVO races and deadlock
Date: Thu, 19 Nov 2026 09:00:50 -0800	[thread overview]
Message-ID: <20261119090050.6858fd2871d2756c6d3c809a@linux-foundation.org> (raw)
In-Reply-To: <20261114112523.75208-1-songmuchun@bytedance.com>

On Sat, 14 Nov 2026 19:25:20 +0800 Muchun Song <songmuchun@bytedance.com> wrote:

> This series fixes three HVO issues reported by Sashiko.
> 
> The first patch serializes HWPoison updates and removal against HVO
> remapping so raw_hwp_page state cannot be lost or freed while a
> replacement vmemmap head page is being installed. The second patch uses
> an HVO-private rwsem to prevent deferred PMD splits from racing with PTE
> remapping before the TLB flush. The last patch switches the vmemmap walk
> to the lockless walker so a PMD split allocation cannot recurse into
> init_mm.mmap_lock through reclaim.
> 

Thanks, tested in a VM.  The series did everything it claimed to do and
the LLM couldn't fid a way to break it.

Tested-by: Andrew Morton <akpm@linux-foundation.org>


: I tested the three patches in x86-64 QEMU guests. A had the series
: removed; B had it applied. Both used the same kernel configuration and
: fresh boots. The main tests used four CPUs, two NUMA nodes, 8 GiB RAM
: and 2 MiB HugeTLB pages. I added the same temporary delays and log
: messages to A and B, guarded by the test processes' current->comm, so
: other processes did not take those delays.
: 
: [1/3] mm/hugetlb_vmemmap: fix HWPoison state races during optimization
: 
: I put a three-second pause immediately after HVO copied the vmemmap
: head, then poisoned a tail page during that pause. On A, the HWPoison
: state was lost and the huge page remained in the free pool; B kept it
: out. Poisoning the last 4 KiB tail page gave the same result. For the
: reverse race, I also paused before the copy to poison the page, then
: unpoisoned it during the post-copy pause. A left stale HWPoison flags
: on the head and tail; B cleared them.
: 
: [2/3] mm/hugetlb_vmemmap: fix PMD split TLB flush race
: 
: I put a three-second pause immediately before the deferred
: flush_tlb_all(), after the split PMDs had been published. During that
: pause, separate processes allocated huge pages in the affected range.
: Temporary log messages recorded the old and new backing PFNs at each
: remap. A changed PTE mappings before the flush; B did not. Four
: simultaneous allocations repeated the early remapping on A across
: both split PMD ranges. I did not observe a processor using a stale
: TLB entry.
: 
: [3/3] mm/hugetlb_vmemmap: fix deadlock during PMD split
: 
: This test used a separate four-CPU, one-node, 4 GiB QEMU guest. An
: emulated QXL device initialized TTM. Because QXL's own pages were
: cached, a small test module used TTM's page-pool interfaces to return
: 512 write-combined pages to its pool. A process held about 2.5 GiB
: of guest memory.
: 
: I created an init_mm.mmap_lock writer before HVO entered the PMD
: split. At the split, I released that writer, paused for 300 ms to let
: it wait on the lock, then called TTM's actual shrinker from the HVO
: task. A reached set_pages_wb() and blocked trying to take
: init_mm.mmap_lock; the huge-page allocation did not finish. On B,
: the writer completed, the shrinker freed the pool pages, and the
: allocation finished. The shrinker call was forced at this point.
: This tests TTM's page-freeing path and the lock order, but does not
: show that ordinary reclaim would select TTM at that instant.

      parent reply	other threads:[~2026-11-19 17:00 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-14 11:25 Muchun Song
2026-11-14 11:25 ` [PATCH v3 1/3] mm/hugetlb_vmemmap: fix HWPoison state races during optimization Muchun Song
2026-11-16  9:02   ` Oscar Salvador (SUSE)
2026-11-19  9:12   ` Miaohe Lin
2026-11-14 11:25 ` [PATCH v3 2/3] mm/hugetlb_vmemmap: fix PMD split TLB flush race Muchun Song
2026-11-16 10:08   ` Oscar Salvador (SUSE)
2026-11-14 11:25 ` [PATCH v3 3/3] mm/hugetlb_vmemmap: fix deadlock during PMD split Muchun Song
2026-11-16 10:10   ` Oscar Salvador (SUSE)
2026-11-19 17:00 ` Andrew Morton [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=20261119090050.6858fd2871d2756c6d3c809a@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=azpijr@gmail.com \
    --cc=david@kernel.org \
    --cc=jiaqiyan@google.com \
    --cc=joao.m.martins@oracle.com \
    --cc=linmiaohe@huawei.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=ljs@kernel.org \
    --cc=muchun.song@linux.dev \
    --cc=nao.horiguchi@gmail.com \
    --cc=osalvador@suse.de \
    --cc=rppt@kernel.org \
    --cc=sashiko-bot@kernel.org \
    --cc=songmuchun@bytedance.com \
    --cc=stable@vger.kernel.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

all inboxes | Powered by JetHome®