Messages in this thread | | | From | "Huang\, Ying" <> | Subject | Re: [PATCH] mm: swap: introduce fixed-size readahead policy | Date | Mon, 13 Apr 2020 09:24:14 +0800 |
| |
Andrea Righi <andrea.righi@canonical.com> writes:
> Introduce a new fixed-size swap-in readahead policy that can be selected > at run-time. > > The global swap-in readahead policy takes in account the previous access > patterns, using a scaling heuristic to determine the optimal readahead > chunk dynamically. > > This works pretty well in most cases, but like any heuristic there are > specific cases when this approach is not ideal, for example the swapoff > scenario. > > During swapoff we just want to load back into memory all the swapped-out > pages and for this specific use case a fixed-size readahead is more > efficient. > > This patch introduces a new sysfs interface > (/sys/kernel/mm/swap/swap_ra_policy) that can be set as following: > > - 0: current scaling swap-in readahead policy (default) > - 1: fixed-size readahead policy (size is determined by > vm.page-cluster) > > The specific use case this patch is addressing is to improve swapoff > performance when a VM has been hibernated, resumed and all memory needs > to be forced back to RAM by disabling swap (see the test case below).
I don't know whether the use case is important or not. Usually the performance of swapoff doesn't matter. Maybe you can provide some information on this.
Even if it's important, I don't think we really need to add another ABI. You can just optimize the swapoff performance inside kernel. And we may not even need to add a new policy, just use cluster readahead and increase swapin_readahead_hits in swapoff if cluster readahead is used.
Best Regards, Huang, Ying
| |