mm: swap: relaim the cached parts that got scanned
authorKairui Song <kasong@tencent.com>
Wed, 31 Jul 2024 06:49:20 +0000 (23:49 -0700)
committerAndrew Morton <akpm@linux-foundation.org>
Wed, 4 Sep 2024 04:15:26 +0000 (21:15 -0700)
commit661383c6111a38c88df61af6bfbcfacd2ff20a67
treeadc1bef70d6a15c53589287bdb4d1e3f419cbcdf
parent477cb7ba28892eda112c79d8f75d10edabfc3050
mm: swap: relaim the cached parts that got scanned

This commit implements reclaim during scan for cluster allocator.

Cluster scanning were unable to reuse SWAP_HAS_CACHE slots, which could
result in low allocation success rate or early OOM.

So to ensure maximum allocation success rate, integrate reclaiming with
scanning.  If found a range of suitable swap slots but fragmented due to
HAS_CACHE, just try to reclaim the slots.

Link: https://lkml.kernel.org/r/20240730-swap-allocator-v5-8-cb9c148b9297@kernel.org
Signed-off-by: Kairui Song <kasong@tencent.com>
Reported-by: Barry Song <21cnbao@gmail.com>
Cc: Chris Li <chrisl@kernel.org>
Cc: "Huang, Ying" <ying.huang@intel.com>
Cc: Hugh Dickins <hughd@google.com>
Cc: Kalesh Singh <kaleshsingh@google.com>
Cc: Ryan Roberts <ryan.roberts@arm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
include/linux/swap.h
mm/swapfile.c