mm-swap-remove-swap-slot-cache.patch removed from -mm tree
The quilt patch titled
Subject: mm, swap: remove swap slot cache
has been removed from the -mm tree. Its filename was
mm-swap-remove-swap-slot-cache.patch
This patch was dropped because it was merged into the mm-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
------------------------------------------------------
From: Kairui Song <[email protected]>
Subject: mm, swap: remove swap slot cache
Date: Fri, 14 Mar 2025 00:59:34 +0800
Slot cache is no longer needed now, removing it and all related code.
- vm-scalability with: usemem --init-time -O -y -x -R -31 1G, 12G memory cgroup using simulated pmem as SWAP (32G pmem, 32 CPUs), 16 test runs for each case, measuring the total throughput:
Before (KB/s) (stdev) After (KB/s) (stdev) Random (4K): 424907.60 (24410.78) 414745.92 (34554.78) Random (64K): 163308.82 (11635.72) 167314.50 (18434.99)
Sequential (4K, !-R): 6150056.79 (103205.90) 6321469.06 (115878.16)
The performance changes are below noise level.
- Build linux kernel with make -j96, using 4K folio with 1.5G memory cgroup limit and 64K folio with 2G memory cgroup limit, on top of tmpfs, 12 test runs, measuring the system time:
Before (s) (stdev) After (s) (stdev) make -j96 (4K): 6445.69 (61.95) 6408.80 (69.46) make -j96 (64K): 6841.71 (409.04) 6437.99 (435.55)
Similar to above, 64k mTHP case showed a slight improvement.
---
include/linux/swap.h | 3 include/linux/swap_slots.h | 28 --- mm/Makefile | 2 mm/swap_slots.c | 295 ----------------------------------- mm/swap_state.c | 8 mm/swapfile.c | 194 +++++++---------------- 6 files changed, 67 insertions(+), 463 deletions(-)
include/linux/swap.h renamed from include/linux/swap.h~mm-swap-remove-swap-slot-cache +0 -3
@@ -465,7 +465,6 @@ void free_pages_and_swap_cache(struct enextern atomic_long_t nr_swap_pages;extern long total_swap_pages;extern atomic_t nr_rotate_swap; -extern bool has_usable_swap (void );/* Swap 50% full? Release swapcache more aggressively.. */ static inline bool vm_swap_full (void )
@@ -483,13 +482,11 @@ swp_entry_t folio_alloc_swap(struct folibool folio_free_swap (struct folio *folio);void put_swap_folio (struct folio *folio,swp_entry_t entry);extern swp_entry_t get_swap_page_of_type (int ); -extern int get_swap_pages (int n,swp_entry_t swp_entries[],int order);extern int add_swap_count_continuation (swp_entry_t ,gfp_t );extern void swap_shmem_alloc (swp_entry_t ,int );extern int swap_duplicate (swp_entry_t );extern int swapcache_prepare (swp_entry_t entry,int nr);extern void swap_free_nr (swp_entry_t entry,int nr_pages); -extern void swapcache_free_entries (swp_entry_t *entries,int n);extern void free_swap_and_cache_nr (swp_entry_t entry,int nr);int swap_type_of (dev_t device,sector_t offset);int find_first_swap (dev_t *device);
include/linux/swap_slots.h deleted +0 -28
@@ -1,28 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef _LINUX_SWAP_SLOTS_H -#define _LINUX_SWAP_SLOTS_H - -#include <linux/swap.h> -#include <linux/spinlock.h> -#include <linux/mutex.h> - -#define SWAP_SLOTS_CACHE_SIZE SWAP_BATCH -#define THRESHOLD_ACTIVATE_SWAP_SLOTS_CACHE (5*SWAP_SLOTS_CACHE_SIZE) -#define THRESHOLD_DEACTIVATE_SWAP_SLOTS_CACHE (2*SWAP_SLOTS_CACHE_SIZE) - -struct swap_slots_cache { -bool lock_initialized; -struct mutex alloc_lock;/* protects slots, nr, cur */ -swp_entry_t *slots; -int nr; -int cur; -int n_ret; -}; - -void disable_swap_slots_cache_lock (void ); -void reenable_swap_slots_cache_unlock (void ); -void enable_swap_slots_cache (void ); - -extern bool swap_slot_cache_enabled; - -#endif /* _LINUX_SWAP_SLOTS_H */
mm/Makefile renamed from mm/Makefile~mm-swap-remove-swap-slot-cache +1 -1
@@ -75,7 +75,7 @@ ifdef CONFIG_MMU obj-$(CONFIG_ADVISE_SYSCALLS) += madvise.o endif -obj-$(CONFIG_SWAP) += page_io.o swap_state.o swapfile.o swap_slots.o +obj-$(CONFIG_SWAP) += page_io.o swap_state.o swapfile.o obj-$(CONFIG_ZSWAP) += zswap.o obj-$(CONFIG_HAS_DMA) += dmapool.o obj-$(CONFIG_HUGETLBFS) += hugetlb.o
mm/swapfile.c renamed from mm/swapfile.c~mm-swap-remove-swap-slot-cache +65 -129
313 lines not on this page · raw message
mm/swap_slots.c deleted +0 -295
295 lines not on this page · raw message
mm/swap_state.c renamed from mm/swap_state.c~mm-swap-remove-swap-slot-cache +1 -7
@@ -20,7 +20,6 @@#include <linux/blkdev.h> #include <linux/migrate.h> #include <linux/vmalloc.h> -#include <linux/swap_slots.h> #include <linux/huge_mm.h> #include <linux/shmem_fs.h> #include "internal.h"
@@ -447,13 +446,8 @@ struct folio *__read_swap_cache_async(sw/* * Just skip read ahead for unused swap slot. -* During swap_off when swap_slot_cache is disabled, -* we have to handle the race between putting -* swap entry in swap cache and marking swap slot -* as SWAP_HAS_CACHE. That's done in later part of code or -* else swap_off will be aborted if we return NULL. */ -if (!swap_entry_swapped (si, entry) && swap_slot_cache_enabled) +if (!swap_entry_swapped (si, entry)) goto put_and_return;/*
_
Patches currently in -mm which might be from [email protected] are