linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: "yukuai (C)" <yukuai3@huawei.com>
To: Matthew Wilcox <willy@infradead.org>
Cc: akpm <akpm@linux-foundation.org>,
	kent.overstreet <kent.overstreet@gmail.com>,
	axboe <axboe@kernel.dk>,
	linux-fsdevel <linux-fsdevel@vger.kernel.org>,
	linux-mm <linux-mm@kvack.org>,
	LKML <linux-kernel@vger.kernel.org>,
	"zhangyi (F)" <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 22:25:10 +0000	[thread overview]
Message-ID: <B6BF9BEC-E867-4BEF-930B-BA074D1B5893> (raw)
In-Reply-To: <YpkB1+PwIZ3AKUqg@casper.infradead.org>

[-- Attachment #1: Type: text/plain, Size: 2281 bytes --]


My apologize for the weird email format, I'm using my
cellphone to reply emails, and I'm not able to use my
PC now...


________________________________


发件人:Matthew Wilcox <willy@infradead.org>
收件人:yukuai (C) <yukuai3@huawei.com>
抄 送:akpm <akpm@linux-foundation.org>;kent.overstreet <kent.overstreet@gmail.com>;axboe <axboe@kernel.dk>;linux-fsdevel <linux-fsdevel@vger.kernel.org>;linux-mm <linux-mm@kvack.org>;LKML <linux-kernel@vger.kernel.org>;zhangyi (F) <yi.zhang@huawei.com>
时 间:2022-06-03 02:31:08
主 题:Re: [PATCH -next] mm/filemap: fix that first page is not mark accessed in filemap_read()

On Thu, Jun 02, 2022 at 04:21:29PM +0800, Yu Kuai wrote:
> In filemap_read(), 'ra->prev_pos' is set to 'iocb->ki_pos + copied',
> while it should be 'iocb->ki_ops'.

Can you walk me through your reasoning which leads you to believe that
it should be ki_pos instead of ki_pos + copied? As I understand it,
prev_pos is the end of the previous read, not the beginning of the
previous read.

For consequence,
> folio_mark_accessed() will not be called for 'fbatch.folios[0]' since
> 'iocb->ki_pos' is always equal to 'ra->prev_pos'.

I don't follow this, but maybe I'm just being slow.

-----------------------------------------------------------

Hi,

This is because we found that the behavior of small io sequential
read is different from v4.19 to v5.10.

At first, when mark_page_accessed() is called the second time,
the page will be moved to active list, thus when reading same file
the second time, performance will drop a little. However, in v5.10
we found that when reading the file by 4k, performance is always
good, and when reading by 1m, performance will drop at second
read like  v4.19.

The root cause is the following judgement:

ki_pos >> PAGE_SHIFT != pre_pos >> PAGE_SHIFT

The former should represent current page, while the latter should
represent previous page.

For example, ki_pos = 0, after reading page 0,  pre_pos will set to
4k. Thus in the next read of page 1, current page and previous
page will both be 1, and page 1 won't mark accessed.

Set pre_pos to the end of previous read is ok, however I think it
should be ki_pos + copied - 1.

Thanks,
Kuai


[-- Attachment #2: Type: text/html, Size: 6719 bytes --]

  reply	other threads:[~2022-06-02 22:25 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-02  8:21 Yu Kuai
2022-06-02 18:22 ` Andrew Morton
2022-06-06  1:11   ` Yu Kuai
2022-06-02 18:30 ` Matthew Wilcox
2022-06-02 22:25   ` yukuai (C) [this message]
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=B6BF9BEC-E867-4BEF-930B-BA074D1B5893 \
    --to=yukuai3@huawei.com \
    --cc=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 \
    /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