From: Wei Yang <richard.weiyang@gmail.com>
To: David Hildenbrand <david@redhat.com>
Cc: Wei Yang <richard.weiyang@gmail.com>,
akpm@linux-foundation.org, lorenzo.stoakes@oracle.com,
ziy@nvidia.com, baolin.wang@linux.alibaba.com, npache@redhat.com,
ryan.roberts@arm.com, dev.jain@arm.com, baohua@kernel.org,
linux-mm@kvack.org, "Liam R . Howlett" <Liam.Howlett@oracle.com>,
stable@vger.kernel.org
Subject: Re: [PATCH] mm/khugepaged: fix the address passed to notifier on testing young
Date: Tue, 26 Aug 2025 12:49:29 +0000 [thread overview]
Message-ID: <20250826124929.w5zll53rzgdfok3u@master> (raw)
In-Reply-To: <0a2004c2-76e7-43ea-be47-b6c957e0fc14@redhat.com>
On Tue, Aug 26, 2025 at 10:53:45AM +0200, David Hildenbrand wrote:
>On 22.08.25 08:33, Wei Yang wrote:
>> Commit 8ee53820edfd ("thp: mmu_notifier_test_young") introduced
>> mmu_notifier_test_young(), but we should pass the address need to test.
>
>... "but we are passing the wrong address".
>
>> In xxx_scan_pmd(), the actual iteration address is "_address" not
>> "address". We seem to misuse the variable on the very beginning.
>>
>> Change it to the right one.
>>
>> Fixes: 8ee53820edfd ("thp: mmu_notifier_test_young")
>> Signed-off-by: Wei Yang <richard.weiyang@gmail.com>
>> Cc: David Hildenbrand <david@redhat.com>
>> Cc: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
>> Cc: Zi Yan <ziy@nvidia.com>
>> Cc: Baolin Wang <baolin.wang@linux.alibaba.com>
>> Cc: Liam R. Howlett <Liam.Howlett@oracle.com>
>> Cc: Nico Pache <npache@redhat.com>
>> Cc: Ryan Roberts <ryan.roberts@arm.com>
>> Cc: Dev Jain <dev.jain@arm.com>
>> Cc: Barry Song <baohua@kernel.org>
>> CC: <stable@vger.kernel.org>
>>
>> ---
>> The original commit 8ee53820edfd is at 2011.
>> Then the code is moved to khugepaged.c in commit b46e756f5e470 ("thp:
>> extract khugepaged from mm/huge_memory.c") in 2022.
>> ---
>> mm/khugepaged.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/mm/khugepaged.c b/mm/khugepaged.c
>> index 24e18a7f8a93..b000942250d1 100644
>> --- a/mm/khugepaged.c
>> +++ b/mm/khugepaged.c
>> @@ -1418,7 +1418,7 @@ static int hpage_collapse_scan_pmd(struct mm_struct *mm,
>> if (cc->is_khugepaged &&
>> (pte_young(pteval) || folio_test_young(folio) ||
>> folio_test_referenced(folio) || mmu_notifier_test_young(vma->vm_mm,
>> - address)))
>> + _address)))
>
>Please just put that into a single line, that's a perfectly reasonable case
>to exceed 80 chars.
>
>
>Acked-by: David Hildenbrand <david@redhat.com>
Thanks.
@Andrew
Would you mind adjust the changelog and put it into one line?
>
>> referenced++;
>> }
>> if (!writable) {
>
>Maybe, just maybe, it's because of *horrible* variable naming.
>
>Can someone please send a cleanup to rename address -> pmd_addr and
>_address -> pte_addr or sth like that?
>
>pretty much any naming is better than this.
>
>--
>Cheers
>
>David / dhildenb
--
Wei Yang
Help you, Help me
next prev parent reply other threads:[~2025-08-26 12:49 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-22 6:33 Wei Yang
2025-08-22 7:34 ` Dev Jain
2025-08-23 1:32 ` Wei Yang
2025-08-22 7:38 ` Dev Jain
2025-08-22 7:48 ` Greg KH
2025-08-23 1:29 ` Wei Yang
2025-08-22 17:19 ` Zi Yan
2025-08-26 8:53 ` David Hildenbrand
2025-08-26 9:03 ` Lorenzo Stoakes
2025-08-26 12:51 ` Wei Yang
2025-08-26 12:49 ` Wei Yang [this message]
2025-08-26 9:07 ` Lorenzo Stoakes
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=20250826124929.w5zll53rzgdfok3u@master \
--to=richard.weiyang@gmail.com \
--cc=Liam.Howlett@oracle.com \
--cc=akpm@linux-foundation.org \
--cc=baohua@kernel.org \
--cc=baolin.wang@linux.alibaba.com \
--cc=david@redhat.com \
--cc=dev.jain@arm.com \
--cc=linux-mm@kvack.org \
--cc=lorenzo.stoakes@oracle.com \
--cc=npache@redhat.com \
--cc=ryan.roberts@arm.com \
--cc=stable@vger.kernel.org \
--cc=ziy@nvidia.com \
/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