Re: [PATCH linux-next] swap_state: update shadow_nodes for anonymous page
From: yang.yang29
Date: Mon Jan 02 2023 - 20:44:32 EST
I tested the patch, and occur kernel panic, I am trying to solve it.
Hardware: qemu with 4G memory of x86.
OS: 5.14-rc6, with zram enabled.
Test program: some programs malloc and access some memory.
Trigger: count_shadow_nodes() return > 0 many times, and shadow_lru_isolate()
started it's work.
Log:
[ 4955.607376] BUG: unable to handle page fault for address: 000000ab000000aa
[ 4955.607376] #PF: supervisor read access in kernel mode
[ 4955.607376] #PF: error_code(0x0000) - not-present page
[ 4955.607376] PGD 115588067 P4D 0
[ 4955.607376] Oops: 0000 [#1] SMP NOPTI
[ 4955.607376] CPU: 2 PID: 72 Comm: kswapd0 Not tainted 5.14.0-rc6+ #101
[ 4955.607376] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.12.0-0-ga698c8995f-prebuilt.qemu.org 04/01/2014
[ 4955.607376] RIP: 0010:_raw_spin_trylock+0x0/0x20
[ 4955.607376] Code: 0f c1 07 f7 c6 00 02 00 00 74 01 fb c3 0f 1f 00 66 2e 0f 1f 84 00 00 00 00 00 f7 c6 00 02 00 00 c6 07 00 74 01 fb c3 0f 1f 00 <8b> 07 85 c0 75 0b ba 01 00 00 00 f0 0f b1 17 74 03 31 c0 c3 b8 01
[ 4955.607376] RSP: 0018:ff504e75c0267bc0 EFLAGS: 00000082
[ 4955.607376] RAX: 000000000000002f RBX: ff286ccb402c6108 RCX: c0000001001b49d9
[ 4955.607376] RDX: 0000000000000000 RSI: 00000001001b49d9 RDI: 000000ab000000aa
[ 4955.607376] RBP: ff286ccb6f6426e0 R08: 0000000000000003 R09: 000000000752a700
[ 4955.607376] R10: 000000000000003e R11: ff504e75c02679f0 R12: ff286ccb6f6426c8
[ 4955.607376] R13: 000000ab000000aa R14: ff286ccb402c6100 R15: ff286ccb402c6100
[ 4955.607376] FS: 0000000000000000(0000) GS:ff286ccb7bd00000(0000) knlGS:0000000000000000
[ 4955.607376] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 4955.607376] CR2: 000000ab000000aa CR3: 00000001001ae000 CR4: 00000000007516e0
[ 4955.607376] PKRU: 55555554
[ 4955.607376] Call Trace:
[ 4955.607376] shadow_lru_isolate+0x5d/0x1a0
[ 4955.607376] ? workingset_update_node+0x110/0x110
[ 4955.607376] __list_lru_walk_one.isra.14+0x57/0x110
[ 4955.607376] ? workingset_update_node+0x110/0x110
[ 4955.607376] list_lru_walk_one_irq+0x32/0x40
[ 4955.607376] shrink_slab.constprop.88+0x17a/0x380
[ 4955.607376] shrink_node+0x1a8/0x400
[ 4955.607376] balance_pgdat+0x288/0x520
[ 4955.607376] kswapd+0x15e/0x390
[ 4955.607376] ? wait_woken+0x60/0x60
[ 4955.607376] ? balance_pgdat+0x520/0x520
[ 4955.607376] kthread+0xf9/0x140
[ 4955.607376] ? set_kthread_struct+0x40/0x40
[ 4955.607376] ret_from_fork+0x22/0x30
[ 4955.607376] Modules linked in:
[ 4955.607376] CR2: 000000ab000000aa
[ 4955.607376] ---[ end trace 74c5ee73e52d917d ]---
[ 4955.607376] RIP: 0010:_raw_spin_trylock+0x0/0x20
[ 4955.607376] Code: 0f c1 07 f7 c6 00 02 00 00 74 01 fb c3 0f 1f 00 66 2e 0f 1f 84 00 00 00 00 00 f7 c6 00 02 00 00 c6 07 00 74 01 fb c3 0f 1f 00 <8b> 07 85 c0 75 0b ba 01 00 00 00 f0 0f b1 17 74 03 31 c0 c3 b8 01
[ 4955.607376] RSP: 0018:ff504e75c0267bc0 EFLAGS: 00000082
[ 4955.607376] RAX: 000000000000002f RBX: ff286ccb402c6108 RCX: c0000001001b49d9
[ 4955.607376] RDX: 0000000000000000 RSI: 00000001001b49d9 RDI: 000000ab000000aa
[ 4955.607376] RBP: ff286ccb6f6426e0 R08: 0000000000000003 R09: 000000000752a700
[ 4955.607376] R10: 000000000000003e R11: ff504e75c02679f0 R12: ff286ccb6f6426c8
[ 4955.607376] R13: 000000ab000000aa R14: ff286ccb402c6100 R15: ff286ccb402c6100
[ 4955.607376] FS: 0000000000000000(0000) GS:ff286ccb7bd00000(0000) knlGS:0000000000000000
[ 4955.607376] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 4955.607376] CR2: 000000ab000000aa CR3: 00000001001ae000 CR4: 00000000007516e0
[ 4955.607376] PKRU: 5555555