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] [day] [month] [year] [list]
Date:   Thu, 06 Apr 2017 08:47:30 +0800
From:   "Huang\, Ying" <ying.huang@...el.com>
To:     Rik van Riel <riel@...hat.com>
Cc:     "Huang\, Ying" <ying.huang@...el.com>,
        Andrew Morton <akpm@...ux-foundation.org>,
        <linux-mm@...ck.org>, <linux-kernel@...r.kernel.org>,
        Hugh Dickins <hughd@...gle.com>, Shaohua Li <shli@...nel.org>,
        Minchan Kim <minchan@...nel.org>
Subject: Re: [PATCH -mm -v2] mm, swap: Sort swap entries before free

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

> On Wed, 2017-04-05 at 15:10 +0800, Huang, Ying wrote:
>> To solve the issue, the per-CPU buffer is sorted according to the
>> swap
>> device before freeing the swap entries.  Test shows that the time
>> spent by swapcache_free_entries() could be reduced after the patch.
>
> That makes a lot of sense.
>
>> @@ -1075,6 +1083,8 @@ void swapcache_free_entries(swp_entry_t
>> *entries, int n)
>>  
>>  	prev = NULL;
>>  	p = NULL;
>> +	if (nr_swapfiles > 1)
>> +		sort(entries, n, sizeof(entries[0]), swp_entry_cmp,
>> NULL);
>
> But it really wants a comment in the code, so people
> reading the code a few years from now can see why
> we are sorting things we are about to free.
>
> Maybe something like:
>         /* Sort swap entries by swap device, so each lock is only taken
> once. */

Good suggestion!  I will add it in the next version.

Best Regards,
Huang, Ying

>>  	for (i = 0; i < n; ++i) {
>>  		p = swap_info_get_cont(entries[i], prev);
>>  		if (p)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ