Miaohe Lin
d72b771191
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:40:38 +02:00
..
2024-03-04 17:01:18 -08:00
2024-03-14 17:43:30 -07:00
2023-12-05 11:17:58 +01:00
2024-06-16 13:51:06 +02:00
2024-03-11 09:38:17 -07:00
2023-10-25 16:47:13 -07:00
2024-02-22 10:24:57 -08:00
2024-06-16 13:51:07 +02:00
2024-02-22 10:24:57 -08:00
2024-03-14 17:43:30 -07:00
2024-01-08 15:27:15 -08:00
2024-02-23 17:27:13 -08:00
2024-03-06 13:04:18 -08:00
2023-12-05 11:17:58 +01: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-03-26 11:07:20 -07:00
2023-12-29 11:58:27 -08:00
2023-06-23 16:58:19 -07:00
2024-04-16 15:39:48 -07:00
2023-12-29 12:22:28 -08:00
2023-08-21 13:07:20 -07:00
2024-06-16 13:51:04 +02:00
2023-10-18 14:34:17 -07:00
2023-12-12 10:57:08 -08:00
2023-10-25 16:47:14 -07:00
2024-06-16 13:51:07 +02:00
2023-12-12 10:11:32 +01:00
2024-04-16 15:39:48 -07:00
2023-08-18 10:12:36 -07:00
2024-03-21 14:41:00 -07:00
2024-01-22 10:31:08 +01:00
2024-03-04 17:01:26 -08:00
2023-12-12 10:57:07 -08:00
2024-06-16 13:51:06 +02:00
2024-02-22 10:24:54 -08:00
2023-04-12 17:36:23 -07:00
2024-04-16 15:39:48 -07:00
2024-03-31 11:32:26 +09:00
2023-08-24 16:20:30 -07:00
2024-06-21 14:40:29 +02:00
2024-03-04 17:01:25 -08:00
2024-03-04 17:01:21 -08:00
2024-02-22 10:24:40 -08:00
2024-06-21 14:40:38 +02:00
2024-02-22 10:24:55 -08:00
2024-04-05 11:21:31 -07:00
2024-03-06 13:04:18 -08:00
2024-03-13 18:38:13 -04:00
2023-12-29 11:58:26 -08:00
2024-03-13 12:12:21 -07:00
2023-12-29 11:58:56 -08:00
2024-02-23 17:28:43 -08:00
2023-08-21 13:07:20 -07:00
2024-03-04 17:01:22 -08:00
2024-03-06 13:04:17 -08:00
2024-03-22 10:41:13 -07:00
2024-02-22 15:27:17 -08:00
2023-08-18 10:12:41 -07:00
2023-12-12 10:57:02 -08:00
2024-02-21 16:00:03 -08:00
2023-10-18 14:34:18 -07:00
2024-02-23 17:48:19 -08:00
2024-03-04 17:01:16 -08:00
2024-03-14 17:43:30 -07:00
2023-08-18 10:12:31 -07:00
2023-12-29 20:22:11 -08:00
2024-03-04 17:01:27 -08:00
2024-05-05 17:28:07 -07:00
2023-12-10 16:51:50 -08:00
2024-01-08 15:27:15 -08:00
2023-08-24 16:20:18 -07:00
2023-12-20 14:48:12 -08:00
2024-02-23 17:48:38 -08:00
2023-12-10 16:51:53 -08:00
2023-06-19 16:19:29 -07:00
2023-12-14 00:23:17 -08:00
2024-06-16 13:51:04 +02:00
2023-12-10 16:51:39 -08:00
2024-02-22 10:24:47 -08:00
2024-05-05 17:28:06 -07:00
2024-02-22 15:27:20 -08:00
2023-08-21 13:38:02 -07:00
2024-03-26 11:07:23 -07:00
2024-05-30 09:44:06 +02:00
2024-01-08 15:27:15 -08:00
2023-10-04 10:32:26 -07:00
2024-01-05 09:58:32 -08:00
2024-01-08 15:27:15 -08:00
2024-03-14 18:03:09 -07:00
2024-03-12 10:16:56 +01:00
2024-05-01 17:28:56 +02:00
2023-08-18 10:12:53 -07:00
2024-02-21 16:00:01 -08:00
2024-02-22 10:24:54 -08:00
2024-03-04 17:01:26 -08:00
2024-03-12 13:07:16 -07:00
2024-02-20 14:20:48 -08:00
2024-03-14 17:43:30 -07:00
2023-12-10 16:51:42 -08:00
2023-04-12 17:36:23 -07:00
2024-05-30 09:44:07 +02:00
2024-03-14 17:43:30 -07:00
2024-06-16 13:51:08 +02:00
2023-11-28 14:08:38 +01:00
2024-03-14 17:43:30 -07:00
2024-01-08 15:27:15 -08:00
2024-02-21 11:36:50 +05:30
2024-02-23 17:48:31 -08:00
2023-06-19 16:19:27 -07:00
2023-06-19 16:19:27 -07:00
2024-03-04 17:01:28 -08:00
2024-04-24 19:34:26 -07:00