From: Zhiheng Tao <junchuan.tzh@antgroup.com>
To: "David Hildenbrand (Red Hat)" <david@kernel.org>
Cc: akpm@linux-foundation.org, lorenzo.stoakes@oracle.com,
ziy@nvidia.com, baolin.wang@linux.alibaba.com,
Liam.Howlett@oracle.com, npache@redhat.com, ryan.roberts@arm.com,
dev.jain@arm.com, baohua@kernel.org, lance.yang@linux.dev,
shy828301@gmail.com, zokeefe@google.com, peterx@redhat.com,
linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mm/khugepaged: Fix skipping of alloc sleep after second failure
Date: Tue, 25 Nov 2025 12:15:03 +0800 [thread overview]
Message-ID: <20251125041503.GA113135@i85a15111.eu95sqa> (raw)
In-Reply-To: <dfe192a8-4a88-407a-83c2-976d953a2227@kernel.org>
On Mon, Nov 24, 2025 at 10:14:20AM +0100, David Hildenbrand (Red Hat) wrote:
> On 11/24/25 07:19, Zhiheng Tao wrote:
> >In khugepaged_do_scan(), two consecutive allocation failures cause
> >the logic to skip the dedicated 60s throttling sleep
> >(khugepaged_alloc_sleep_millisecs), forcing a fallback to the
> >shorter 10s scanning interval via the outer loop
> >
> >Since fragmentation is unlikely to resolve in 10s, this results in
> >wasted CPU cycles on immediate retries.
>
> Why shouldn't memory comapction be able to compact a single THP in 10s?
>
> Why should it resolve in 60s?
>
It may resolve in 10s or 60s. The problem is that the sleep controlled
by khugepaged_alloc_sleep_millisecs should not be skipped if allocation
fails.
> >
> >Reorder the failure logic to ensure khugepaged_alloc_sleep() is
> >always called on each allocation failure.
> >
> >Fixes: c6a7f445a272 ("mm: khugepaged: don't carry huge page to the next loop for !CONFIG_NUMA")
>
> What are we fixing here? This sounds like a change that might be
> better on some systems, but worse on others?
>
> We really need more information on when/how an issue was hit, and
> how this patch here really moves the needle in any way.
>
It works better. The missing of khugepaged_alloc_sleep() is not
introduced by this change. Maybe I should remove "Fix".
> --
> Cheers
>
> David
prev parent reply other threads:[~2025-11-25 4:15 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-24 6:19 Zhiheng Tao
2025-11-24 9:14 ` David Hildenbrand (Red Hat)
2025-11-24 9:27 ` Lance Yang
2025-11-25 4:26 ` Zhiheng Tao
2025-11-25 4:15 ` Zhiheng Tao [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=20251125041503.GA113135@i85a15111.eu95sqa \
--to=junchuan.tzh@antgroup.com \
--cc=Liam.Howlett@oracle.com \
--cc=akpm@linux-foundation.org \
--cc=baohua@kernel.org \
--cc=baolin.wang@linux.alibaba.com \
--cc=david@kernel.org \
--cc=dev.jain@arm.com \
--cc=lance.yang@linux.dev \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=lorenzo.stoakes@oracle.com \
--cc=npache@redhat.com \
--cc=peterx@redhat.com \
--cc=ryan.roberts@arm.com \
--cc=shy828301@gmail.com \
--cc=ziy@nvidia.com \
--cc=zokeefe@google.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