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