mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Matthew Wilcox <willy@infradead.org>
To: Carol L Soto <csoto@nvidia.com>
Cc: jack@suse.cz, akpm@linux-foundation.org,
	linux-fsdevel@vger.kernel.org, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org, John Hubbard <jhubbard@nvidia.com>
Subject: Re: [PATCH v2] mm/filemap: bring a folio uptodate if all blocks below EOF are uptodate
Date: Thu, 3 Dec 2026 16:59:01 +0000	[thread overview]
Message-ID: <axGf1SvDeY8TGboC@casper.infradead.org> (raw)
In-Reply-To: <20261201212140.1168851-1-csoto@nvidia.com>

On Tue, Dec 01, 2026 at 01:21:40PM -0800, Carol L Soto wrote:
> When a filesystem block is smaller than a folio, a write that ends
> before the last block of a new folio leaves the folio partially
> uptodate. The write marks its own blocks uptodate and leaves PG_uptodate
> clear. With 64 KiB pages and 4 KiB blocks, a 1280-byte write to a new
> file is such a write.

Thanks, Carol.  This is a really interesting corner case, and it's a
legitimate performance prblem that's worth fixing.

I don't like the particular solution you've chosen, partly because I don't
like spreading the 'may_read' information into the helper, but also because
callers that set one of these flags are supposed to have a fallback.  eg,
io_uring will use a helper thread to do the read_folio() call.  So if
nginx switches to use io_uring, it's going to see the same contention
on the folio lock because it'll always take the partially uptodate path.

A solutioon that might be worth investigating is marking the folio uptodate
in write_begin for the special case of an extending write.  We'll need to
make sure we always zero the post-EOF tail of a page before it's mmaped,
but we already do some of that to handle shared mmap writes beyond EOF.


  parent reply	other threads:[~2026-12-03 16:59 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-01 21:21 Carol L Soto
2026-12-02 12:09 ` Jan Kara
2026-12-03 19:46   ` Carol Soto
2026-12-03 16:59 ` Matthew Wilcox [this message]
  -- strict thread matches above, loose matches on Subject: below --
2026-11-30 18:17 [PATCH] " Carol L Soto
2026-12-01 16:43 ` [PATCH v2] " Carol L Soto
2026-12-01 20:41   ` John Hubbard
2026-12-01 21:21     ` Carol Soto

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=axGf1SvDeY8TGboC@casper.infradead.org \
    --to=willy@infradead.org \
    --cc=akpm@linux-foundation.org \
    --cc=csoto@nvidia.com \
    --cc=jack@suse.cz \
    --cc=jhubbard@nvidia.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.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

all inboxes | Powered by JetHome®