* Re: [PATCH mm-hotfixes-unstable v18 00/14] khugepaged: add mTHP collapse support
[not found] ` <20260522134724.f4f11941a85ef18b307d16ae@linux-foundation.org>
@ 2026-06-01 15:58 ` Alexander Gordeev
2026-06-01 17:05 ` Nico Pache
2026-06-01 17:08 ` Lorenzo Stoakes
0 siblings, 2 replies; 4+ messages in thread
From: Alexander Gordeev @ 2026-06-01 15:58 UTC (permalink / raw)
To: Andrew Morton, Gerald Schaefer
Cc: Nico Pache, linux-doc, linux-kernel, linux-mm, linux-trace-kernel,
aarcange, anshuman.khandual, apopple, baohua, baolin.wang,
byungchul, catalin.marinas, cl, corbet, dave.hansen, david,
dev.jain, gourry, hannes, hughd, jack, jackmanb, jannh, jglisse,
joshua.hahnjy, kas, lance.yang, liam, ljs, mathieu.desnoyers,
matthew.brost, mhiramat, mhocko, peterx, pfalcato, rakie.kim,
raquini, rdunlap, richard.weiyang, rientjes, rostedt, rppt,
ryan.roberts, shivankg, sunnanyong, surenb, thomas.hellstrom,
tiwai, usamaarif642, vbabka, vishal.moola, wangkefeng.wang, will,
willy, yang, ying.huang, ziy, zokeefe, linux-s390, linux-next
On Fri, May 22, 2026 at 01:47:24PM -0700, Andrew Morton wrote:
Hi Andrew et al,
> On Fri, 22 May 2026 08:59:55 -0600 Nico Pache <npache@redhat.com> wrote:
>
> > The following series provides khugepaged with the capability to collapse
> > anonymous memory regions to mTHPs.
>
> Thanks, I've update mm.git's mm-unstable branch to this version.
>
> It sounds like I might be dropping it soon, haven't started looking at
> that yet. But let's at least eyeball the latest version at this time.
>
> Sashiko was able to apply this, so the base-it-on-hotfixes thing worked
> well, thanks. The AI checking made a few allegations:
This series appears to cause hangs on s390 in linux-next.
The issue is not easily reproducible, so it is not yet confirmed.
Any ideas for a reliable reproducer that exercises the code path below?
[ 2749.385719] sysrq: Show Blocked State
[ 2749.385730] task:khugepaged state:D stack:0 pid:209 tgid:209 ppid:2 task_flags:0x200040 flags:0x00000000
[ 2749.385735] Call Trace:
[ 2749.385736] [<0000017f63c8b226>] __schedule+0x316/0x890
[ 2749.385740] [<0000017f63c8b7dc>] schedule+0x3c/0xc0
[ 2749.385743] [<0000017f63c8b888>] schedule_preempt_disabled+0x28/0x40
[ 2749.385746] [<0000017f63c902ea>] rwsem_down_write_slowpath+0x2fa/0x8b0
[ 2749.385749] [<0000017f63c90910>] down_write+0x70/0x80
[ 2749.385752] [<0000017f6313407a>] collapse_huge_page+0x2ea/0x9e0
[ 2749.385755] [<0000017f6313491e>] mthp_collapse+0x1ae/0x1f0
[ 2749.385757] [<0000017f63134fda>] collapse_scan_pmd+0x67a/0x8f0
[ 2749.385760] [<0000017f6313751a>] collapse_single_pmd+0x15a/0x260
[ 2749.385762] [<0000017f6313792c>] collapse_scan_mm_slot.constprop.0+0x30c/0x470
[ 2749.385765] [<0000017f63137cb6>] khugepaged+0x226/0x240
[ 2749.385768] [<0000017f62db3128>] kthread+0x148/0x170
[ 2749.385770] [<0000017f62d2c238>] __ret_from_fork+0x48/0x220
[ 2749.385772] [<0000017f63c95d0a>] ret_from_fork+0xa/0x30
Thanks!
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH mm-hotfixes-unstable v18 00/14] khugepaged: add mTHP collapse support
2026-06-01 15:58 ` [PATCH mm-hotfixes-unstable v18 00/14] khugepaged: add mTHP collapse support Alexander Gordeev
@ 2026-06-01 17:05 ` Nico Pache
2026-06-01 17:08 ` Lorenzo Stoakes
1 sibling, 0 replies; 4+ messages in thread
From: Nico Pache @ 2026-06-01 17:05 UTC (permalink / raw)
To: Alexander Gordeev
Cc: Andrew Morton, Gerald Schaefer, linux-doc, linux-kernel, linux-mm,
linux-trace-kernel, aarcange, anshuman.khandual, apopple, baohua,
baolin.wang, byungchul, catalin.marinas, cl, corbet, dave.hansen,
david, dev.jain, gourry, hannes, hughd, jack, jackmanb, jannh,
jglisse, joshua.hahnjy, kas, lance.yang, liam, ljs,
mathieu.desnoyers, matthew.brost, mhiramat, mhocko, peterx,
pfalcato, rakie.kim, raquini, rdunlap, richard.weiyang, rientjes,
rostedt, rppt, ryan.roberts, shivankg, sunnanyong, surenb,
thomas.hellstrom, tiwai, usamaarif642, vbabka, vishal.moola,
wangkefeng.wang, will, willy, yang, ying.huang, ziy, zokeefe,
linux-s390, linux-next
On Mon, Jun 1, 2026 at 9:58 AM Alexander Gordeev <agordeev@linux.ibm.com> wrote:
>
> On Fri, May 22, 2026 at 01:47:24PM -0700, Andrew Morton wrote:
>
> Hi Andrew et al,
>
> > On Fri, 22 May 2026 08:59:55 -0600 Nico Pache <npache@redhat.com> wrote:
> >
> > > The following series provides khugepaged with the capability to collapse
> > > anonymous memory regions to mTHPs.
> >
> > Thanks, I've update mm.git's mm-unstable branch to this version.
> >
> > It sounds like I might be dropping it soon, haven't started looking at
> > that yet. But let's at least eyeball the latest version at this time.
> >
> > Sashiko was able to apply this, so the base-it-on-hotfixes thing worked
> > well, thanks. The AI checking made a few allegations:
>
> This series appears to cause hangs on s390 in linux-next.
> The issue is not easily reproducible, so it is not yet confirmed.
> Any ideas for a reliable reproducer that exercises the code path below?
Hi,
Thanks for the report!
was this caught by syzbot? If so, can you provide a link?
Also can you provide whether any of the mTHP sysfs settings were enabled?
Based on the report, it looks like we are either dealing with more
lock contention (due to holding the write lock longer). We could
switch to a trylock but that might cause us to lose some collapse
attempts (which will be retried later, so probably fine). I'm ok with
that approach if it prevents these potential regressions.
Cheers,
-- Nico
>
> [ 2749.385719] sysrq: Show Blocked State
> [ 2749.385730] task:khugepaged state:D stack:0 pid:209 tgid:209 ppid:2 task_flags:0x200040 flags:0x00000000
> [ 2749.385735] Call Trace:
> [ 2749.385736] [<0000017f63c8b226>] __schedule+0x316/0x890
> [ 2749.385740] [<0000017f63c8b7dc>] schedule+0x3c/0xc0
> [ 2749.385743] [<0000017f63c8b888>] schedule_preempt_disabled+0x28/0x40
> [ 2749.385746] [<0000017f63c902ea>] rwsem_down_write_slowpath+0x2fa/0x8b0
> [ 2749.385749] [<0000017f63c90910>] down_write+0x70/0x80
> [ 2749.385752] [<0000017f6313407a>] collapse_huge_page+0x2ea/0x9e0
> [ 2749.385755] [<0000017f6313491e>] mthp_collapse+0x1ae/0x1f0
> [ 2749.385757] [<0000017f63134fda>] collapse_scan_pmd+0x67a/0x8f0
> [ 2749.385760] [<0000017f6313751a>] collapse_single_pmd+0x15a/0x260
> [ 2749.385762] [<0000017f6313792c>] collapse_scan_mm_slot.constprop.0+0x30c/0x470
> [ 2749.385765] [<0000017f63137cb6>] khugepaged+0x226/0x240
> [ 2749.385768] [<0000017f62db3128>] kthread+0x148/0x170
> [ 2749.385770] [<0000017f62d2c238>] __ret_from_fork+0x48/0x220
> [ 2749.385772] [<0000017f63c95d0a>] ret_from_fork+0xa/0x30
>
> Thanks!
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH mm-hotfixes-unstable v18 00/14] khugepaged: add mTHP collapse support
2026-06-01 15:58 ` [PATCH mm-hotfixes-unstable v18 00/14] khugepaged: add mTHP collapse support Alexander Gordeev
2026-06-01 17:05 ` Nico Pache
@ 2026-06-01 17:08 ` Lorenzo Stoakes
2026-06-02 1:53 ` Lance Yang
1 sibling, 1 reply; 4+ messages in thread
From: Lorenzo Stoakes @ 2026-06-01 17:08 UTC (permalink / raw)
To: Alexander Gordeev
Cc: Andrew Morton, Gerald Schaefer, Nico Pache, linux-doc,
linux-kernel, linux-mm, linux-trace-kernel, aarcange,
anshuman.khandual, apopple, baohua, baolin.wang, byungchul,
catalin.marinas, cl, corbet, dave.hansen, david, dev.jain, gourry,
hannes, hughd, jack, jackmanb, jannh, jglisse, joshua.hahnjy, kas,
lance.yang, liam, mathieu.desnoyers, matthew.brost, mhiramat,
mhocko, peterx, pfalcato, rakie.kim, raquini, rdunlap,
richard.weiyang, rientjes, rostedt, rppt, ryan.roberts, shivankg,
sunnanyong, surenb, thomas.hellstrom, tiwai, usamaarif642, vbabka,
vishal.moola, wangkefeng.wang, will, willy, yang, ying.huang, ziy,
zokeefe, linux-s390, linux-next
On Mon, Jun 01, 2026 at 05:58:08PM +0200, Alexander Gordeev wrote:
> On Fri, May 22, 2026 at 01:47:24PM -0700, Andrew Morton wrote:
>
> Hi Andrew et al,
>
> > On Fri, 22 May 2026 08:59:55 -0600 Nico Pache <npache@redhat.com> wrote:
> >
> > > The following series provides khugepaged with the capability to collapse
> > > anonymous memory regions to mTHPs.
> >
> > Thanks, I've update mm.git's mm-unstable branch to this version.
> >
> > It sounds like I might be dropping it soon, haven't started looking at
> > that yet. But let's at least eyeball the latest version at this time.
> >
> > Sashiko was able to apply this, so the base-it-on-hotfixes thing worked
> > well, thanks. The AI checking made a few allegations:
>
> This series appears to cause hangs on s390 in linux-next.
> The issue is not easily reproducible, so it is not yet confirmed.
> Any ideas for a reliable reproducer that exercises the code path below?
>
> [ 2749.385719] sysrq: Show Blocked State
> [ 2749.385730] task:khugepaged state:D stack:0 pid:209 tgid:209 ppid:2 task_flags:0x200040 flags:0x00000000
> [ 2749.385735] Call Trace:
> [ 2749.385736] [<0000017f63c8b226>] __schedule+0x316/0x890
> [ 2749.385740] [<0000017f63c8b7dc>] schedule+0x3c/0xc0
> [ 2749.385743] [<0000017f63c8b888>] schedule_preempt_disabled+0x28/0x40
> [ 2749.385746] [<0000017f63c902ea>] rwsem_down_write_slowpath+0x2fa/0x8b0
> [ 2749.385749] [<0000017f63c90910>] down_write+0x70/0x80
> [ 2749.385752] [<0000017f6313407a>] collapse_huge_page+0x2ea/0x9e0
> [ 2749.385755] [<0000017f6313491e>] mthp_collapse+0x1ae/0x1f0
> [ 2749.385757] [<0000017f63134fda>] collapse_scan_pmd+0x67a/0x8f0
> [ 2749.385760] [<0000017f6313751a>] collapse_single_pmd+0x15a/0x260
> [ 2749.385762] [<0000017f6313792c>] collapse_scan_mm_slot.constprop.0+0x30c/0x470
> [ 2749.385765] [<0000017f63137cb6>] khugepaged+0x226/0x240
> [ 2749.385768] [<0000017f62db3128>] kthread+0x148/0x170
> [ 2749.385770] [<0000017f62d2c238>] __ret_from_fork+0x48/0x220
> [ 2749.385772] [<0000017f63c95d0a>] ret_from_fork+0xa/0x30
>
> Thanks!
Hi Alexander,
Thanks for the report.
It's a pity it's non-repro, I had Claude have a look at it and it couldn't find
a definite issue with the code at v18, all the locks seem balanced internally.
Things it highlighted FWIW:
- Far more mmap_write_lock()'s being taken - the stack-based approach calls
colapse_huge_page() multiple times per-PMD each of which entails an mmap read
lock/unlock and mmap write lock.
- anon_vma write lock held for a much longer period over partial collapse.
So maybe these are triggering issues rather than being the cause of them per-se?
If you happen to see it again could you give the output for:
'echo t > /proc/sysrq-trigger' so we can track who holds the contended lock and
get more details on it?
Also the .config would be useful.
I'm guessing you've also not enabled mTHP in any way on the system?
Repro-wise you could also:
# echo 1 > /sys/kernel/mm/transparent_hugepage/khugepaged/scan_sleep_millisecs
# echo 1 > /sys/kernel/mm/transparent_hugepage/khugepaged/alloc_sleep_millisecs
To get khugepaged going a more aggressively:
$ for f in /sys/kernel/mm/transparent_hugepage/hugepages-*; do echo always | sudo tee $f/enabled; done
Then maybe some stress-ng like sudo stress-ng --vm 4 --vm-bytes 2G --vm-method
all --timeout 5m (or maybe something more refined :)?
Maybe some of this will help repro more reliably?
Cheers, Lorenzo
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH mm-hotfixes-unstable v18 00/14] khugepaged: add mTHP collapse support
2026-06-01 17:08 ` Lorenzo Stoakes
@ 2026-06-02 1:53 ` Lance Yang
0 siblings, 0 replies; 4+ messages in thread
From: Lance Yang @ 2026-06-02 1:53 UTC (permalink / raw)
To: Lorenzo Stoakes, Alexander Gordeev
Cc: Andrew Morton, Gerald Schaefer, Nico Pache, linux-doc,
linux-kernel, linux-mm, linux-trace-kernel, aarcange,
anshuman.khandual, apopple, baohua, baolin.wang, byungchul,
catalin.marinas, cl, corbet, dave.hansen, david, dev.jain, gourry,
hannes, hughd, jack, jackmanb, jannh, jglisse, joshua.hahnjy, kas,
liam, mathieu.desnoyers, matthew.brost, mhiramat, mhocko, peterx,
pfalcato, rakie.kim, raquini, rdunlap, richard.weiyang, rientjes,
rostedt, rppt, ryan.roberts, shivankg, sunnanyong, surenb,
thomas.hellstrom, tiwai, usamaarif642, vbabka, vishal.moola,
wangkefeng.wang, will, willy, yang, ying.huang, ziy, zokeefe,
linux-s390, linux-next
On 2026/6/2 01:08, Lorenzo Stoakes wrote:
> On Mon, Jun 01, 2026 at 05:58:08PM +0200, Alexander Gordeev wrote:
>> On Fri, May 22, 2026 at 01:47:24PM -0700, Andrew Morton wrote:
>>
>> Hi Andrew et al,
>>
>>> On Fri, 22 May 2026 08:59:55 -0600 Nico Pache <npache@redhat.com> wrote:
>>>
>>>> The following series provides khugepaged with the capability to collapse
>>>> anonymous memory regions to mTHPs.
>>>
>>> Thanks, I've update mm.git's mm-unstable branch to this version.
>>>
>>> It sounds like I might be dropping it soon, haven't started looking at
>>> that yet. But let's at least eyeball the latest version at this time.
>>>
>>> Sashiko was able to apply this, so the base-it-on-hotfixes thing worked
>>> well, thanks. The AI checking made a few allegations:
>>
>> This series appears to cause hangs on s390 in linux-next.
>> The issue is not easily reproducible, so it is not yet confirmed.
>> Any ideas for a reliable reproducer that exercises the code path below?
>>
>> [ 2749.385719] sysrq: Show Blocked State
>> [ 2749.385730] task:khugepaged state:D stack:0 pid:209 tgid:209 ppid:2 task_flags:0x200040 flags:0x00000000
>> [ 2749.385735] Call Trace:
>> [ 2749.385736] [<0000017f63c8b226>] __schedule+0x316/0x890
>> [ 2749.385740] [<0000017f63c8b7dc>] schedule+0x3c/0xc0
>> [ 2749.385743] [<0000017f63c8b888>] schedule_preempt_disabled+0x28/0x40
>> [ 2749.385746] [<0000017f63c902ea>] rwsem_down_write_slowpath+0x2fa/0x8b0
>> [ 2749.385749] [<0000017f63c90910>] down_write+0x70/0x80
>> [ 2749.385752] [<0000017f6313407a>] collapse_huge_page+0x2ea/0x9e0
>> [ 2749.385755] [<0000017f6313491e>] mthp_collapse+0x1ae/0x1f0
>> [ 2749.385757] [<0000017f63134fda>] collapse_scan_pmd+0x67a/0x8f0
>> [ 2749.385760] [<0000017f6313751a>] collapse_single_pmd+0x15a/0x260
>> [ 2749.385762] [<0000017f6313792c>] collapse_scan_mm_slot.constprop.0+0x30c/0x470
>> [ 2749.385765] [<0000017f63137cb6>] khugepaged+0x226/0x240
>> [ 2749.385768] [<0000017f62db3128>] kthread+0x148/0x170
>> [ 2749.385770] [<0000017f62d2c238>] __ret_from_fork+0x48/0x220
>> [ 2749.385772] [<0000017f63c95d0a>] ret_from_fork+0xa/0x30
>>
>> Thanks!
>
> Hi Alexander,
>
> Thanks for the report.
>
> It's a pity it's non-repro, I had Claude have a look at it and it couldn't find
> a definite issue with the code at v18, all the locks seem balanced internally.
>
> Things it highlighted FWIW:
>
> - Far more mmap_write_lock()'s being taken - the stack-based approach calls
> colapse_huge_page() multiple times per-PMD each of which entails an mmap read
> lock/unlock and mmap write lock.
>
> - anon_vma write lock held for a much longer period over partial collapse.
>
> So maybe these are triggering issues rather than being the cause of them per-se?
>
> If you happen to see it again could you give the output for:
>
> 'echo t > /proc/sysrq-trigger' so we can track who holds the contended lock and
> get more details on it?
>
> Also the .config would be useful.
>
> I'm guessing you've also not enabled mTHP in any way on the system?
>
> Repro-wise you could also:
>
> # echo 1 > /sys/kernel/mm/transparent_hugepage/khugepaged/scan_sleep_millisecs
> # echo 1 > /sys/kernel/mm/transparent_hugepage/khugepaged/alloc_sleep_millisecs
>
> To get khugepaged going a more aggressively:
>
> $ for f in /sys/kernel/mm/transparent_hugepage/hugepages-*; do echo always | sudo tee $f/enabled; done
>
> Then maybe some stress-ng like sudo stress-ng --vm 4 --vm-bytes 2G --vm-method
> all --timeout 5m (or maybe something more refined :)?
>
> Maybe some of this will help repro more reliably?
>
Cool!
Maybe also worth trying with CONFIG_DETECT_HUNG_TASK=y and
CONFIG_DETECT_HUNG_TASK_BLOCKER=y.
# detect after 10s in D state instead of default 120s
echo 10 > /proc/sys/kernel/hung_task_timeout_secs
# optional: check more often; 0 means same as timeout
echo 0 > /proc/sys/kernel/hung_task_check_interval_secs
With that enabled, the kernel should hopefully tell us which task likely
owns the rwsem. If it is writer-owned, I would expect that to be fairly
reliable.
Cheers, Lance
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-06-02 1:54 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20260522150009.121603-1-npache@redhat.com>
[not found] ` <20260522134724.f4f11941a85ef18b307d16ae@linux-foundation.org>
2026-06-01 15:58 ` [PATCH mm-hotfixes-unstable v18 00/14] khugepaged: add mTHP collapse support Alexander Gordeev
2026-06-01 17:05 ` Nico Pache
2026-06-01 17:08 ` Lorenzo Stoakes
2026-06-02 1:53 ` Lance Yang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox