Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

mm, swap: use SWP_SOLIDSTATE to determine if swap is rotational

The current non rotational check is unreliable as the device's rotational
status can be changed by a user via sysfs.

Use the more reliable SWP_SOLIDSTATE flag which is set at swapon time, to
ensure the nr_rotate_swap count remains consistent. Plus, it is easy to
read and simple.

Link: https://lkml.kernel.org/r/20251031065011.40863-3-youngjun.park@lge.com
Fixes: 81a0298bdfab ("mm, swap: don't use VMA based swap readahead if HDD is used as swap")
Signed-off-by: Youngjun Park <youngjun.park@lge.com>
Reviewed-by: Baoquan He <bhe@redhat.com>
Cc: Barry Song <baohua@kernel.org>
Cc: Chris Li <chrisl@kernel.org>
Cc: Kairui Song <kasong@tencent.com>
Cc: Kemeng Shi <shikemeng@huaweicloud.com>
Cc: Nhat Pham <nphamcs@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

Youngjun Park and committed by
Andrew Morton
68f78bf5 cb65082a

+1 -1
+1 -1
mm/swapfile.c
··· 2910 2910 if (p->flags & SWP_CONTINUED) 2911 2911 free_swap_count_continuations(p); 2912 2912 2913 - if (!p->bdev || !bdev_nonrot(p->bdev)) 2913 + if (!(p->flags & SWP_SOLIDSTATE)) 2914 2914 atomic_dec(&nr_rotate_swap); 2915 2915 2916 2916 mutex_lock(&swapon_mutex);