Miaohe Lin
0d73477af9
mm/huge_memory: don't unpoison huge_zero_folio
...
commit fe6f86f4b40855a130a19aa589f9ba7f650423f4 upstream.
When I did memory failure tests recently, below panic occurs:
kernel BUG at include/linux/mm.h:1135!
invalid opcode: 0000 [#1 ] PREEMPT SMP NOPTI
CPU: 9 PID: 137 Comm: kswapd1 Not tainted 6.9.0-rc4-00491-gd5ce28f156fe-dirty #14
RIP: 0010:shrink_huge_zero_page_scan+0x168/0x1a0
RSP: 0018:ffff9933c6c57bd0 EFLAGS: 00000246
RAX: 000000000000003e RBX: 0000000000000000 RCX: ffff88f61fc5c9c8
RDX: 0000000000000000 RSI: 0000000000000027 RDI: ffff88f61fc5c9c0
RBP: ffffcd7c446b0000 R08: ffffffff9a9405f0 R09: 0000000000005492
R10: 00000000000030ea R11: ffffffff9a9405f0 R12: 0000000000000000
R13: 0000000000000000 R14: 0000000000000000 R15: ffff88e703c4ac00
FS: 0000000000000000(0000) GS:ffff88f61fc40000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 000055f4da6e9878 CR3: 0000000c71048000 CR4: 00000000000006f0
Call Trace:
<TASK>
do_shrink_slab+0x14f/0x6a0
shrink_slab+0xca/0x8c0
shrink_node+0x2d0/0x7d0
balance_pgdat+0x33a/0x720
kswapd+0x1f3/0x410
kthread+0xd5/0x100
ret_from_fork+0x2f/0x50
ret_from_fork_asm+0x1a/0x30
</TASK>
Modules linked in: mce_inject hwpoison_inject
---[ end trace 0000000000000000 ]---
RIP: 0010:shrink_huge_zero_page_scan+0x168/0x1a0
RSP: 0018:ffff9933c6c57bd0 EFLAGS: 00000246
RAX: 000000000000003e RBX: 0000000000000000 RCX: ffff88f61fc5c9c8
RDX: 0000000000000000 RSI: 0000000000000027 RDI: ffff88f61fc5c9c0
RBP: ffffcd7c446b0000 R08: ffffffff9a9405f0 R09: 0000000000005492
R10: 00000000000030ea R11: ffffffff9a9405f0 R12: 0000000000000000
R13: 0000000000000000 R14: 0000000000000000 R15: ffff88e703c4ac00
FS: 0000000000000000(0000) GS:ffff88f61fc40000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 000055f4da6e9878 CR3: 0000000c71048000 CR4: 00000000000006f0
The root cause is that HWPoison flag will be set for huge_zero_folio
without increasing the folio refcnt. But then unpoison_memory() will
decrease the folio refcnt unexpectedly as it appears like a successfully
hwpoisoned folio leading to VM_BUG_ON_PAGE(page_ref_count(page) == 0) when
releasing huge_zero_folio.
Skip unpoisoning huge_zero_folio in unpoison_memory() to fix this issue.
We're not prepared to unpoison huge_zero_folio yet.
Link: https://lkml.kernel.org/r/20240516122608.22610-1-linmiaohe@huawei.com
Fixes: 478d134e9506 ("mm/huge_memory: do not overkill when splitting huge_zero_page")
Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
Acked-by: David Hildenbrand <david@redhat.com>
Reviewed-by: Yang Shi <shy828301@gmail.com>
Reviewed-by: Oscar Salvador <osalvador@suse.de>
Reviewed-by: Anshuman Khandual <anshuman.khandual@arm.com>
Cc: Naoya Horiguchi <nao.horiguchi@gmail.com>
Cc: Xu Yu <xuyu@linux.alibaba.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-06-21 14:38:46 +02:00
..
2024-06-12 11:12:52 +02:00
2024-04-03 15:28:20 +02:00
2023-09-08 12:16:52 -07:00
2024-06-16 13:47:41 +02:00
2024-02-23 09:25:16 +01:00
2023-03-28 16:20:06 -07:00
2024-06-16 13:47:42 +02:00
2024-05-02 16:32:41 +02:00
2023-06-09 16:25:23 -07:00
2024-03-06 14:48:41 +00:00
2023-06-09 16:25:31 -07:00
2023-04-05 19:42:38 -07:00
2023-06-09 16:25:17 -07:00
2023-06-09 16:25:56 -07:00
2023-06-23 16:59:31 -07:00
2023-06-09 16:25:23 -07:00
2024-04-03 15:28:55 +02:00
2023-07-24 18:04:30 -04:00
2023-06-23 16:58:19 -07:00
2024-05-02 16:32:40 +02:00
2023-06-19 16:19:25 -07:00
2023-08-21 13:07:20 -07:00
2024-06-16 13:47:40 +02:00
2023-02-13 15:54:27 -08:00
2023-08-18 10:12:14 -07:00
2024-06-16 13:47:42 +02:00
2023-08-21 13:37:46 -07:00
2024-05-02 16:32:40 +02:00
2023-08-18 10:12:36 -07:00
2023-08-29 14:25:26 -07:00
2023-05-29 16:14:28 +01:00
2023-08-29 14:25:26 -07:00
2023-09-02 15:17:34 -07:00
2024-06-16 13:47:41 +02:00
2023-04-12 17:36:23 -07:00
2024-05-02 16:32:40 +02:00
2023-08-29 14:25:26 -07:00
2023-08-24 16:20:30 -07:00
2024-03-01 13:35:06 +01:00
2024-03-01 13:35:00 +01:00
2023-09-05 11:11:52 -07:00
2024-01-20 11:51:49 +01:00
2024-06-21 14:38:46 +02:00
2023-08-18 10:12:38 -07:00
2024-04-10 16:36:03 +02:00
2023-11-20 11:58:51 +01:00
2023-02-09 16:51:46 -08:00
2024-04-03 15:28:33 +02:00
2023-08-31 12:20:12 -07:00
2024-03-15 10:48:14 -04:00
2023-08-21 13:07:20 -07:00
2023-08-21 14:26:20 -07:00
2024-01-31 16:18:56 -08:00
2024-04-03 15:28:40 +02:00
2023-08-24 16:20:30 -07:00
2023-08-18 10:12:41 -07:00
2023-08-31 12:20:12 -07:00
2023-09-16 15:23:31 -07:00
2023-08-31 12:20:12 -07:00
2023-08-21 13:37:44 -07:00
2024-05-02 16:32:41 +02:00
2023-08-18 10:12:31 -07:00
2023-01-18 17:12:52 -08:00
2023-08-21 13:37:27 -07:00
2023-08-18 10:12:39 -07:00
2023-08-21 13:37:27 -07:00
2023-08-21 13:37:30 -07:00
2024-05-02 16:32:41 +02:00
2023-08-24 16:20:18 -07:00
2023-08-18 10:12:13 -07:00
2024-02-23 09:25:16 +01:00
2023-09-02 08:39:21 -07:00
2023-06-19 16:19:29 -07:00
2024-02-16 19:10:52 +01:00
2024-06-16 13:47:40 +02:00
2023-06-09 16:25:25 -07:00
2023-06-19 16:19:24 -07:00
2024-05-17 12:02:36 +02:00
2023-09-29 17:20:47 -07:00
2023-08-21 13:38:02 -07:00
2024-04-03 15:28:54 +02:00
2024-04-27 17:11:42 +02:00
2024-05-02 16:32:41 +02:00
2023-06-19 13:19:34 -07:00
2023-04-05 19:42:46 -07:00
2023-10-11 15:24:49 +02:00
2023-07-18 10:07:47 +02:00
2023-07-18 10:07:47 +02:00
2023-07-14 09:57:21 +02:00
2023-08-18 10:12:53 -07:00
2024-01-31 16:18:56 -08:00
2023-08-24 16:20:28 -07:00
2023-06-23 16:59:30 -07:00
2024-03-01 13:35:00 +01:00
2024-04-03 15:28:27 +02:00
2023-08-29 14:25:26 -07:00
2023-04-12 17:36:23 -07:00
2024-06-12 11:11:33 +02:00
2023-11-28 17:20:08 +00:00
2024-06-16 13:47:42 +02:00
2023-08-16 12:21:32 +01:00
2024-04-03 15:28:44 +02:00
2024-05-02 16:32:41 +02:00
2024-06-16 13:47:31 +02:00
2023-08-21 13:37:51 -07:00
2023-06-19 16:19:27 -07:00
2023-06-19 16:19:27 -07:00
2023-08-21 14:26:20 -07:00
2024-03-01 13:35:10 +01:00