linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH] mm/memory-failure: release private data before split THP
@ 2022-08-03  2:52 Yin Fengwei
  2022-08-03  9:39 ` HORIGUCHI NAOYA(堀口 直也)
  2022-08-03 13:01 ` Matthew Wilcox
  0 siblings, 2 replies; 12+ messages in thread
From: Yin Fengwei @ 2022-08-03  2:52 UTC (permalink / raw)
  To: linux-mm, naoya.horiguchi, linmiaohe, willy
  Cc: aaron.lu, tony.luck, qiuxu.zhuo, fengwei.yin

If there is private data attached to THP, the refcount of
THP will be increased and block the THP split. Which could
further cause the meomry failure not recovered.

Release private data attached to THP before split it to
increase the chance of splitting THP successfully.

The issue was hit during HW error injection testing with
5.18 kernel + xfs as rootfs, test got killed and system
reboot was required to re-run the test.

The issue was tracked down to THP split failure caused the
memory failure not being handled. The page dump showed:

[ 1785.433075] page:0000000025f9530b refcount:18 mapcount:0 mapping:000000008162eea7 index:0xa10 pfn:0x2f0200
[ 1785.443954] head:0000000025f9530b order:4 compound_mapcount:0 compound_pincount:0
[ 1785.452408] memcg:ff4247f2d28e9000
[ 1785.456304] aops:xfs_address_space_operations ino:8555182 dentry name:"baseos-filenames.solvx"
[ 1785.466612] flags: 0x1000000000012036(referenced|uptodate|lru|active|private|head|node=0|zone=2)
[ 1785.476514] raw: 1000000000012036 ffb9460f8bc07c08 ffb9460f8bc08408 ff4247f22e6299f8
[ 1785.485268] raw: 0000000000000a10 ff4247f194ade900 00000012ffffffff ff4247f2d28e9000

It was like the error was injected to a large folio for xfs with
private data attached.

With private data released before split THP, the test case
could be run successfully many times without reboot system.

Signed-off-by: Yin Fengwei <fengwei.yin@intel.com>
Reviewed-by: Aaron Lu <aaron.lu@intel.com>
---
 mm/memory-failure.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/mm/memory-failure.c b/mm/memory-failure.c
index da39ec8afca8..08e21973b120 100644
--- a/mm/memory-failure.c
+++ b/mm/memory-failure.c
@@ -1484,7 +1484,16 @@ static int identify_page_state(unsigned long pfn, struct page *p,
 
 static int try_to_split_thp_page(struct page *page, const char *msg)
 {
+	struct page *head = compound_head(page);
+
 	lock_page(page);
+	/*
+	 * If thp page has private data attached, thp split will fail.
+	 * Release private data before split thp.
+	 */
+	if (page_has_private(head))
+		try_to_release_page(head, GFP_KERNEL);
+
 	if (unlikely(split_huge_page(page))) {
 		unsigned long pfn = page_to_pfn(page);
 

base-commit: 9de1f9c8ca5100a02a2e271bdbde36202e251b4b
-- 
2.34.1



^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2022-08-04  2:05 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-03  2:52 [RFC PATCH] mm/memory-failure: release private data before split THP Yin Fengwei
2022-08-03  9:39 ` HORIGUCHI NAOYA(堀口 直也)
2022-08-03 14:42   ` Yin, Fengwei
2022-08-03 13:01 ` Matthew Wilcox
2022-08-03 13:32   ` Yin, Fengwei
2022-08-03 13:36     ` Matthew Wilcox
2022-08-03 13:40       ` Yin, Fengwei
2022-08-03 14:33       ` Yin, Fengwei
2022-08-03 15:26         ` Matthew Wilcox
2022-08-04  1:19   ` Miaohe Lin
2022-08-04  1:54     ` Yin Fengwei
2022-08-04  2:05       ` Miaohe Lin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).