Skip to content

Commit

Permalink
mm, swap: make CONFIG_THP_SWAP depend on CONFIG_SWAP
Browse files Browse the repository at this point in the history
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.

Link: http://lkml.kernel.org/r/[email protected]
Fixes: 38d8b4e ("mm, THP, swap: delay splitting THP during swap out")
Signed-off-by: "Huang, Ying" <[email protected]>
Reviewed-by: Dan Williams <[email protected]>
Reviewed-by: Naoya Horiguchi <[email protected]>
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]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
yhuang-intel authored and torvalds committed Aug 17, 2018
1 parent 2a3cb8b commit 14fef28
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions mm/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down

0 comments on commit 14fef28

Please sign in to comment.