[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <6787d0ea-a1b9-08cf-1f48-e361058eec20@google.com>
Date: Wed, 16 Apr 2025 22:36:22 -0700 (PDT)
From: Hugh Dickins <hughd@...gle.com>
To: David Hildenbrand <david@...hat.com>
cc: Gavin Guo <gavinguo@...lia.com>, linux-mm@...ck.org,
akpm@...ux-foundation.org, willy@...radead.org, ziy@...dia.com,
linmiaohe@...wei.com, hughd@...gle.com, revest@...gle.com,
kernel-dev@...lia.com, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] mm/huge_memory: fix dereferencing invalid pmd migration
entry
On Wed, 16 Apr 2025, David Hildenbrand wrote:
>
> Why not something like
>
> struct folio *entry_folio;
>
> if (folio) {
> if (is_pmd_migration_entry(*pmd))
> entry_folio = pfn_swap_entry_folio(pmd_to_swp_entry(*pmd)));
> else
> entry_folio = pmd_folio(*pmd));
>
> if (folio != entry_folio)
> return;
> }
My own preference is to not add unnecessary code:
if folio and pmd_migration entry, we're not interested in entry_folio.
But yes it could be written in lots of other ways.
Hugh
Powered by blists - more mailing lists