Commit f0eea189 authored by Huang Ying's avatar Huang Ying Committed by Linus Torvalds

mm, THP, swap: don't allocate huge cluster for file backed swap device

It's hard to write a whole transparent huge page (THP) to a file backed
swap device during swapping out and the file backed swap device isn't
very popular.  So the huge cluster allocation for the file backed swap
device is disabled.

Link: default avatar"Huang, Ying" <>
Cc: Johannes Weiner <>
Cc: Minchan Kim <>
Cc: Hugh Dickins <>
Cc: Shaohua Li <>
Cc: Rik van Riel <>
Cc: "Kirill A . Shutemov" <>
Cc: Andrea Arcangeli <>
Cc: Dan Williams <>
Cc: Jens Axboe <>
Cc: Michal Hocko <>
Cc: Ross Zwisler <> [for brd.c, zram_drv.c, pmem.c]
Cc: Vishal L Verma <>
Signed-off-by: default avatarAndrew Morton <>
Signed-off-by: default avatarLinus Torvalds <>
parent ba3c4ce6
......@@ -948,9 +948,10 @@ int get_swap_pages(int n_goal, bool cluster, swp_entry_t swp_entries[])
goto nextsi;
if (cluster)
n_ret = swap_alloc_cluster(si, swp_entries);
if (cluster) {
if (!(si->flags & SWP_FILE))
n_ret = swap_alloc_cluster(si, swp_entries);
} else
n_ret = scan_swap_map_slots(si, SWAP_HAS_CACHE,
n_goal, swp_entries);
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment