linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: Hugh Dickins <hughd@google.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Mikulas Patocka <mpatocka@redhat.com>,
	Zdenek Kabelac <zkabelac@redhat.com>,
	Lukas Czerner <lczerner@redhat.com>,
	"Darrick J. Wong" <djwong@kernel.org>,
	Miklos Szeredi <miklos@szeredi.hu>,
	Christoph Hellwig <hch@lst.de>, Borislav Petkov <bp@suse.de>,
	linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-mm@kvack.org
Subject: Re: [PATCH mmotm] tmpfs: do not allocate pages on read
Date: Sun, 6 Mar 2022 10:27:09 +0100	[thread overview]
Message-ID: <20220306092709.GA22883@lst.de> (raw)
In-Reply-To: <f9c2f38f-5eb8-5d30-40fa-93e88b5fbc51@google.com>

On Fri, Mar 04, 2022 at 09:09:01PM -0800, Hugh Dickins wrote:
> It's not quite as simple as just removing the test (as Mikulas did):
> xfstests generic/013 hung because splice from tmpfs failed on page not
> up-to-date and page mapping unset.  That can be fixed just by marking
> the ZERO_PAGE as Uptodate, which of course it is; doing so here in
> shmem_file_read_iter() is distasteful, but seems to be the best way.

Shouldn't we set ZERO_PAGE uptodate during early init code as it, uh,
is per definition uptodate all the time?

> 
> My intention, though, was to stop using the ZERO_PAGE here altogether:
> surely iov_iter_zero() is better for this case?  Sadly not: it relies
> on clear_user(), and the x86 clear_user() is slower than its copy_user():
> https://lore.kernel.org/lkml/2f5ca5e4-e250-a41c-11fb-a7f4ebc7e1c9@google.com/

Oh, that's sad as just using clear_user would be the right thing to
here.

> But while we are still using the ZERO_PAGE, let's stop dirtying its
> struct page cacheline with unnecessary get_page() and put_page().
> 
> Reported-by: Mikulas Patocka <mpatocka@redhat.com>
> Reported-by: Lukas Czerner <lczerner@redhat.com>
> Signed-off-by: Hugh Dickins <hughd@google.com>

But except for maybe making sure that ZERO_PAGE is always marked
uptodate this does looks good to me.

  reply	other threads:[~2022-03-06  9:27 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-05  5:09 [PATCH mmotm] tmpfs: do not allocate pages on read Hugh Dickins
2022-03-06  9:27 ` Christoph Hellwig [this message]
2022-03-06 22:56   ` Hugh Dickins
2022-03-06 22:59   ` [PATCH mmotm v2] " Hugh Dickins
2022-03-07  6:44     ` Christoph Hellwig
2022-03-08 17:27       ` Darrick J. Wong
2022-03-08 21:46         ` Hugh Dickins

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=20220306092709.GA22883@lst.de \
    --to=hch@lst.de \
    --cc=akpm@linux-foundation.org \
    --cc=bp@suse.de \
    --cc=djwong@kernel.org \
    --cc=hughd@google.com \
    --cc=lczerner@redhat.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=miklos@szeredi.hu \
    --cc=mpatocka@redhat.com \
    --cc=zkabelac@redhat.com \
    /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).