lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87sgh66drw.fsf@yhuang-dev.intel.com>
Date:   Tue, 14 Apr 2020 09:45:39 +0800
From:   "Huang\, Ying" <ying.huang@...el.com>
To:     Andrea Righi <andrea.righi@...onical.com>
Cc:     Andrew Morton <akpm@...ux-foundation.org>,
        Minchan Kim <minchan@...nel.org>,
        Anchal Agarwal <anchalag@...zon.com>, <linux-mm@...ck.org>,
        <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v2] mm: swap: use fixed-size readahead during swapoff

Andrea Righi <andrea.righi@...onical.com> writes:

> On Mon, Apr 13, 2020 at 09:13:33PM +0800, Huang, Ying wrote:
>> Andrea Righi <andrea.righi@...onical.com> writes:
>> 
>> > 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.
>> >
>> > 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).
>> 
>> Why do you need to swapoff after resuming?  The swap device isn't used
>> except hibernation?  I guess the process is,
>> 
>> 1) add swap device to VM
>> 2) hibernate
>> 3) resume
>> 4) swapoff
>
> Correct, the swap device is used only for hibernation, when the system
> is resumed the swap is disabled (swapoff).
>
>> 
>> Some pages are swapped out in step 2?  If os, can we just set
>> /proc/sys/vm/swappiness to 0 to avoid swapping in step 2?
>
> Sorry, can you elaborate more on this? All anonymous pages are swapped
> out during step 2, it doesn't matter if we set swappiness to 0, they are
> swapped out anyway, because we need save them somewhere in order to
> hibernate, shutting down the system.

All pages will be written to the swap device in step 2.  But the normal
swapout path isn't used.  So these pages will be restored in step 3
instead of step 4.  But at the beginning of step 2, system may try to
reclaim some pages, the reclaimed anonymous pages will be restored in
step 4.  This may be avoided via setting /proc/sys/vm/swappiness to 0
before step 2.

Best Regards,
Huang, Ying

> Thanks,
> -Andrea

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ