linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] mm/swap: remove plist swap_active_head
@ 2025-10-01  4:34 Baoquan He
  2025-10-01  4:34 ` [PATCH 1/3] mm/swapfile.c: remove __has_usable_swap() Baoquan He
                   ` (3 more replies)
  0 siblings, 4 replies; 22+ messages in thread
From: Baoquan He @ 2025-10-01  4:34 UTC (permalink / raw)
  To: linux-mm; +Cc: akpm, chrisl, kasong, baohua, nphamcs, shikemeng, Baoquan He

In mm/swapfile.c, there are two plist variables, swap_active_head and
swap_avail_head. swap_avail_head contains all available (active, not full)
swap_info_structs orderred by priority. While swap_active_head contains
all active swap_info_structs (active, nor full and full) orderred by
priority. Earlier, it serves three purposes:

1) When swapoff one swap device in the middle, swap devices of priority
   lower than the swapped off swap device will be promoted up value one,
   e.g, I swapped off zram1 of priority '-3', then zram2 promoted to
   have priority '-3', zram3 has priority '-4'. This is done via plist 
   swap_active_head.
   - This code has been taken off in 
     - [PATCH v3 0/2] mm/swapfile.c: select the swap device with default priority round robin

# swapon
NAME       TYPE      SIZE USED PRIO
/dev/zram0 partition  16G   0B   -2
/dev/zram1 partition  16G   0B   -3
/dev/zram2 partition  16G   0B   -4
/dev/zram3 partition  16G   0B   -5
# swapoff /dev/zram1
# swapon
NAME       TYPE      SIZE USED PRIO
/dev/zram0 partition  16G   0B   -2
/dev/zram2 partition  16G   0B   -3
/dev/zram3 partition  16G   0B   -4

2) Find a swap device in swap_active_head when swap off.
   - This can be done through iterating swap_info[] instead. Change is
     done in patch 2.

3) Judge if there's any active swap device via __has_usable_swap().
   - This can be done by checking total_swap_pages instead. Change is
     done in patch 1.

Among them, the purpose 1) is the most important, while it has been
taken off in below patchset. So this patchset removing swap_active_head
sits on top of it.
- [PATCH v3 0/2] mm/swapfile.c: select the swap device with default priority round robin
  - https://lore.kernel.org/all/20250930063311.14126-1-bhe@redhat.com/T/#u

Baoquan He (3):
  mm/swapfile.c: remove __has_usable_swap()
  mm/swapfile.c: use swap_info[] to find the swap device
  mm/swap: remove unneeded swap_active_head

 include/linux/swap.h |  1 -
 mm/swapfile.c        | 31 ++++++++-----------------------
 2 files changed, 8 insertions(+), 24 deletions(-)

-- 
2.41.0



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

end of thread, other threads:[~2025-10-10  2:56 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-10-01  4:34 [PATCH 0/3] mm/swap: remove plist swap_active_head Baoquan He
2025-10-01  4:34 ` [PATCH 1/3] mm/swapfile.c: remove __has_usable_swap() Baoquan He
2025-10-01  4:34 ` [PATCH 2/3] mm/swapfile.c: use swap_info[] to find the swap device Baoquan He
2025-10-02 15:59   ` Chris Li
2025-10-03  2:38     ` Baoquan He
2025-10-03  4:50       ` Chris Li
2025-10-03  5:29         ` Baoquan He
2025-10-01  4:34 ` [PATCH 3/3] mm/swap: remove unneeded swap_active_head Baoquan He
2025-10-02  8:33   ` Chris Li
2025-10-02 13:42     ` Baoquan He
2025-10-09  3:26   ` Andrew Morton
2025-10-09  7:47     ` Baoquan He
2025-10-09 17:09       ` Chris Li
2025-10-10  2:56         ` YoungJun Park
2025-10-10  1:28       ` Andrew Morton
2025-10-10  2:14         ` Baoquan He
2025-10-10  2:34           ` Chris Li
2025-10-10  2:33         ` Chris Li
2025-10-10  2:52         ` Chris Li
2025-10-02  6:04 ` [PATCH 0/3] mm/swap: remove plist swap_active_head Chris Li
2025-10-02 13:09   ` Baoquan He
2025-10-02 16:23     ` Chris Li

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