From: Matthew Wilcox <willy@infradead.org>
To: Zhaoyang Huang <huangzhaoyang@gmail.com>
Cc: Roman Gushchin <klamm@yandex-team.ru>,
Andrew Morton <akpm@linux-foundation.org>,
Zhaoyang Huang <zhaoyang.huang@unisoc.com>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [RFC PATCH] mm : using bdi->ra_pages instead of ra->ra_pages within readahead
Date: Thu, 13 Aug 2020 12:19:24 +0100 [thread overview]
Message-ID: <20200813111924.GE17456@casper.infradead.org> (raw)
In-Reply-To: <1597306282-29927-1-git-send-email-zhaoyang.huang@unisoc.com>
On Thu, Aug 13, 2020 at 04:11:22PM +0800, Zhaoyang Huang wrote:
> file->f_ra->ra_pages will remain the initialized value since it opend, which may
> be NOT equal to bdi->ra_pages as the latter one is updated somehow(etc,
> echo xxx > /sys/block/dm/queue/read_ahead_kb).So having readahead use
> bdi->ra_pages.
But now it ignores the work done by shrink_readahead_size_eio()
and fadvise(POSIX_FADV_SEQUENTIAL). And you missed the use of ra_size
on the previous line, miscalculating ra->start.
> Signed-off-by: Zhaoyang Huang <zhaoyang.huang@unisoc.com>
> ---
> mm/filemap.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/mm/filemap.c b/mm/filemap.c
> index d78f577..259dcfd 100644
> --- a/mm/filemap.c
> +++ b/mm/filemap.c
> @@ -2499,8 +2499,8 @@ static struct file *do_sync_mmap_readahead(struct vm_fault *vmf)
> */
> fpin = maybe_unlock_mmap_for_io(vmf, fpin);
> ra->start = max_t(long, 0, offset - ra->ra_pages / 2);
> - ra->size = ra->ra_pages;
> - ra->async_size = ra->ra_pages / 4;
> + ra->size = inode_to_bdi(mapping->host)->ra_pages;
> + ra->async_size = ra->size / 4;
> ra_submit(ra, mapping, file);
> return fpin;
> }
> --
> 1.9.1
>
>
prev parent reply other threads:[~2020-08-13 11:19 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-13 8:11 Zhaoyang Huang
2020-08-13 11:19 ` Matthew Wilcox [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=20200813111924.GE17456@casper.infradead.org \
--to=willy@infradead.org \
--cc=akpm@linux-foundation.org \
--cc=huangzhaoyang@gmail.com \
--cc=klamm@yandex-team.ru \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.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