Re: [moderation/CI] Re: mm/khugepaged: collapse_file() cleanups

Aleksandr Nogikh <[email protected]> Tue, 21 Jul 2026 11:34:21 +0200
Newsgroups dev.linux.lists.syzbot
Message-ID <CANp29Y6YqGtmrdJUUZMn+2cmE5KU7ohqsK8nwiK8QNOzif+qog@mail.gmail.com>
#syz upstream

On Tue, Jul 21, 2026 at 11:33 AM syzbot ci
<[email protected]> wrote:
>
> syzbot ci has tested the following series
>
> [v1] mm/khugepaged: collapse_file() cleanups
> https://lore.kernel.org/all/[email protected]
> * [PATCH 1/8] mm/khugepaged: separate out windy folio logic from collapse_file
> * [PATCH 2/8] mm/khugepaged: factor out page cache folio reading
> * [PATCH 3/8] mm/khugepaged: factor out and simplify dirty/writeback handling
> * [PATCH 4/8] mm/khugepaged: simplify prepare folio locking and exit paths
> * [PATCH 5/8] mm/khugepaged: add kerneldoc to prepare_collapse_file_folio()
> * [PATCH 6/8] mm/khugepaged: hoist isolation into collapse_isolate_folio()
> * [PATCH 7/8] mm/khugepaged: hoist more code into collapse_isolate_folio()
> * [PATCH 8/8] mm/khugepaged: fix and flesh out try_to_unmap_flush() comment
>
> and found the following issue:
> WARNING: bad unlock balance in collapse_scan_file
>
> Full report is available here:
> https://ci.syzbot.org/series/cc30d9d4-857a-45de-a8e8-b99f9346d0da
>
> ***
>
> WARNING: bad unlock balance in collapse_scan_file
>
> tree:      mm-new
> URL:       https://kernel.googlesource.com/pub/scm/linux/kernel/git/akpm/mm.git
> base:      c872b70f5d6c742ad34b8e838c92af81c8920b3e
> arch:      amd64
> compiler:  Debian clang version 22.1.8 (++20260613092233+e80beda6e255-1~exp1~20260613092250.77), Debian LLD 22.1.8
> config:    https://ci.syzbot.org/builds/e6e237b7-5a64-4732-bb37-4e62c3103d4a/config
> syz repro: https://ci.syzbot.org/findings/51ee94c3-7fe6-47f6-81ed-a53cf51bb3f9/syz_repro
>
> =====================================
> WARNING: bad unlock balance detected!
> syzkaller #0 Not tainted
> -------------------------------------
> syz.0.17/5868 is trying to release lock (&xa->xa_lock) at:
> [<ffffffff823ac70f>] spin_unlock_irq include/linux/spinlock.h:402 [inline]
> [<ffffffff823ac70f>] prepare_collapse_file_folio mm/khugepaged.c:2331 [inline]
> [<ffffffff823ac70f>] collapse_file mm/khugepaged.c:2539 [inline]
> [<ffffffff823ac70f>] collapse_scan_file+0x2cbf/0x4dc0 mm/khugepaged.c:2849
> but there are no more locks to release!
>
> other info that might help us debug this:
> no locks held by syz.0.17/5868.
>
> stack backtrace:
> CPU: 0 UID: 0 PID: 5868 Comm: syz.0.17 Not tainted syzkaller #0 PREEMPT(full)
> Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.2-debian-1.16.2-1 04/01/2014
> Call Trace:
>  <TASK>
>  dump_stack_lvl+0xe8/0x150 lib/dump_stack.c:120
>  print_unlock_imbalance_bug+0xdc/0xf0 kernel/locking/lockdep.c:5299
>  __lock_release kernel/locking/lockdep.c:5528 [inline]
>  lock_release+0x1fb/0x3c0 kernel/locking/lockdep.c:5912
>  __raw_spin_unlock_irq include/linux/spinlock_api_smp.h:185 [inline]
>  _raw_spin_unlock_irq+0x16/0x50 kernel/locking/spinlock.c:206
>  spin_unlock_irq include/linux/spinlock.h:402 [inline]
>  prepare_collapse_file_folio mm/khugepaged.c:2331 [inline]
>  collapse_file mm/khugepaged.c:2539 [inline]
>  collapse_scan_file+0x2cbf/0x4dc0 mm/khugepaged.c:2849
>  collapse_single_pmd+0x2b1/0x3da0 mm/khugepaged.c:2884
>  madvise_collapse+0x2cf/0x790 mm/khugepaged.c:3310
>  madvise_vma_behavior+0x115f/0x4170 mm/madvise.c:1363
>  madvise_walk_vmas+0x576/0xb00 mm/madvise.c:1712
>  madvise_do_behavior+0x385/0x540 mm/madvise.c:1907
>  do_madvise+0x327/0x3a0 mm/madvise.c:2005
>  __do_sys_madvise mm/madvise.c:2014 [inline]
>  __se_sys_madvise mm/madvise.c:2012 [inline]
>  __x64_sys_madvise+0xa6/0xc0 mm/madvise.c:2012
>  do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
>  do_syscall_64+0x174/0x580 arch/x86/entry/syscall_64.c:94
>  entry_SYSCALL_64_after_hwframe+0x77/0x7f
> RIP: 0033:0x7fb60079de99
> Code: ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 e8 ff ff ff f7 d8 64 89 01 48
> RSP: 002b:00007fb6015c0028 EFLAGS: 00000246 ORIG_RAX: 000000000000001c
> RAX: ffffffffffffffda RBX: 00007fb600a25fa0 RCX: 00007fb60079de99
> RDX: 0000000000000019 RSI: 0000000000600003 RDI: 0000200000000000
> RBP: 00007fb600833eaf R08: 0000000000000000 R09: 0000000000000000
> R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
> R13: 00007fb600a26038 R14: 00007fb600a25fa0 R15: 00007ffc7db2f618
>  </TASK>
>
>
> ***
>
> If these findings have caused you to resend the series or submit a
> separate fix, please add the following tag to your commit message:
>   Tested-by: [email protected]
>
> ---
> This report is generated by a bot. It may contain errors.
> syzbot ci engineers can be reached at [email protected].
>
> To test a patch for this bug, please reply with `#syz test`
> (should be on a separate line).
>
> The patch should be attached to the email.
> Note: arguments like custom git repos and branches are not supported.
>
> The email will later be sent to:
> [[email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected]]
>
> If the report looks fine to you, reply with:
> #syz upstream
>
> If the report is a false positive, reply with
> #syz invalid
>