]> www.infradead.org Git - users/jedix/linux-maple.git/commit
mm: swap: mTHP allocate swap entries from nonfull list
authorChris Li <chrisl@kernel.org>
Wed, 31 Jul 2024 06:49:14 +0000 (23:49 -0700)
committerAndrew Morton <akpm@linux-foundation.org>
Sat, 17 Aug 2024 00:52:45 +0000 (17:52 -0700)
commit20242cbe07374f2df621ee61551c833ffacb159c
tree004c627b4574489f390da9a83f06849a2d9eaeb2
parentf07797f74e4bd40e7dd93be7e0dc31a519a2d76c
mm: swap: mTHP allocate swap entries from nonfull list

Track the nonfull cluster as well as the empty cluster on lists.  Each
order has one nonfull cluster list.

The cluster will remember which order it was used during new cluster
allocation.

When the cluster has free entry, add to the nonfull[order] list.   When
the free cluster list is empty, also allocate from the nonempty list of
that order.

This improves the mTHP swap allocation success rate.

There are limitations if the distribution of numbers of different orders
of mTHP changes a lot.  e.g.  there are a lot of nonfull cluster assign to
order A while later time there are a lot of order B allocation while very
little allocation in order A.  Currently the cluster used by order A will
not reused by order B unless the cluster is 100% empty.

Link: https://lkml.kernel.org/r/20240730-swap-allocator-v5-2-cb9c148b9297@kernel.org
Signed-off-by: Chris Li <chrisl@kernel.org>
Reported-by: Barry Song <21cnbao@gmail.com>
Cc: "Huang, Ying" <ying.huang@intel.com>
Cc: Hugh Dickins <hughd@google.com>
Cc: Kairui Song <kasong@tencent.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