linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/2] mm: swap: mTHP swap allocator base on swap cluster order
@ 2024-06-14 23:48 Chris Li
  2024-06-14 23:48 ` [PATCH v2 1/2] mm: swap: swap cluster switch to double link list Chris Li
                   ` (3 more replies)
  0 siblings, 4 replies; 22+ messages in thread
From: Chris Li @ 2024-06-14 23:48 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Kairui Song, Ryan Roberts, Huang, Ying, Kairui Song,
	Kalesh Singh, linux-kernel, linux-mm, Chris Li, Barry Song

This is the short term solutiolns "swap cluster order" listed
in my "Swap Abstraction" discussion slice 8 in the recent
LSF/MM conference.

When commit 845982eb264bc "mm: swap: allow storage of all mTHP
orders" is introduced, it only allocates the mTHP swap entries
from new empty cluster list.  It has a fragmentation issue
reported by Barry.

https://lore.kernel.org/all/CAGsJ_4zAcJkuW016Cfi6wicRr8N9X+GJJhgMQdSMp+Ah+NSgNQ@mail.gmail.com/

The mTHP allocation failure rate raises to almost 100% after a few
hours in Barry's test run.

The reason is that all the empty cluster has been exhausted while
there are planty of free swap entries to in the cluster that is
not 100% free.

Remember the swap allocation order in the cluster.
Keep track of the per order non full cluster list for later allocation.

This greatly improve the sucess rate of the mTHP swap allocation.

There is some test number in the V1 thread of this series:
https://lore.kernel.org/r/20240524-swap-allocator-v1-0-47861b423b26@kernel.org

Reported-by: Barry Song <21cnbao@gmail.com>
Signed-off-by: Chris Li <chrisl@kernel.org>
---
Changes in v2:
- Add the cluster state field to track the different phases of
  cluster allocations.
- Rename "next" to "list" for the list field, suggested by Ying.
- Update comment for the locking rules for cluster fields and listi,
  suggested by Ying.
- Nonfull list avoid cluster on the per cpu active cluster.
- Allocate from the nonfull list before attempting free list, suggested
  by Kairui.
- Link to v1: https://lore.kernel.org/r/20240524-swap-allocator-v1-0-47861b423b26@kernel.org

---
Chris Li (2):
      mm: swap: swap cluster switch to double link list
      mm: swap: mTHP allocate swap entries from nonfull list

 include/linux/swap.h |  31 +++---
 mm/swapfile.c        | 270 ++++++++++++++++++---------------------------------
 2 files changed, 107 insertions(+), 194 deletions(-)
---
base-commit: 19b8422c5bd56fb5e7085995801c6543a98bda1f
change-id: 20240523-swap-allocator-1534c480ece4

Best regards,
-- 
Chris Li <chrisl@kernel.org>



^ permalink raw reply	[flat|nested] 22+ messages in thread

end of thread, other threads:[~2024-06-19  9:03 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-06-14 23:48 [PATCH v2 0/2] mm: swap: mTHP swap allocator base on swap cluster order Chris Li
2024-06-14 23:48 ` [PATCH v2 1/2] mm: swap: swap cluster switch to double link list Chris Li
2024-06-17  6:19   ` Huang, Ying
2024-06-18  5:06     ` Chris Li
2024-06-18  7:54       ` Huang, Ying
2024-06-18 10:01         ` Chris Li
2024-06-19  7:51           ` Huang, Ying
2024-06-19  9:03             ` Chris Li
2024-06-14 23:48 ` [PATCH v2 2/2] mm: swap: mTHP allocate swap entries from nonfull list Chris Li
2024-06-15  1:06 ` [PATCH v2 0/2] mm: swap: mTHP swap allocator base on swap cluster order Andrew Morton
2024-06-15  2:51   ` Chris Li
2024-06-15  2:59     ` Andrew Morton
2024-06-15  8:47       ` Barry Song
2024-06-17  3:00         ` Huang, Ying
2024-06-17  3:12           ` Barry Song
2024-06-17  3:29             ` Barry Song
2024-06-17  6:48         ` Huang, Ying
2024-06-17  7:08           ` Barry Song
2024-06-17 18:34         ` Chris Li
2024-06-17 23:00           ` Hugh Dickins
2024-06-17 23:47             ` Chris Li
2024-06-18 13:08 ` David Hildenbrand

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox