Skip to contentSkip to conversation

mm, THP, swap: Check whether CONFIG_THP_SWAP enabled earlier

PATCH New Huang, Ying 1 participant 1 message May 22, 2017

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mm, THP, swap: Check whether CONFIG_THP_SWAP enabled earlier

From: Huang Ying <[email protected]>

This patch is only a code clean up patch without functionality changes. It moves CONFIG_THP_SWAP checking from inside swap slot allocation to before we start swapping the THP. This makes the code path a little easier to be followed and understood.

Cc Johannes Weiner <[email protected]>
Cc Minchan Kim <[email protected]>
---
 mm/swap_slots.c | 3 +--
 mm/vmscan.c     | 3 ++-
 2 files changed, 3 insertions(+), 3 deletions(-)
mm/swap_slots.c +1 -2
index 90c1032a8ac3..14c2a91289e5 100644
@@ -310,8 +310,7 @@ swp_entry_t get_swap_page(struct page *page)
 	entry.val = 0;
 
 	if (PageTransHuge(page)) {
-		if (IS_ENABLED(CONFIG_THP_SWAP))
-			get_swap_pages(1, true, &entry);
+		get_swap_pages(1, true, &entry);
 		return entry;
 	}
 
mm/vmscan.c +2 -1
index f7e949ac9756..90722afd4916 100644
@@ -1134,7 +1134,8 @@ static unsigned long shrink_page_list(struct list_head *page_list,
 				 * away. Chances are some or all of the
 				 * tail pages can be freed without IO.
 				 */
-				if (!compound_mapcount(page) &&
+				if ((!IS_ENABLED(CONFIG_THP_SWAP) ||
+				     !compound_mapcount(page)) &&
 				    split_huge_page_to_list(page, page_list))
 					goto activate_locked;
 			}
Signature · 7 lines
2.11.0

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>