Re: [PATCH v3 0/2] mm/swap: skip empty clusters in the swapoff scan

Andrew Morton <[email protected]>
Newsgroups gmane.linux.kernel,gmane.linux.kernel.mm
Message-ID <[email protected]>
On Fri, 7 Aug 2026 16:42:22 +0800 Baoquan He <[email protected]> wrote:

> > I have no measured times yet, since that case has to be set up on purpose.
> > What I did is the arithmetic for the case that skips best,
> > For example 1T of swap with 256M slots with SWAPFILE_CLUSTER = 512
> > and everything free but the far end:
> > 
> >   - today:          256M table reads
> >   - with the skip:  512K counter reads
> 
> 
> Maybe just use time to measure swapoff time consuming, just like below
> as I did on a kvm guest, I guess a bare metal machine with larger system
> ram could be more obvious?
> 
> root@fedora:~# free -h
>                total        used        free      shared  buff/cache   available
> Mem:           3.8Gi       181Mi       3.6Gi       924Ki        72Mi       3.7Gi
> Swap:          2.0Gi        18Mi       2.0Gi
> root@fedora:~# time swapoff /dev/vdb
> 
> real	0m0.101s
> user	0m0.001s
> sys	0m0.017s
> root@fedora:~# swapon /dev/vdb
> root@fedora:~# time swapoff /dev/vdb
> 
> real	0m0.014s
> user	0m0.003s
> sys	0m0.001s
> 
> Not sure if Andrew is asking for this.

I think it's helpful to include such info.  The audience for changelogs
is more than swap developers!  It's also an MM maintainer and -stable
maintainers and other people who are all wondering "should I backport
this for my users".  Let's give them the means to determine that.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.