================================ WARNING: inconsistent lock state 6.4.0-syzkaller-01224-g1ef6663a587b #0 Not tainted -------------------------------- inconsistent {SOFTIRQ-ON-W} -> {IN-SOFTIRQ-W} usage. kworker/u16:6/18555 [HC0[0]:SC1[1]:HE0:SE0] takes: ffff88807ffdc728 (&pgdat->memcg_lru.lock){+.?.}-{2:2}, at: spin_lock include/linux/spinlock.h:350 [inline] ffff88807ffdc728 (&pgdat->memcg_lru.lock){+.?.}-{2:2}, at: lru_gen_rotate_memcg+0x64/0xab0 mm/vmscan.c:4734 {SOFTIRQ-ON-W} state was registered at: lock_acquire kernel/locking/lockdep.c:5705 [inline] lock_acquire+0x1b1/0x520 kernel/locking/lockdep.c:5670 __raw_spin_lock include/linux/spinlock_api_smp.h:133 [inline] _raw_spin_lock+0x2e/0x40 kernel/locking/spinlock.c:154 spin_lock include/linux/spinlock.h:350 [inline] lru_gen_online_memcg+0x16b/0x5a0 mm/vmscan.c:4782 mem_cgroup_css_online+0x227/0x3b0 mm/memcontrol.c:5468 online_css+0xaf/0x2a0 kernel/cgroup/cgroup.c:5505 cgroup_init_subsys+0x46b/0x900 kernel/cgroup/cgroup.c:6036 cgroup_init+0xb83/0x1090 kernel/cgroup/cgroup.c:6120 start_kernel+0x398/0x490 init/main.c:1065 x86_64_start_reservations+0x18/0x30 arch/x86/kernel/head64.c:556 x86_64_start_kernel+0xb3/0xc0 arch/x86/kernel/head64.c:537 secondary_startup_64_no_verify+0x167/0x16b irq event stamp: 1606147 hardirqs last enabled at (1606146): [] mod_memcg_state include/linux/memcontrol.h:982 [inline] hardirqs last enabled at (1606146): [] memcg_account_kmem+0x4f/0x80 mm/memcontrol.c:3094 hardirqs last disabled at (1606147): [] uncharge_batch+0x1c7/0x560 mm/memcontrol.c:7142 softirqs last enabled at (1605814): [] spin_unlock_bh include/linux/spinlock.h:395 [inline] softirqs last enabled at (1605814): [] batadv_nc_purge_paths+0x1cc/0x3c0 net/batman-adv/network-coding.c:471 softirqs last disabled at (1605815): [] do_softirq.part.0+0x87/0xc0 kernel/softirq.c:454 other info that might help us debug this: Possible unsafe locking scenario: CPU0 ---- lock(&pgdat->memcg_lru.lock); lock(&pgdat->memcg_lru.lock); *** DEADLOCK *** 3 locks held by kworker/u16:6/18555: #0: ffff88810b004938 ((wq_completion)bat_events){+.+.}-{0:0}, at: arch_atomic64_set arch/x86/include/asm/atomic64_64.h:34 [inline] #0: ffff88810b004938 ((wq_completion)bat_events){+.+.}-{0:0}, at: arch_atomic_long_set include/linux/atomic/atomic-long.h:41 [inline] #0: ffff88810b004938 ((wq_completion)bat_events){+.+.}-{0:0}, at: atomic_long_set include/linux/atomic/atomic-instrumented.h:1324 [inline] #0: ffff88810b004938 ((wq_completion)bat_events){+.+.}-{0:0}, at: set_work_data kernel/workqueue.c:643 [inline] #0: ffff88810b004938 ((wq_completion)bat_events){+.+.}-{0:0}, at: set_work_pool_and_clear_pending kernel/workqueue.c:670 [inline] #0: ffff88810b004938 ((wq_completion)bat_events){+.+.}-{0:0}, at: process_one_work+0x883/0x15e0 kernel/workqueue.c:2379 #1: ffffc90003807db0 ((work_completion)(&(&bat_priv->nc.work)->work)){+.+.}-{0:0}, at: process_one_work+0x8b7/0x15e0 kernel/workqueue.c:2383 #2: ffffffff8c795f60 (rcu_callback){....}-{0:0}, at: rcu_do_batch kernel/rcu/tree.c:2104 [inline] #2: ffffffff8c795f60 (rcu_callback){....}-{0:0}, at: rcu_core+0x791/0x1ad0 kernel/rcu/tree.c:2377 stack backtrace: CPU: 1 PID: 18555 Comm: kworker/u16:6 Not tainted 6.4.0-syzkaller-01224-g1ef6663a587b #0 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.14.0-2 04/01/2014 Workqueue: bat_events batadv_nc_worker Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0xd9/0x150 lib/dump_stack.c:106 print_usage_bug kernel/locking/lockdep.c:3949 [inline] valid_state kernel/locking/lockdep.c:3991 [inline] mark_lock_irq kernel/locking/lockdep.c:4194 [inline] mark_lock.part.0+0x1110/0x1970 kernel/locking/lockdep.c:4656 mark_lock kernel/locking/lockdep.c:4620 [inline] mark_usage kernel/locking/lockdep.c:4545 [inline] __lock_acquire+0x1227/0x5f30 kernel/locking/lockdep.c:5042 lock_acquire kernel/locking/lockdep.c:5705 [inline] lock_acquire+0x1b1/0x520 kernel/locking/lockdep.c:5670 __raw_spin_lock include/linux/spinlock_api_smp.h:133 [inline] _raw_spin_lock+0x2e/0x40 kernel/locking/spinlock.c:154 spin_lock include/linux/spinlock.h:350 [inline] lru_gen_rotate_memcg+0x64/0xab0 mm/vmscan.c:4734 lru_gen_soft_reclaim+0x62/0x70 mm/vmscan.c:4837 uncharge_batch+0x2be/0x560 mm/memcontrol.c:7145 __mem_cgroup_uncharge+0x11f/0x290 mm/memcontrol.c:7221 mem_cgroup_uncharge include/linux/memcontrol.h:698 [inline] __folio_put_small mm/swap.c:105 [inline] __folio_put+0xb6/0x140 mm/swap.c:129 folio_put include/linux/mm.h:1430 [inline] put_page include/linux/mm.h:1499 [inline] free_page_and_swap_cache+0x257/0x2c0 mm/swap_state.c:305 __tlb_remove_table arch/x86/include/asm/tlb.h:34 [inline] __tlb_remove_table_free mm/mmu_gather.c:153 [inline] tlb_remove_table_rcu+0x89/0xe0 mm/mmu_gather.c:208 rcu_do_batch kernel/rcu/tree.c:2115 [inline] rcu_core+0x806/0x1ad0 kernel/rcu/tree.c:2377 __do_softirq+0x1d4/0x905 kernel/softirq.c:553 do_softirq.part.0+0x87/0xc0 kernel/softirq.c:454 do_softirq kernel/softirq.c:446 [inline] __local_bh_enable_ip+0x106/0x130 kernel/softirq.c:381 spin_unlock_bh include/linux/spinlock.h:395 [inline] batadv_nc_purge_paths+0x1cc/0x3c0 net/batman-adv/network-coding.c:471 batadv_nc_worker+0x8fa/0xfe0 net/batman-adv/network-coding.c:720 process_one_work+0x99a/0x15e0 kernel/workqueue.c:2408 worker_thread+0x67d/0x10c0 kernel/workqueue.c:2555 kthread+0x344/0x440 kernel/kthread.c:379 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:308