All of lore.kernel.org
 help / color / mirror / Atom feed
From: Matthew Wilcox <willy@infradead.org>
To: Tal Zussman <tz2294@columbia.edu>
Cc: Jan Kara <jack@suse.cz>,
	Andrew Morton <akpm@linux-foundation.org>,
	Jens Axboe <axboe@kernel.dk>,
	linux-fsdevel@vger.kernel.org, linux-mm@kvack.org,
	Tianyi Chen <hi@tychen.cc>
Subject: Re: [PATCH] mm/filemap: only drop dropbehind folios on uncached reads
Date: Fri, 20 Nov 2026 22:16:18 +0000	[thread overview]
Message-ID: <awDGsqkIaasAjaNB@casper.infradead.org> (raw)
In-Reply-To: <20261120-filemap-dropbehind-read-v1-1-a373ac3fd993@columbia.edu>

On Fri, Nov 20, 2026 at 02:51:17PM -0500, Tal Zussman wrote:
> An RWF_DONTCACHE read marks the folios it brings into the page cache as
> dropbehind, and filemap_read() drops them from the page cache once it
> has copied from them. Readahead can bring in folios past the end of the
> read, and those stay in the page cache with the flag set.

I like your patch, but now I'm wondering whether RWF_DONTCACHE should
trigger readahead.  Yes, I'm sure we want to use the ->readahead entry
point for filesystems, but I think that an uncached read should not
bring in pages that weren't specifically requested.

Something like this, maybe?

+++ b/mm/readahead.c
@@ -590,7 +590,7 @@ void page_cache_sync_ra(struct readahead_control *ractl,
         * readahead will do the right thing and limit the read to just the
         * requested range, which we'll set to 1 page for this case.
         */
-       if (!ra->ra_pages || blk_cgroup_congested()) {
+       if (!ra->ra_pages || blk_cgroup_congested() || ractl->dropbehind) {
                if (!ractl->file)
                        return;
                req_count = 1;



  reply	other threads:[~2026-11-20 22:16 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-20 19:51 [PATCH] mm/filemap: only drop dropbehind folios on uncached reads Tal Zussman
2026-11-20 22:16 ` Matthew Wilcox [this message]
2026-11-24 21:33   ` Tal Zussman
2026-11-21 19:51 ` sashiko-bot

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=awDGsqkIaasAjaNB@casper.infradead.org \
    --to=willy@infradead.org \
    --cc=akpm@linux-foundation.org \
    --cc=axboe@kernel.dk \
    --cc=hi@tychen.cc \
    --cc=jack@suse.cz \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=tz2294@columbia.edu \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.