Skip to contentSkip to conversation

mm/thp: fix node page state in split_huge_page_to_list()

PATCH In review [email protected] 1 participant 1 message Oct 19, 2019

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

PATCH 22/26 mm/thp: fix node page state in split_huge_page_to_list()

From: "Kirill A. Shutemov" <[email protected]>
Subject: mm/thp: fix node page state in split_huge_page_to_list()

Make sure split_huge_page_to_list() handles the state of shmem THP and file THP properly.

Fixes 60fbf0ab5da1 ("mm,thp: stats for file backed THP")
Cc Matthew Wilcox (Oracle) <[email protected]>
Cc Oleg Nesterov <[email protected]>
Cc Srikar Dronamraju <[email protected]>
Cc William Kucharski <[email protected]>

---

 mm/huge_memory.c |    9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
mm/huge_memory.c renamed from mm/huge_memory.c~mm-thp-fix-node-page-state-in-split_huge_page_to_list +7 -2
@@ -2789,8 +2789,13 @@ int split_huge_page_to_list(struct page
 			ds_queue->split_queue_len--;
 			list_del(page_deferred_list(head));
 		}
-		if (mapping)
-			__dec_node_page_state(page, NR_SHMEM_THPS);
+		if (mapping) {
+			if (PageSwapBacked(page))
+				__dec_node_page_state(page, NR_SHMEM_THPS);
+			else
+				__dec_node_page_state(page, NR_FILE_THPS);
+		}
+
 		spin_unlock(&ds_queue->split_queue_lock);
 		__split_huge_page(page, list, end, flags);
 		if (PageSwapCache(head)) {

_