From: Andrew Morton <akpm@linux-foundation.org>
To: Yu Kuai <yukuai3@huawei.com>
Cc: <willy@infradead.org>, <kent.overstreet@gmail.com>,
<axboe@kernel.dk>, <linux-fsdevel@vger.kernel.org>,
<linux-mm@kvack.org>, <linux-kernel@vger.kernel.org>,
<yi.zhang@huawei.com>
Subject: Re: [PATCH -next] mm/filemap: fix that first page is not mark accessed in filemap_read()
Date: Thu, 2 Jun 2022 11:22:48 -0700 [thread overview]
Message-ID: <20220602112248.1e3cd871a87fe9df1ca13f08@linux-foundation.org> (raw)
In-Reply-To: <20220602082129.2805890-1-yukuai3@huawei.com>
On Thu, 2 Jun 2022 16:21:29 +0800 Yu Kuai <yukuai3@huawei.com> wrote:
> In filemap_read(), 'ra->prev_pos' is set to 'iocb->ki_pos + copied',
> while it should be 'iocb->ki_ops'. For consequence,
> folio_mark_accessed() will not be called for 'fbatch.folios[0]' since
> 'iocb->ki_pos' is always equal to 'ra->prev_pos'.
>
> ...
>
> --- a/mm/filemap.c
> +++ b/mm/filemap.c
> @@ -2728,10 +2728,11 @@ ssize_t filemap_read(struct kiocb *iocb, struct iov_iter *iter,
> flush_dcache_folio(folio);
>
> copied = copy_folio_to_iter(folio, offset, bytes, iter);
> -
> - already_read += copied;
> - iocb->ki_pos += copied;
> - ra->prev_pos = iocb->ki_pos;
> + if (copied) {
> + ra->prev_pos = iocb->ki_pos;
> + already_read += copied;
> + iocb->ki_pos += copied;
> + }
>
> if (copied < bytes) {
> error = -EFAULT;
It seems tidier, but does it matter? If copied==0 we're going to break
out and return -EFAULT anyway?
next prev parent reply other threads:[~2022-06-02 18:22 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-02 8:21 [PATCH -next] mm/filemap: fix that first page is not mark accessed in filemap_read() Yu Kuai
2022-06-02 18:22 ` Andrew Morton [this message]
2022-06-06 1:11 ` Yu Kuai
2022-06-02 18:30 ` Matthew Wilcox
2022-06-02 22:25 ` yukuai (C)
2022-06-06 1:10 ` Yu Kuai
2022-06-10 14:34 ` Matthew Wilcox
2022-06-10 14:36 ` Matthew Wilcox
2022-06-10 17:23 ` Kent Overstreet
2022-06-10 17:47 ` Kent Overstreet
2022-06-10 18:34 ` Matthew Wilcox
2022-06-10 18:48 ` Kent Overstreet
2022-06-11 8:23 ` Yu Kuai
2022-06-11 17:42 ` Matthew Wilcox
2022-06-13 1:31 ` Yu Kuai
2022-06-09 0:59 ` Yu Kuai
2022-06-15 8:36 ` [mm/filemap] 8b157c14b5: phoronix-test-suite.fio.SequentialRead.LinuxAIO.Yes.Yes.4KB.DefaultTestDirectory.mb_s -8.1% regression kernel test robot
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=20220602112248.1e3cd871a87fe9df1ca13f08@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=axboe@kernel.dk \
--cc=kent.overstreet@gmail.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=willy@infradead.org \
--cc=yi.zhang@huawei.com \
--cc=yukuai3@huawei.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).