From: Zhaoyang Huang <huangzhaoyang@gmail.com>
To: Matthew Wilcox <willy@infradead.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Minchan Kim <minchan@kernel.org>,
Zhaoyang Huang <zhaoyang.huang@unisoc.com>,
"open list:MEMORY MANAGEMENT" <linux-mm@kvack.org>,
LKML <linux-kernel@vger.kernel.org>,
chunyan.zhang@unisoc.com, Baolin Wang <baolin.wang7@gmail.com>
Subject: Re: [PATCH v2] mm : sync ra->ra_pages with bdi->ra_pages
Date: Tue, 25 Aug 2020 09:25:46 +0800 [thread overview]
Message-ID: <CAGWkznGda_V5y99mODJse6STqCN31ADGnYaFBW50ZTzbW7ogyw@mail.gmail.com> (raw)
In-Reply-To: <20200821115744.GP17456@casper.infradead.org>
On Fri, Aug 21, 2020 at 7:57 PM Matthew Wilcox <willy@infradead.org> wrote:
>
> On Fri, Aug 21, 2020 at 05:31:52PM +0800, Zhaoyang Huang wrote:
> > This patch has been verified on an android system and reduces 15% of
> > UNITERRUPTIBLE_SLEEP_BLOCKIO which was used to be caused by wrong
> > ra->ra_pages.
>
> Wait, what? Readahead doesn't sleep on the pages it's requesting.
> Unless ... your file access pattern is random, so you end up submitting
> a readahead I/O that's bigger than needed, so takes longer for the page
> you actually wanted to be returned. I know we have the LOTSAMISS
> logic, but that's not really enough.
>
> OK, assuming this problem is really about sync mmap (ie executables),
> this makes a bit more sense. I think the real problem is here:
>
> ra->start = max_t(long, 0, offset - ra->ra_pages / 2);
> ra->size = ra->ra_pages;
> ra->async_size = ra->ra_pages / 4;
> ra_submit(ra, mapping, file);
>
> which actually skips all the logic we have in ondemand_readahead()
> for adjusting the readahead size. Ugh, this is a mess.
>
> I think a quick fix to your problem will be just replacing ra->ra_pages
> with bdi->ra_pages in do_sync_mmap_readahead() and leaving ra->ra_pages
> alone everywhere else.
>
We can't just sync ra->ra_pages with bdi->ra_pages as eio and fadvise
will shrink or turbo it, that is why I introduce seq_read_fact in this
commit
> We need a smarter readahead algorithm for mmap'ed files, and I don't have
> time to work on it right now. So let's stick to the same dumb algorithm,
> but make it responsive to bdi ra_pages being reset.
prev parent reply other threads:[~2020-08-25 1:26 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-21 9:24 Zhaoyang Huang
2020-08-21 9:31 ` Zhaoyang Huang
2020-08-21 11:57 ` Matthew Wilcox
2020-08-22 1:46 ` Zhaoyang Huang
2020-08-25 1:25 ` Zhaoyang Huang [this message]
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=CAGWkznGda_V5y99mODJse6STqCN31ADGnYaFBW50ZTzbW7ogyw@mail.gmail.com \
--to=huangzhaoyang@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=baolin.wang7@gmail.com \
--cc=chunyan.zhang@unisoc.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=minchan@kernel.org \
--cc=willy@infradead.org \
--cc=zhaoyang.huang@unisoc.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