Skip to contentSkip to conversation

mm, swap: Make CONFIG_THP_SWAP depends on CONFIG_SWAP

PATCH New Huang, Ying 1 participant 1 message Jul 13, 2018

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

PATCH 1/1 mm, swap: Make CONFIG_THP_SWAP depends on CONFIG_SWAP

From: Huang Ying <[email protected]>

CONFIG_THP_SWAP should depend on CONFIG_SWAP, because it's unreasonable to optimize swapping for THP (Transparent Huge Page) without basic swapping support.

In original code, when CONFIG_SWAP=n and CONFIG_THP_SWAP=y, split_swap_cluster() will not be built because it is in swapfile.c, but it will be called in huge_memory.c. This doesn't trigger a build error in practice because the call site is enclosed by PageSwapCache(), which is defined to be constant 0 when CONFIG_SWAP=n. But this is fragile and should be fixed.

The comments are fixed too to reflect the latest progress.

Fixes 38d8b4e6bdc8 ("mm, THP, swap: delay splitting THP during swap out")
Cc Michal Hocko <[email protected]>
Cc Johannes Weiner <[email protected]>
Cc Shaohua Li <[email protected]>
Cc Hugh Dickins <[email protected]>
Cc Minchan Kim <[email protected]>
Cc Rik van Riel <[email protected]>
Cc Dave Hansen <[email protected]>
Cc Zi Yan <[email protected]>
Cc Daniel Jordan <[email protected]>
---
 mm/Kconfig | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
mm/Kconfig +3 -2
index b78e7cd4e9fe..97114c94239c 100644
@@ -419,10 +419,11 @@ config ARCH_WANTS_THP_SWAP
 
 config THP_SWAP
 	def_bool y
-	depends on TRANSPARENT_HUGEPAGE && ARCH_WANTS_THP_SWAP
+	depends on TRANSPARENT_HUGEPAGE && ARCH_WANTS_THP_SWAP && SWAP
 	help
 	  Swap transparent huge pages in one piece, without splitting.
-	  XXX: For now this only does clustered swap space allocation.
+	  XXX: For now, swap cluster backing transparent huge page
+	  will be split after swapout.
 
 	  For selection by architectures with reasonable THP sizes.
 
Signature · 1 line
2.16.4