[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <7a6903d0-0ba1-4536-aea0-08ff511f5149@redhat.com>
Date: Fri, 4 Jul 2025 12:47:18 +0200
From: David Hildenbrand <david@...hat.com>
To: Oscar Salvador <osalvador@...e.de>,
Andrew Morton <akpm@...ux-foundation.org>
Cc: Muchun Song <muchun.song@...ux.dev>, Peter Xu <peterx@...hat.com>,
Gavin Guo <gavinguo@...lia.com>, linux-mm@...ck.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v4 4/5] mm,hugetlb: drop obsolete comment about
non-present pte and second faults
On 30.06.25 16:42, Oscar Salvador wrote:
> There is a comment in hugetlb_fault() that does not hold anymore. This
> one:
>
> /*
> * vmf.orig_pte could be a migration/hwpoison vmf.orig_pte at this
> * point, so this check prevents the kernel from going below assuming
> * that we have an active hugepage in pagecache. This goto expects
> * the 2nd page fault, and is_hugetlb_entry_(migration|hwpoisoned)
> * check will properly handle it.
> */
>
> This was written because back in the day we used to do:
>
> hugetlb_fault () {
> ptep = huge_pte_offset(...)
> if (ptep) {
> entry = huge_ptep_get(ptep)
> if (unlikely(is_hugetlb_entry_migration(entry))
> ...
> else if (unlikely(is_hugetlb_entry_hwpoisoned(entry)))
> ...
> }
>
> ...
> ...
>
> /*
> * entry could be a migration/hwpoison entry at this point, so this
> * check prevents the kernel from going below assuming that we have
> * a active hugepage in pagecache. This goto expects the 2nd page fault,
> * and is_hugetlb_entry_(migration|hwpoisoned) check will properly
> * handle it.
> */
> if (!pte_present(entry))
> goto out_mutex;
> ...
> }
>
> The code was designed to check for hwpoisoned/migration entries upfront,
> and then bail out if further down the pte was not present anymore, relying
> on the second fault to properly handle migration/hwpoison entries that
> time around.
>
> The way we handle this is different nowadays, so drop the misleading
> comment.
>
> Link: https://lkml.kernel.org/r/20250627102904.107202-5-osalvador@suse.de
> Signed-off-by: Oscar Salvador <osalvador@...e.de>
> Cc: David Hildenbrand <david@...hat.com>
> Cc: Gavin Guo <gavinguo@...lia.com>
> Cc: Muchun Song <muchun.song@...ux.dev>
> Cc: Peter Xu <peterx@...hat.com>
> Signed-off-by: Andrew Morton <akpm@...ux-foundation.org>
> ---
Acked-by: David Hildenbrand <david@...hat.com>
--
Cheers,
David / dhildenb
Powered by blists - more mailing lists