* + mm-khugepaged-allow-khugepaged-to-check-all-anonymous-mthp-orders.patch added to mm-new branch
@ 2025-06-04 22:22 Andrew Morton
2025-06-05 5:53 ` Baolin Wang
0 siblings, 1 reply; 2+ messages in thread
From: Andrew Morton @ 2025-06-04 22:22 UTC (permalink / raw)
To: mm-commits, zokeefe, ziy, yang, willy, will, wangkefeng.wang,
vishal.moola, usamaarif642, tiwai, thomas.hellstrom, surenb,
sunnanyong, ryan.roberts, rostedt, rientjes, rdunlap, raquini,
peterx, npache, mhocko, mhiramat, mathieu.desnoyers,
lorenzo.stoakes, liam.howlett, kirill.shutemov, jack, hannes,
dev.jain, david, corbet, cl, catalin.marinas, baohua,
anshuman.khandual, aarcange, baolin.wang, akpm
The patch titled
Subject: mm: khugepaged: allow khugepaged to check all anonymous mTHP orders
has been added to the -mm mm-new branch. Its filename is
mm-khugepaged-allow-khugepaged-to-check-all-anonymous-mthp-orders.patch
This patch will shortly appear at
https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-khugepaged-allow-khugepaged-to-check-all-anonymous-mthp-orders.patch
This patch will later appear in the mm-new branch at
git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
Note, mm-new is a provisional staging ground for work-in-progress
patches, and acceptance into mm-new is a notification for others take
notice and to finish up reviews. Please do not hesitate to respond to
review feedback and post updated versions to replace or incrementally
fixup patches in mm-new.
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a
reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next via the mm-everything
branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
and is updated there every 2-3 working days
------------------------------------------------------
From: Baolin Wang <baolin.wang@linux.alibaba.com>
Subject: mm: khugepaged: allow khugepaged to check all anonymous mTHP orders
Date: Wed, 28 May 2025 20:31:46 +0800
We have now allowed mTHP collapse, but thp_vma_allowable_order() still
only checks if the PMD-sized mTHP is allowed to collapse. This prevents
scanning and collapsing of 64K mTHP when only 64K mTHP is enabled. Thus,
we should modify the checks to allow all large orders of anonymous mTHP.
Link: https://lkml.kernel.org/r/ac9ed6d71b439611f9c94b3506a8ce975d4636e9.1748435162.git.baolin.wang@linux.alibaba.com
Signed-off-by: Baolin Wang <baolin.wang@linux.alibaba.com>
Cc: Andrea Arcangeli <aarcange@redhat.com>
Cc: Anshuman Khandual <anshuman.khandual@arm.com>
Cc: Barry Song <baohua@kernel.org>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Christoph Lameter (Ampere) <cl@gentwo.org>
Cc: David Hildenbrand <david@redhat.com>
Cc: David Rientjes <rientjes@google.com>
Cc: Dev Jain <dev.jain@arm.com>
Cc: Jan Kara <jack@suse.cz>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Jonathan Corbet <corbet@lwn.net>
Cc: Kefeng Wang <wangkefeng.wang@huawei.com>
Cc: Kirill A. Shuemov <kirill.shutemov@linux.intel.com>
Cc: Liam Howlett <liam.howlett@oracle.com>
Cc: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Cc: Mariano Pache <npache@redhat.com>
Cc: "Masami Hiramatsu (Google)" <mhiramat@kernel.org>
Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Nanyong Sun <sunnanyong@huawei.com>
Cc: Peter Xu <peterx@redhat.com>
Cc: Rafael Aquini <raquini@redhat.com>
Cc: Randy Dunlap <rdunlap@infradead.org>
Cc: Reported-by:Takashi Iwai <tiwai@suse.de>
Cc: Ryan Roberts <ryan.roberts@arm.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Suren Baghdasaryan <surenb@google.com>
Cc: Thomas Hellstrom <thomas.hellstrom@linux.intel.com>
Cc: Usama Arif <usamaarif642@gmail.com>
Cc: Vishal Moola (Oracle) <vishal.moola@gmail.com>
Cc: Will Deacon <will@kernel.org>
Cc: Yang Shi <yang@os.amperecomputing.com>
Cc: Zach O'Keefe <zokeefe@google.com>
Cc: Zi Yan <ziy@nvidia.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
mm/khugepaged.c | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
--- a/mm/khugepaged.c~mm-khugepaged-allow-khugepaged-to-check-all-anonymous-mthp-orders
+++ a/mm/khugepaged.c
@@ -474,8 +474,11 @@ void khugepaged_enter_vma(struct vm_area
{
if (!test_bit(MMF_VM_HUGEPAGE, &vma->vm_mm->flags) &&
hugepage_pmd_enabled()) {
- if (thp_vma_allowable_order(vma, vm_flags, TVA_ENFORCE_SYSFS,
- PMD_ORDER))
+ unsigned long orders = vma_is_anonymous(vma) ?
+ THP_ORDERS_ALL_ANON : BIT(PMD_ORDER);
+
+ if (thp_vma_allowable_orders(vma, vm_flags, TVA_ENFORCE_SYSFS,
+ orders))
__khugepaged_enter(vma->vm_mm);
}
}
@@ -2399,6 +2402,8 @@ static unsigned int khugepaged_scan_mm_s
vma_iter_init(&vmi, mm, khugepaged_scan.address);
for_each_vma(vmi, vma) {
+ unsigned long orders = vma_is_anonymous(vma) ?
+ THP_ORDERS_ALL_ANON : BIT(PMD_ORDER);
unsigned long hstart, hend;
cond_resched();
@@ -2406,8 +2411,8 @@ static unsigned int khugepaged_scan_mm_s
progress++;
break;
}
- if (!thp_vma_allowable_order(vma, vma->vm_flags,
- TVA_ENFORCE_SYSFS, PMD_ORDER)) {
+ if (!thp_vma_allowable_orders(vma, vma->vm_flags,
+ TVA_ENFORCE_SYSFS, orders)) {
skip:
progress++;
continue;
_
Patches currently in -mm which might be from baolin.wang@linux.alibaba.com are
mm-khugepaged-allow-khugepaged-to-check-all-anonymous-mthp-orders.patch
mm-khugepaged-kick-khugepaged-for-enabling-none-pmd-sized-mthps.patch
mm-fix-the-inaccurate-memory-statistics-issue-for-users.patch
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: + mm-khugepaged-allow-khugepaged-to-check-all-anonymous-mthp-orders.patch added to mm-new branch
2025-06-04 22:22 + mm-khugepaged-allow-khugepaged-to-check-all-anonymous-mthp-orders.patch added to mm-new branch Andrew Morton
@ 2025-06-05 5:53 ` Baolin Wang
0 siblings, 0 replies; 2+ messages in thread
From: Baolin Wang @ 2025-06-05 5:53 UTC (permalink / raw)
To: Andrew Morton, mm-commits, Nico Pache
Hi Andrew,
On 2025/6/5 06:22, Andrew Morton wrote:
> The patch titled
> Subject: mm: khugepaged: allow khugepaged to check all anonymous mTHP orders
> has been added to the -mm mm-new branch. Its filename is
> mm-khugepaged-allow-khugepaged-to-check-all-anonymous-mthp-orders.patch
>
> This patch will shortly appear at
> https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-khugepaged-allow-khugepaged-to-check-all-anonymous-mthp-orders.patch
>
> This patch will later appear in the mm-new branch at
> git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
>
> Note, mm-new is a provisional staging ground for work-in-progress
> patches, and acceptance into mm-new is a notification for others take
> notice and to finish up reviews. Please do not hesitate to respond to
> review feedback and post updated versions to replace or incrementally
> fixup patches in mm-new.
>
> Before you just go and hit "reply", please:
> a) Consider who else should be cc'ed
> b) Prefer to cc a suitable mailing list as well
> c) Ideally: find the original patch on the mailing list and do a
> reply-to-all to that, adding suitable additional cc's
>
> *** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
>
> The -mm tree is included into linux-next via the mm-everything
> branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
> and is updated there every 2-3 working days
>
> ------------------------------------------------------
> From: Baolin Wang <baolin.wang@linux.alibaba.com>
> Subject: mm: khugepaged: allow khugepaged to check all anonymous mTHP orders
> Date: Wed, 28 May 2025 20:31:46 +0800
>
> We have now allowed mTHP collapse, but thp_vma_allowable_order() still
> only checks if the PMD-sized mTHP is allowed to collapse. This prevents
> scanning and collapsing of 64K mTHP when only 64K mTHP is enabled. Thus,
> we should modify the checks to allow all large orders of anonymous mTHP.
Sorry for troubles. Please drop these 2 patches (which are used to fix
the mTHP collapse issues based on Nico's series[1]) from the mm-new
branch. As I talked with Nico, he will rebase his seires and take these
2 patches into his new version. Thanks.
[1]
https://lore.kernel.org/all/ac9ed6d71b439611f9c94b3506a8ce975d4636e9.1748435162.git.baolin.wang@linux.alibaba.com/T/#m9d169daf172d32f94ee5d10e1458868975d7afec
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-06-05 5:53 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-04 22:22 + mm-khugepaged-allow-khugepaged-to-check-all-anonymous-mthp-orders.patch added to mm-new branch Andrew Morton
2025-06-05 5:53 ` Baolin Wang
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.