linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Zi Yan <ziy@nvidia.com>
To: David Hildenbrand <david@redhat.com>
Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	linux-kselftest@vger.kernel.org
Subject: Re: [PATCH v2 1/2] selftests/mm: split_huge_page_test: fix occasional is_backed_by_folio() wrong results
Date: Tue, 02 Sep 2025 13:04:58 -0400	[thread overview]
Message-ID: <789664CF-2350-4E31-ADA3-BD08FAFC496B@nvidia.com> (raw)
In-Reply-To: <20250902162536.956465-2-david@redhat.com>

On 2 Sep 2025, at 12:25, David Hildenbrand wrote:

> When checking for actual tail or head pages of a folio, we must make
> sure that the KPF_COMPOUND_HEAD/KPF_COMPOUND_TAIL flag is paired with
> KPF_THP.
>
> For example, if we have another large folio after our large folio in
> physical memory, our "pfn_flags & (KPF_THP | KPF_COMPOUND_TAIL" would
> trigger even though it's actually a head page of the next folio.
>
> If is_backed_by_folio() returns a wrong result, split_pte_mapped_thp()
> can fail with "Some THPs are missing during mremap".
>
> Fix it by checking for head/tail pages of folios properly. Add
> folio_tail_flags/folio_head_flags to improve readability and use these
> masks also when just testing for any compound page.
>
> Fixes: 169b456b0162 ("selftests/mm: reimplement is_backed_by_thp() with more precise check")
> Signed-off-by: David Hildenbrand <david@redhat.com>
> ---
>  tools/testing/selftests/mm/split_huge_page_test.c | 15 +++++++--------
>  1 file changed, 7 insertions(+), 8 deletions(-)
>

LGTM. Thanks for fixing it. Reviewed-by: Zi Yan <ziy@nvidia.com>

Best Regards,
Yan, Zi


  reply	other threads:[~2025-09-02 17:05 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-02 16:25 [PATCH v2 0/2] selftests/mm: split_huge_page_test: split_pte_mapped_thp improvements David Hildenbrand
2025-09-02 16:25 ` [PATCH v2 1/2] selftests/mm: split_huge_page_test: fix occasional is_backed_by_folio() wrong results David Hildenbrand
2025-09-02 17:04   ` Zi Yan [this message]
2025-09-02 19:59   ` Wei Yang
2025-09-02 16:25 ` [PATCH v2 2/2] selftests/mm: split_huge_page_test: cleanups for split_pte_mapped_thp test David Hildenbrand
2025-09-02 20:00   ` Wei Yang
2025-09-05  9:26   ` Donet Tom
2025-09-03  7:02 [PATCH v2 0/2] selftests/mm: split_huge_page_test: split_pte_mapped_thp improvements David Hildenbrand
2025-09-03  7:02 ` [PATCH v2 1/2] selftests/mm: split_huge_page_test: fix occasional is_backed_by_folio() wrong results David Hildenbrand

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=789664CF-2350-4E31-ADA3-BD08FAFC496B@nvidia.com \
    --to=ziy@nvidia.com \
    --cc=david@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=linux-mm@kvack.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