From: Vineeth Remanan Pillai <vpillai@digitalocean.com>
To: Matthew Wilcox <willy@infradead.org>
Cc: Hugh Dickins <hughd@google.com>,
Andrew Morton <akpm@linux-foundation.org>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
Kelley Nielsen <kelleynnn@gmail.com>,
Rik van Riel <riel@surriel.com>
Subject: Re: [PATCH v2] mm: prototype: rid swapoff of quadratic complexity
Date: Mon, 26 Nov 2018 13:35:30 -0500 [thread overview]
Message-ID: <21acdf55-dbcb-1c8f-4783-9bb496dcbca3@digitalocean.com> (raw)
In-Reply-To: <20181126172255.GK3065@bombadil.infradead.org>
Hi Mathew,
Thanks for your response!
On 11/26/18 12:22 PM, Matthew Wilcox wrote:
> On Mon, Nov 26, 2018 at 04:55:21PM +0000, Vineeth Remanan Pillai wrote:
>> + do {
>> + XA_STATE(xas, &mapping->i_pages, start);
>> + int i;
>> + int entries = 0;
>> + struct page *page;
>> + pgoff_t indices[PAGEVEC_SIZE];
>> + unsigned long end = start + PAGEVEC_SIZE;
>>
>> + rcu_read_lock();
>> + xas_for_each(&xas, page, end) {
> I think this is a mistake. You should probably specify ULONG_MAX for the
> end. Otherwise if there are no swap entries in the first 60kB of the file,
> you'll just exit. That does mean you'll need to check 'entries' for
> hitting PAGEVEC_SIZE.
Thanks for pointing this out. I shall fix this in the next version.
> This seems terribly complicated. You run through i_pages, record the
> indices of the swap entries, then go back and look them up again by
> calling shmem_getpage() which calls the incredibly complex 300 line
> shmem_getpage_gfp().
>
> Can we refactor shmem_getpage_gfp() to skip some of the checks which
> aren't necessary when called from this path, and turn this into a nice
> simple xas_for_each() loop which works one entry at a time?
I shall investigate this and make this simpler as you suggested.
>> + list_for_each_safe(p, next, &shmem_swaplist) {
>> + info = list_entry(p, struct shmem_inode_info, swaplist);
> This could use list_for_each_entry_safe(), right?
Yes, you are right. Will fix.
Thanks,
Vineeth
>
next prev parent reply other threads:[~2018-11-26 18:35 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-26 16:55 [PATCH v2] mm: prototype: rid swapoff of quadratic complexity Vineeth Remanan Pillai
2018-11-26 17:22 ` Matthew Wilcox
2018-11-26 18:35 ` Vineeth Remanan Pillai [this message]
2018-12-03 14:35 ` Vineeth Remanan Pillai
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=21acdf55-dbcb-1c8f-4783-9bb496dcbca3@digitalocean.com \
--to=vpillai@digitalocean.com \
--cc=akpm@linux-foundation.org \
--cc=hughd@google.com \
--cc=kelleynnn@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=riel@surriel.com \
--cc=willy@infradead.org \
/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).