From: Miaohe Lin <linmiaohe@huawei.com>
To: Oscar Salvador <osalvador@suse.de>, Ye Liu <ye.liu@linux.dev>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Ye Liu <liuye@kylinos.cn>,
Naoya Horiguchi <nao.horiguchi@gmail.com>, <linux-mm@kvack.org>,
<linux-kernel@vger.kernel.org>
Subject: Re: [RESEND PATCH] mm/memory_failure: use bool for hugetlb indicator in try_memory_failure_hugetlb
Date: Thu, 14 May 2026 10:34:28 +0800 [thread overview]
Message-ID: <f2154751-03de-bf9d-b25c-d9b7458cc084@huawei.com> (raw)
In-Reply-To: <agQ4cAK-QOvy0otT@localhost.localdomain>
On 2026/5/13 16:38, Oscar Salvador wrote:
> On Wed, May 13, 2026 at 02:50:56PM +0800, Ye Liu wrote:
>>> -static inline int try_memory_failure_hugetlb(unsigned long pfn, int flags, int *hugetlb)
>>> +static inline int try_memory_failure_hugetlb(unsigned long pfn, int flags)
>>> {
>>> return 0;
>>> }
>>> @@ -2386,8 +2385,11 @@ int memory_failure(unsigned long pfn, int flags)
>>> }
>>>
>>> try_again:
>>> - res = try_memory_failure_hugetlb(pfn, flags, &hugetlb);
>>> - if (hugetlb)
>>> + res = try_memory_failure_hugetlb(pfn, flags);
>>> + /*
>>> + * -ENOENT means the page we found is not hugetlb, so proceed with normal page handling
>>> + */
>>> + if (res != -ENOENT)
>>> goto unlock_mutex;
>>>
>>> if (TestSetPageHWPoison(p)) {
>>>
>>>
>>
>>
>> Hi Oscar,
>>
>> Good point. Using -ENOENT to distinguish "not a hugetlb page" from
>> "hugetlb handled" is indeed cleaner than carrying an extra output
>> parameter.
>>
>> One thing to note: the #else stub when CONFIG_HUGETLB_PAGE is not set
>> currently does:
>>
>> return 0;
>>
>> which with your change would mean "hugetlb handled, skip normal path"
>> instead of the intended "not hugetlb, proceed with normal handling".
>> It should be changed to:
>>
>> return -ENOENT;
>
> Right, let us see if Miaohe sees any issue with that approach.
This should work for me. Thanks both.
prev parent reply other threads:[~2026-05-14 2:34 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-13 2:48 [RESEND PATCH] mm/memory_failure: use bool for hugetlb indicator in try_memory_failure_hugetlb Ye Liu
2026-05-13 3:36 ` Oscar Salvador
2026-05-13 6:50 ` Ye Liu
2026-05-13 8:38 ` Oscar Salvador
2026-05-14 2:34 ` Miaohe Lin [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=f2154751-03de-bf9d-b25c-d9b7458cc084@huawei.com \
--to=linmiaohe@huawei.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=liuye@kylinos.cn \
--cc=nao.horiguchi@gmail.com \
--cc=osalvador@suse.de \
--cc=ye.liu@linux.dev \
/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