From: Matthew Wilcox <willy@infradead.org>
To: Phillip Lougher <phillip@squashfs.org.uk>
Cc: Hsin-Yi Wang <hsinyi@chromium.org>,
Xiongwei Song <sxwjean@gmail.com>,
Zheng Liang <zhengliang6@huawei.com>,
Zhang Yi <yi.zhang@huawei.com>, Hou Tao <houtao1@huawei.com>,
Miao Xie <miaoxie@huawei.com>,
Andrew Morton <akpm@linux-foundation.org>,
Linus Torvalds <torvalds@linux-foundation.org>,
"Song, Xiongwei" <Xiongwei.Song@windriver.com>,
"linux-mm@kvack.org" <linux-mm@kvack.org>,
"squashfs-devel@lists.sourceforge.net"
<squashfs-devel@lists.sourceforge.net>
Subject: Re: squashfs performance regression and readahea
Date: Fri, 13 May 2022 14:09:30 +0100 [thread overview]
Message-ID: <Yn5Yij9pRPCzDozt@casper.infradead.org> (raw)
In-Reply-To: <1f8a8009-1c05-d55c-08bd-89c5916e5240@squashfs.org.uk>
On Fri, May 13, 2022 at 06:33:21AM +0100, Phillip Lougher wrote:
> Looking at the new patch, I have a couple of questions which is worth
> clarifying to have a fuller understanding of the readahead behaviour.
> In otherwords I'm deducing the behaviour of the readahead calls
> from context, and I want to make sure they're doing what I think
> they're doing.
I did write quite a lot of documentation as part of the readahead
revision, and filesystem authors are the target audience, so this is
somewhat disheartening to read. What could I have done better to make
the readahead documentation obvious for you to find?
> + nr_pages = min(readahead_count(ractl), max_pages);
>
> As I understand it, this will always produce nr_pages which will
> cover the entirety of the block to be decompressed? That is if
> a block is block_size, it will return the number of pages necessary
> to decompress the entire block? It will never return less than the
> necessary pages, i.e. if the block_size was 128K, it will never
> return less than 32 pages?
readahead_count() returns the number of pages that the page cache is
asking the filesystem for. It may be any number from 1 to whatever
the current readahead window is. It's possible to ask the page
cache to expand the readahead request to be aligned to a decompression
boundary, but that may not be possible. For example, we may be in a
situation where we read pages 32-63 from the file previously, then
the page cache chose to discard pages 33, 35, 37, .., 63 under memory
pressure, and now the file is being re-read. This isn't a likely
usage pattern, of course, but it's a situation we have to cope with.
> + nr_pages = __readahead_batch(ractl, pages, max_pages)
>
> My understanding is that this call will fully populate the
> pages array with page references without any holes. That
> is none of the pages array entries will be NULL, meaning
> there isn't a page for that entry. In other words, if the
> pages array has 32 pages, each of the 32 entries will
> reference a page.
That is correct, a readahead request is always for a contiguous range of
the file. The pages are allocated before calling ->readahead, so
there's no opportunity for failure; they exist and they're already in
the page cache, waiting for the FS to tell the pagecache that they're
uptodate and unlock them.
next prev parent reply other threads:[~2022-05-13 13:09 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-08 14:46 Song, Xiongwei
2022-05-08 16:44 ` Matthew Wilcox
2022-05-09 7:05 ` Hsin-Yi Wang
2022-05-09 7:10 ` Hsin-Yi Wang
2022-05-09 9:42 ` Song, Xiongwei
2022-05-09 12:43 ` Xiongwei Song
2022-05-09 13:21 ` Matthew Wilcox
2022-05-09 14:29 ` Hsin-Yi Wang
2022-05-10 12:30 ` Xiongwei Song
2022-05-10 12:47 ` Hsin-Yi Wang
2022-05-10 13:18 ` Xiongwei Song
2022-05-11 15:12 ` Hsin-Yi Wang
2022-05-11 19:13 ` Phillip Lougher
2022-05-12 6:23 ` Hsin-Yi Wang
2022-05-13 5:33 ` Phillip Lougher
2022-05-13 6:35 ` Hsin-Yi Wang
2022-05-15 0:54 ` Phillip Lougher
2022-05-16 8:23 ` Hsin-Yi Wang
2022-05-16 9:00 ` Xiongwei Song
2022-05-16 9:10 ` Hsin-Yi Wang
2022-05-16 9:34 ` Xiongwei Song
2022-05-16 11:01 ` Hsin-Yi Wang
2022-05-13 13:09 ` Matthew Wilcox [this message]
2022-05-15 0:05 ` Phillip Lougher
2022-05-13 12:16 ` Xiongwei Song
2022-05-13 12:29 ` Xiongwei Song
2022-05-13 16:43 ` Hsin-Yi Wang
2022-05-13 18:12 ` Matthew Wilcox
2022-05-13 23:12 ` Xiongwei Song
2022-05-14 11:51 ` Hsin-Yi Wang
2022-05-10 1:11 ` Phillip Lougher
2022-05-10 2:35 ` Matthew Wilcox
2022-05-10 3:20 ` Phillip Lougher
2022-05-10 3:41 ` Phillip Lougher
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=Yn5Yij9pRPCzDozt@casper.infradead.org \
--to=willy@infradead.org \
--cc=Xiongwei.Song@windriver.com \
--cc=akpm@linux-foundation.org \
--cc=houtao1@huawei.com \
--cc=hsinyi@chromium.org \
--cc=linux-mm@kvack.org \
--cc=miaoxie@huawei.com \
--cc=phillip@squashfs.org.uk \
--cc=squashfs-devel@lists.sourceforge.net \
--cc=sxwjean@gmail.com \
--cc=torvalds@linux-foundation.org \
--cc=yi.zhang@huawei.com \
--cc=zhengliang6@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