linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: David Howells <dhowells@redhat.com>
To: Matthew Wilcox <willy@infradead.org>
Cc: dhowells@redhat.com, Chris Mason <clm@fb.com>,
	linux-fsdevel@vger.kernel.org, linux-mm@kvack.org,
	Guoqing Jiang <guoqing.jiang@cloud.ionos.com>,
	Miaohe Lin <linmiaohe@huawei.com>
Subject: Re: PagePrivate handling
Date: Wed, 14 Oct 2020 17:05:11 +0100	[thread overview]
Message-ID: <668211.1602691511@warthog.procyon.org.uk> (raw)
In-Reply-To: <20201014153836.GM20115@casper.infradead.org>

Matthew Wilcox <willy@infradead.org> wrote:

> It's not great, but with David wanting to change how PageFsCache is used,
> it may be unavoidable (I'm not sure if he's discussed that with you yet)
> https://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs.git/commit/?h=fscache-iter&id=6f10fd7766ed6d87c3f696bb7931281557b389f5 shows part of it
> -- essentially he wants to make PagePrivate2 mean that I/O is currently
> ongoing to an fscache, and so truncate needs to wait on it being finished.

->invalidatepage() and ->releasepage() had to wait anyway.

PG_fscache used to mean that the cache might have some knowledge of the page
and it might have I/O in progress on it - entirely as and when the cache felt
like doing it.

Now it just means that there's write I/O in progress on it at the netfs's
behest (though it might be issued by a cache helper).  The main part of the
cache doesn't know about the page and doesn't care about the page flag, it
just sees an iov_iter.

In a sense, it's now a second PG_writeback flag.  A page can be being written
to two locations at the same time (the server and the cache).  Each write is
independent, though they may be started from the same place, and one of the
writes may be being handled by another filesystem entirely (the cache may have
started a DIO write to ext4, for example).

It's not needed for reading, since the PG_locked flag entirely suffices for
that.  The read helper doesn't do parallel reads from the server and the cache
to the same chunk of pagecache.

Willy has asked that I either make PG_writeback cover both cases or that
PG_fscache can only be set if PG_writeback is also set.  However, both of
these require extra state to be attached to page->private to be able to
coordinate this as there may be (as mentioned above) two parallel writes from
the same data that may finish at different times.

David



      parent reply	other threads:[~2020-10-14 16:05 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-14 13:49 Matthew Wilcox
2020-10-14 14:50 ` Chris Mason
2020-10-14 15:38   ` Matthew Wilcox
2020-10-14 16:01     ` Gao Xiang
2020-10-14 16:28     ` Chris Mason
2020-10-14 16:34     ` Yang Shi
2020-10-14 16:05   ` David Howells [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=668211.1602691511@warthog.procyon.org.uk \
    --to=dhowells@redhat.com \
    --cc=clm@fb.com \
    --cc=guoqing.jiang@cloud.ionos.com \
    --cc=linmiaohe@huawei.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --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