linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Zi Yan <ziy@nvidia.com>
To: Hugh Dickins <hughd@google.com>
Cc: Gavin Guo <gavinguo@igalia.com>,
	linux-mm@kvack.org, akpm@linux-foundation.org,
	willy@infradead.org, linmiaohe@huawei.com, revest@google.com,
	david@redhat.com, kernel-dev@igalia.com,
	linux-kernel@vger.kernel.org,
	Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Subject: Re: [PATCH] mm/huge_memory: fix dereferencing invalid pmd migration entry
Date: Fri, 18 Apr 2025 09:25:57 -0400	[thread overview]
Message-ID: <537D4547-383D-4AAF-9F9F-8A37B0BCB7BD@nvidia.com> (raw)
In-Reply-To: <95e543dd-6b93-9507-d383-1ae91e2e6640@google.com>

On 17 Apr 2025, at 1:29, Hugh Dickins wrote:

> On Tue, 15 Apr 2025, Zi Yan wrote:
>>
>> Anyway, we need to figure out why both THP migration and deferred_split_scan()
>> hold the THP lock first, which sounds impossible to me. Or some other execution
>> interleaving is happening.
>
> I think perhaps you're missing that an anon_vma lookup points to a
> location which may contain the folio of interest, but might instead
> contain another folio: and weeding out those other folios is precisely
> what the "folio != pmd_folio((*pmd)" check (and the "risk of replacing
> the wrong folio" comment a few lines above it) is for.

Yes, from Gavin’s commit log, I thought both migration and deferred split
are working on the same folio. But after reread it along with your explanation,
now I understand that both are working on the same pmd migration entry.

Thank you for the explanation.

>
> The "BUG: unable to handle page fault" comes about because that other
> folio might actually be being migrated at this time, so we encounter
> a PMD migration entry instead of a valid PMD entry.  But if it's the
> folio we're looking for, our folio lock excludes a racing migration,
> so it would never be a PMD migration entry for our folio.
>
> Hugh


Best Regards,
Yan, Zi


  reply	other threads:[~2025-04-18 13:26 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-14  7:27 Gavin Guo
2025-04-14 16:50 ` Zi Yan
2025-04-15 10:07   ` Gavin Guo
2025-04-15 15:57     ` Zi Yan
2025-04-17  5:29       ` Hugh Dickins
2025-04-18 13:25         ` Zi Yan [this message]
2025-04-17  5:03   ` Hugh Dickins
2025-04-16 16:10 ` David Hildenbrand
2025-04-17  5:36   ` Hugh Dickins
2025-04-17  7:18     ` David Hildenbrand
2025-04-17  8:07       ` David Hildenbrand
2025-04-17  8:09         ` David Hildenbrand
2025-04-17  8:55         ` Hugh Dickins
2025-04-17  9:04           ` David Hildenbrand
2025-04-17 11:21             ` Gavin Guo
2025-04-17 11:32               ` Zi Yan
2025-04-17 12:02                 ` Gavin Guo
2025-04-17 12:10                   ` Zi Yan
2025-04-17 12:38                     ` Gavin Guo
2025-04-17 11:36               ` David Hildenbrand
2025-04-17 12:05                 ` Gavin Guo
2025-04-17  4:38 ` Hugh Dickins

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=537D4547-383D-4AAF-9F9F-8A37B0BCB7BD@nvidia.com \
    --to=ziy@nvidia.com \
    --cc=akpm@linux-foundation.org \
    --cc=david@redhat.com \
    --cc=gavinguo@igalia.com \
    --cc=hughd@google.com \
    --cc=kernel-dev@igalia.com \
    --cc=linmiaohe@huawei.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=n-horiguchi@ah.jp.nec.com \
    --cc=revest@google.com \
    --cc=willy@infradead.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