[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAGWkznGda_V5y99mODJse6STqCN31ADGnYaFBW50ZTzbW7ogyw@mail.gmail.com>
Date: Tue, 25 Aug 2020 09:25:46 +0800
From: Zhaoyang Huang <huangzhaoyang@...il.com>
To: Matthew Wilcox <willy@...radead.org>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
Minchan Kim <minchan@...nel.org>,
Zhaoyang Huang <zhaoyang.huang@...soc.com>,
"open list:MEMORY MANAGEMENT" <linux-mm@...ck.org>,
LKML <linux-kernel@...r.kernel.org>, chunyan.zhang@...soc.com,
Baolin Wang <baolin.wang7@...il.com>
Subject: Re: [PATCH v2] mm : sync ra->ra_pages with bdi->ra_pages
On Fri, Aug 21, 2020 at 7:57 PM Matthew Wilcox <willy@...radead.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.
Powered by blists - more mailing lists