From: David Sterba <dsterba@suse.cz>
To: Ritesh Harjani <ritesh.list@gmail.com>
Cc: Kalesh Singh <kaleshsingh@google.com>,
lsf-pc@lists.linux-foundation.org,
"open list:MEMORY MANAGEMENT" <linux-mm@kvack.org>,
linux-fsdevel <linux-fsdevel@vger.kernel.org>,
Suren Baghdasaryan <surenb@google.com>,
David Hildenbrand <david@redhat.com>,
Lorenzo Stoakes <lorenzo.stoakes@oracle.com>,
"Liam R. Howlett" <Liam.Howlett@oracle.com>,
Juan Yescas <jyescas@google.com>,
android-mm <android-mm@google.com>,
Matthew Wilcox <willy@infradead.org>,
Vlastimil Babka <vbabka@suse.cz>, Michal Hocko <mhocko@suse.com>
Subject: Re: [LSF/MM/BPF TOPIC] Optimizing Page Cache Readahead Behavior
Date: Mon, 24 Feb 2025 13:56:27 +0100 [thread overview]
Message-ID: <20250224125627.GL5777@twin.jikos.cz> (raw)
In-Reply-To: <87wmdhgr5x.fsf@gmail.com>
On Sun, Feb 23, 2025 at 11:04:50AM +0530, Ritesh Harjani wrote:
> Kalesh Singh <kaleshsingh@google.com> writes:
>
> > Hi organizers of LSF/MM,
> >
> > I realize this is a late submission, but I was hoping there might
> > still be a chance to have this topic considered for discussion.
> >
> > Problem Statement
> > ===============
> >
> > Readahead can result in unnecessary page cache pollution for mapped
> > regions that are never accessed. Current mechanisms to disable
> > readahead lack granularity and rather operate at the file or VMA
>
> >From what I understand the readahead setting is done at the per-bdi
> level (default set to 128K). That means we don't get to control the
> amount of readahead pages needed on a per file basis. If say we can
> control the amount of readahead pages on a per open fd, will that solve
> the problem you are facing? That also means we don't need to change the
> setting for the entire system, but we can control this knob on a per fd
> basis?
>
> I just quickly hacked fcntl to allow setting no. of ra_pages in
> inode->i_ra_pages. Readahead algorithm then takes this setting whenever
> it initializes the readahead control in "file_ra_state_init()"
> So after one opens the file, we can set the fcntl F_SET_FILE_READAHEAD
> to the preferred value on the open fd.
>
>
> Note: I am not saying the implementation could be 100% correct. But it's
> just a quick working PoC to discuss whether this is the right approach
> to the given problem.
> @@ -678,6 +678,8 @@ struct inode {
> unsigned short i_bytes;
> u8 i_blkbits;
> enum rw_hint i_write_hint;
> + /* Per inode setting for max readahead in page_size units */
> + unsigned long i_ra_pages;
> blkcnt_t i_blocks;
If your final patch needs to store data in struct inode, please try to
optimize it so that the size does not change. There are at least 2 4
byte holes so if you're fine with a page size unit for readahead then
this should be sufficient.
next prev parent reply other threads:[~2025-02-24 12:56 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-21 21:13 Kalesh Singh
2025-02-22 18:03 ` Kent Overstreet
2025-02-23 5:36 ` Kalesh Singh
2025-02-23 5:42 ` Kalesh Singh
2025-02-23 9:30 ` Lorenzo Stoakes
2025-02-23 12:24 ` Matthew Wilcox
2025-02-23 5:34 ` Ritesh Harjani
2025-02-23 6:50 ` Kalesh Singh
2025-02-24 12:56 ` David Sterba [this message]
2025-02-24 14:14 ` [Lsf-pc] " Jan Kara
2025-02-24 14:21 ` Lorenzo Stoakes
2025-02-24 16:31 ` Jan Kara
2025-02-24 16:52 ` Lorenzo Stoakes
2025-02-24 21:36 ` Kalesh Singh
2025-02-24 21:55 ` Kalesh Singh
2025-02-24 23:56 ` Dave Chinner
2025-02-25 6:45 ` Kalesh Singh
2025-02-27 22:12 ` Matthew Wilcox
2025-02-28 1:12 ` Dave Chinner
2025-02-28 9:07 ` David Hildenbrand
2025-04-02 0:13 ` Kalesh Singh
2025-02-25 5:44 ` Lorenzo Stoakes
2025-02-25 6:59 ` Kalesh Singh
2025-02-25 16:36 ` Jan Kara
2025-02-26 0:49 ` Kalesh Singh
2025-02-25 16:21 ` Jan Kara
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=20250224125627.GL5777@twin.jikos.cz \
--to=dsterba@suse.cz \
--cc=Liam.Howlett@oracle.com \
--cc=android-mm@google.com \
--cc=david@redhat.com \
--cc=jyescas@google.com \
--cc=kaleshsingh@google.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=lorenzo.stoakes@oracle.com \
--cc=lsf-pc@lists.linux-foundation.org \
--cc=mhocko@suse.com \
--cc=ritesh.list@gmail.com \
--cc=surenb@google.com \
--cc=vbabka@suse.cz \
--cc=willy@infradead.org \
/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