Skip to contentSkip to conversation

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

PATCH In review [email protected] 1 participant 1 message Sep 6, 2017

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

PATCH 69/119 mm, THP, swap: don't allocate huge cluster for file backed swap device

From: Huang Ying <[email protected]>
Subject: 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.

Cc Johannes Weiner <[email protected]>
Cc Minchan Kim <[email protected]>
Cc Hugh Dickins <[email protected]>
Cc Shaohua Li <[email protected]>
Cc Rik van Riel <[email protected]>
Cc "Kirill A . Shutemov" <[email protected]>
Cc Andrea Arcangeli <[email protected]>
Cc Dan Williams <[email protected]>
Cc Jens Axboe <[email protected]>
Cc Michal Hocko <[email protected]>
Cc Ross Zwisler <[email protected]> [for brd.c, zram_drv.c, pmem.c]
Cc Vishal L Verma <[email protected]>

---

 mm/swapfile.c |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
mm/swapfile.c renamed from mm/swapfile.c~mm-thp-swap-dont-allocate-huge-cluster-for-file-backed-swap-device +4 -3
diff -puN mm/swapfile.c~mm-thp-swap-dont-allocate-huge-cluster-for-file-backed-swap-device mm/swapfile.c
@@ -948,9 +948,10 @@ start_over:
 			spin_unlock(&si->lock);
 			goto nextsi;
 		}
-		if (cluster)
-			n_ret = swap_alloc_cluster(si, swp_entries);
-		else
+		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);
 		spin_unlock(&si->lock);

_