Johannes Weiner b843786b0b mm: swapfile: fix SSD detection with swapfile on btrfs
We've been noticing a trend of significant lock contention in the swap
subsystem as core counts have been increasing in our fleet.  It turns out
that our swapfiles on btrfs on flash were in fact using the old swap code
for rotational storage.

This turns out to be a detection issue in the swapon sequence: btrfs sets
si->bdev during swap activation, which currently happens *after* swapon's
SSD detection and cluster setup.  Thus, none of the SSD optimizations and
cluster lock splitting are enabled for btrfs swap.

Rearrange the swapon sequence so that filesystem activation happens
*before* determining swap behavior based on the backing device.

Afterwards, the nonrotational drive is detected correctly:

- Adding 2097148k swap on /mnt/swapfile.  Priority:-3 extents:1 across:2097148k
+ Adding 2097148k swap on /mnt/swapfile.  Priority:-3 extents:1 across:2097148k SS

Link: https://lkml.kernel.org/r/20240822112707.351844-1-hannes@cmpxchg.org
Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>
Cc: "Huang, Ying" <ying.huang@intel.com>
Cc: Hugh Dickins <hughd@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
2024-09-03 21:15:46 -07:00
..
2024-09-03 21:15:36 -07:00
2024-07-03 19:29:59 -07:00
2024-09-01 20:26:01 -07:00
2024-09-03 21:15:46 -07:00
2023-12-12 10:11:32 +01:00
2024-09-03 21:15:42 -07:00
2024-09-03 21:15:46 -07:00
2024-09-03 21:15:44 -07:00
2023-04-12 17:36:23 -07:00
2024-09-03 21:15:31 -07:00
2024-09-01 20:26:07 -07:00
2024-09-03 21:15:44 -07:00
2022-10-03 14:02:43 -07:00
2024-09-03 21:15:42 -07:00
2024-09-01 20:26:01 -07:00
2024-09-03 21:15:31 -07:00
2024-08-15 22:16:14 -07:00
2024-07-10 12:14:54 -07:00
2024-09-01 20:26:04 -07:00
2024-09-03 21:15:44 -07:00
2024-08-15 22:16:14 -07:00
2023-04-12 17:36:23 -07:00
2024-04-25 20:55:48 -07:00
2024-04-25 20:55:48 -07:00