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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <874kez9v9z.fsf@yhuang6-desk1.ccr.corp.intel.com>
Date:   Wed, 19 May 2021 12:56:08 +0800
From:   "Huang, Ying" <ying.huang@...el.com>
To:     Rik van Riel <riel@...riel.com>
Cc:     Andrew Morton <akpm@...ux-foundation.org>, <linux-mm@...ck.org>,
        <linux-kernel@...r.kernel.org>,
        Matthew Wilcox <willy@...radead.org>,
        Linus Torvalds <torvalds@...ux-foundation.org>,
        "Peter Xu" <peterx@...hat.com>, Hugh Dickins <hughd@...gle.com>,
        Johannes Weiner <hannes@...xchg.org>,
        Mel Gorman <mgorman@...e.de>,
        Andrea Arcangeli <aarcange@...hat.com>,
        Michal Hocko <mhocko@...nel.org>,
        Dave Hansen <dave.hansen@...el.com>,
        Tim Chen <tim.c.chen@...el.com>
Subject: Re: [PATCH] mm: move idle swap cache pages to the tail of LRU after
 COW

Rik van Riel <riel@...riel.com> writes:

> On Wed, 2021-05-19 at 09:33 +0800, Huang Ying wrote:
>
>> To test the patch, we used pmbench memory accessing benchmark with
>> working-set larger than available memory on a 2-socket Intel server
>> with a NVMe SSD as swap device.  Test results shows that the pmbench
>> score increases up to 21.8% with the decreased size of swap cache and
>> swapin throughput.
>
> Nice!
>
>> +++ b/mm/memory.c
>> @@ -3012,6 +3012,11 @@ static vm_fault_t wp_page_copy(struct vm_fault
>> *vmf)
>>  				munlock_vma_page(old_page);
>>  			unlock_page(old_page);
>>  		}
>> +		if (page_copied && PageSwapCache(old_page) &&
>> +		    !page_mapped(old_page) && trylock_page(old_page)) {
>> +			try_to_free_idle_swapcache(old_page);
>> +			unlock_page(old_page);
>> +		}
>
> That's quite the if condition!
>
> Would it make sense to move some of the tests, as well
> as the trylock and unlock into try_to_free_idle_swapcache()
> itself?

Sure.  Will put trylock/unlock into try_to_free_idle_swapcache() as
suggested by Linus.

> Especially considering that page_mapped is already tested
> in that function, too...

The two page_mapped() tests are intended.  The first one is a quick
check with the page unlocked, the second one is to confirm with the page
locked.  Because if the page is unlocked, the swap count may be
transited to map count or vice versa.

Best Regards,
Huang, Ying

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ