From: Muchun Song <muchun.song@linux.dev>
To: Xiangfeng Cai <caixiangfeng@bytedance.com>
Cc: akpm@linux-foundation.org, osalvador@suse.de, david@kernel.org,
richard.weiyang@linux.alibaba.com, baoquan.he@linux.dev,
shuah@kernel.org, linux-mm@kvack.org,
linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org,
stable@vger.kernel.org
Subject: Re: [PATCH 2/2] selftests/mm: add hugetlb_region_cache_race regression test
Date: Tue, 14 Jul 2026 12:03:49 +0800 [thread overview]
Message-ID: <1C8560A1-1F70-488E-BB62-2407B115F7B5@linux.dev> (raw)
In-Reply-To: <20260713171456.300518-3-caixiangfeng@bytedance.com>
> On Jul 14, 2026, at 01:14, Xiangfeng Cai <caixiangfeng@bytedance.com> wrote:
>
> Add a regression test for the list corruption in
> allocate_file_region_entries() fixed by the previous patch
> ("mm/hugetlb: fix list corruption in allocate_file_region_entries()").
>
> Triggering the bug requires a concurrent reservation operation to drain
> resv->region_cache while allocate_file_region_entries() has dropped
> resv->lock for its GFP_KERNEL allocation, forcing its retry loop to run
> again. As the mmap() and fallocate(PUNCH_HOLE) paths serialise on
> inode_lock, the cache has to be drained by faults from a separate address
> space. The test forks several processes sharing one hugetlb inode via
> memfd_create(MFD_HUGETLB); each mmap()s and faults ranges and punches holes
> to keep the shared resv_map fragmented.
>
> Two modes are provided:
>
> - default: a safe single-process functional check that exercises the buggy
> line without forcing a second loop iteration; safe on any kernel.
>
> - --trigger: the concurrent reproducer, which panics a vulnerable
> CONFIG_DEBUG_LIST=y kernel and is therefore opt-in. It faults pages in,
> so it needs as many free huge pages as the file is large.
>
> Assisted-by: Claude:claude-opus-4-8
> Signed-off-by: Xiangfeng Cai <caixiangfeng@bytedance.com>
It looks like this is a regression test case for a very specific instance of
list corruption.
In my opinion, selftests should focus more on functional testing with clear
expected behaviors and results to users. I don't think it's worth maintaining
a test case for a minor issue like this, especially since code changes happen
so quickly. Once the code evolves, this specific list corruption might never
occur again, and the function itself could even be deleted during a refactor.
Therefore, I wouldn't recommend adding this as a selftest.
Thanks.
next prev parent reply other threads:[~2026-07-14 4:04 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-13 17:14 [PATCH 0/2] mm/hugetlb: fix list corruption in allocate_file_region_entries() Xiangfeng Cai
2026-07-13 17:14 ` [PATCH 1/2] " Xiangfeng Cai
2026-07-14 3:54 ` Muchun Song
2026-07-13 17:14 ` [PATCH 2/2] selftests/mm: add hugetlb_region_cache_race regression test Xiangfeng Cai
2026-07-14 4:03 ` Muchun Song [this message]
2026-07-14 5:38 ` 蔡翔峰
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=1C8560A1-1F70-488E-BB62-2407B115F7B5@linux.dev \
--to=muchun.song@linux.dev \
--cc=akpm@linux-foundation.org \
--cc=baoquan.he@linux.dev \
--cc=caixiangfeng@bytedance.com \
--cc=david@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=osalvador@suse.de \
--cc=richard.weiyang@linux.alibaba.com \
--cc=shuah@kernel.org \
--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
Powered by JetHome