Re: [PATCH v4 0/2] mm/swap: skip empty clusters in the swapoff scan
From: Andrew Morton
Date: Wed Sep 09 2026 - 14:55:41 EST
On Thu, 10 Sep 2026 01:15:50 +0900 Youngjun Park <youngjun.park@xxxxxxx> wrote:
> find_next_to_unuse() walks a swap device one offset at a time. Slot
> state now lives in a per cluster swap table, so patch 2 dismisses an
> empty cluster with one counter read instead of SWAPFILE_CLUSTER table
> reads.
>
> Patch 1 is an unrelated one line comment fix noticed on the way.
>
> A debug test confirmed the skip path runs, and swapoff completed
> under load with no DEBUG_VM or lockdep splats.
Please let's try to make the [0/N] words provide a summary of the
patchset's effects. The above didn't even tell people that this is a
swapoff optimization!
I asked an LLM for this summary and we came up with
: Speed up swapoff and reduce scanning stalls on large, mostly empty
: swap devices by skipping empty clusters. Reduce swapoff time on a 1
: TiB device from 158 ms to 94 ms after filling 128 GiB, and from 392
: ms to 73 ms after filling 512 GiB; expect little benefit when
: substantial swap data remains.
Does that sound OK?