linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Hildenbrand <david@redhat.com>
To: Matthew Wilcox <willy@infradead.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	linux-mm@kvack.org, linux-fsdevel@vger.kernel.org,
	Pankaj Raghav <p.raghav@samsung.com>
Subject: Re: [PATCH] mm: Convert pagecache_isize_extended to use a folio
Date: Tue, 9 Apr 2024 16:27:21 +0200	[thread overview]
Message-ID: <f11aa368-b7d6-4828-8791-c89be74cbc56@redhat.com> (raw)
In-Reply-To: <ZhVMJF6fICFVO6Lc@casper.infradead.org>

On 09.04.24 16:09, Matthew Wilcox wrote:
> On Tue, Apr 09, 2024 at 03:39:35PM +0200, David Hildenbrand wrote:
>> On 05.04.24 20:00, Matthew Wilcox (Oracle) wrote:
>>> + * Handle extension of inode size either caused by extending truncate or
>>> + * by write starting after current i_size.  We mark the page straddling
>>> + * current i_size RO so that page_mkwrite() is called on the first
>>> + * write access to the page.  The filesystem will update its per-block
>>> + * information before user writes to the page via mmap after the i_size
>>> + * has been changed.
>>
>> Did you intend not to s/page/folio/ ?
> 
> I did!  I think here we're talking about page faults, and we can control
> the RO property on a per-PTE (ie per-page) basis.  Do you think it'd be
> clearer if we talked about folios here? 

Good point! It might have been clearer to me if that paragraph would 
talk about PTEs mapping folio pages, whereby the relevant PTEs are R/O 
such that we will catch first write access to these folio pages.

But re-reading it now, it's clearer to me taht the focus is on per-page 
handling. (although it might boil down to per-folio tracking in some 
cases, staring at filemap_page_mkwrite()).

> We're in a bit of an interesting
> spot because filesystems generally don't have folios which overhang the
> end of the file by more than a page.  It can happen if truncate fails
> to split a folio.

Right. I remember FALLOCATE_PUNCHOLE is in a similar position if 
splitting fails (cannot free up memory but have to zero it out IIRC).

-- 
Cheers,

David / dhildenb


      reply	other threads:[~2024-04-09 14:27 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-05 18:00 [PATCH] mm: Convert pagecache_isize_extended to use a folio Matthew Wilcox (Oracle)
2024-04-09 13:39 ` David Hildenbrand
2024-04-09 14:09   ` Matthew Wilcox
2024-04-09 14:27     ` David Hildenbrand [this message]

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=f11aa368-b7d6-4828-8791-c89be74cbc56@redhat.com \
    --to=david@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=p.raghav@samsung.com \
    --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;
as well as URLs for NNTP newsgroup(s).