From: Rik van Riel <riel@redhat.com>
To: "Huang, Ying" <ying.huang@intel.com>,
Andrew Morton <akpm@linux-foundation.org>
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
Hugh Dickins <hughd@google.com>, Shaohua Li <shli@kernel.org>,
Minchan Kim <minchan@kernel.org>
Subject: Re: [PATCH -mm -v2] mm, swap: Sort swap entries before free
Date: Wed, 05 Apr 2017 10:40:31 -0400 [thread overview]
Message-ID: <1491403231.16856.11.camel@redhat.com> (raw)
In-Reply-To: <20170405071041.24469-1-ying.huang@intel.com>
[-- Attachment #1: Type: text/plain, Size: 914 bytes --]
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
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 473 bytes --]
next prev parent reply other threads:[~2017-04-05 14:40 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-05 7:10 [PATCH -mm -v2] mm, swap: Sort swap entries before free Huang, Ying
2017-04-05 14:40 ` Rik van Riel [this message]
2017-04-06 0:47 ` Huang, Ying
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1491403231.16856.11.camel@redhat.com \
--to=riel@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=hughd@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=minchan@kernel.org \
--cc=shli@kernel.org \
--cc=ying.huang@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).