linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: David Hildenbrand <david@redhat.com>
To: Gregory Price <gourry@gourry.net>
Cc: linux-mm@kvack.org, muchun.song@linux.dev, osalvador@suse.de,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] hugetlb.h: flatten logic in arch_hugetlb_migration_supported
Date: Mon, 20 Oct 2025 20:15:06 +0200	[thread overview]
Message-ID: <c3175394-7fc3-43fd-9fad-4d3790837e3e@redhat.com> (raw)
In-Reply-To: <aPZf1aOyhVHVedok@gourry-fedora-PF4VCD3F>

On 20.10.25 18:14, Gregory Price wrote:
> On Mon, Oct 13, 2025 at 10:10:05AM +0200, David Hildenbrand wrote:
>> On 08.10.25 23:26, Gregory Price wrote:
>>> diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
>>> index 526d27e88b3b..b030850975ef 100644
>>> --- a/include/linux/hugetlb.h
>>> +++ b/include/linux/hugetlb.h
>>> @@ -876,12 +876,9 @@ static inline void folio_clear_hugetlb_hwpoison(struct folio *folio)
>>>    #ifndef arch_hugetlb_migration_supported
>>>    static inline bool arch_hugetlb_migration_supported(struct hstate *h)
>>>    {
>>> -	if ((huge_page_shift(h) == PMD_SHIFT) ||
>>> +	return ((huge_page_shift(h) == PMD_SHIFT) ||
>>>    		(huge_page_shift(h) == PUD_SHIFT) ||
>>> -			(huge_page_shift(h) == PGDIR_SHIFT))
>>> -		return true;
>>> -	else
>>> -		return false;
>>> +		(huge_page_shift(h) == PGDIR_SHIFT));
>>
>> switch (huge_page_shift(h)) {
>> case PMD_SHIFT:
>> case PUD_SHIFT:
>> case PGDIR_SHIFT:
> 
> PGDIR_SHIFT is not a constant on x86.

Ah, probably because of 4 vs. 5 level page tables. On x86 the check 
doesn't even make any sense as we don't support PGD-sized pages.

If we could rule that out at compile time, it would be nice. But I don't 
think we have a way to test that support at compile time.

But anyhow, nothing against what we have in this patch here

Acked-by: David Hildenbrand <david@redhat.com>

-- 
Cheers

David / dhildenb



      reply	other threads:[~2025-10-20 18:15 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-08 21:26 Gregory Price
2025-10-08 21:26 ` [PATCH 2/2] hugetlb: add __read_mostly to sysctl_hugetlb_shm_group Gregory Price
2025-10-13  8:08   ` Oscar Salvador
2025-10-13  8:06 ` [PATCH 1/2] hugetlb.h: flatten logic in arch_hugetlb_migration_supported Oscar Salvador
2025-10-13  8:10 ` David Hildenbrand
2025-10-20 16:14   ` Gregory Price
2025-10-20 18:15     ` David Hildenbrand [this message]

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=c3175394-7fc3-43fd-9fad-4d3790837e3e@redhat.com \
    --to=david@redhat.com \
    --cc=gourry@gourry.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=muchun.song@linux.dev \
    --cc=osalvador@suse.de \
    /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