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: <1491403231.16856.11.camel@redhat.com>
Date:   Wed, 05 Apr 2017 10:40:31 -0400
From:   Rik van Riel <riel@...hat.com>
To:     "Huang, Ying" <ying.huang@...el.com>,
        Andrew Morton <akpm@...ux-foundation.org>
Cc:     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

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. */

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

Download attachment "signature.asc" of type "application/pgp-signature" (474 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ