linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Matthew Wilcox <willy@infradead.org>
To: "Darrick J. Wong" <djwong@kernel.org>
Cc: Hugh Dickins <hughd@google.com>,
	Lukas Czerner <lczerner@redhat.com>,
	Mikulas Patocka <mpatocka@redhat.com>,
	Zdenek Kabelac <zkabelac@redhat.com>,
	linux-mm@kvack.org, linux-fsdevel@vger.kernel.org
Subject: Re: unusual behavior of loop dev with backing file in tmpfs
Date: Wed, 12 Jan 2022 17:46:23 +0000	[thread overview]
Message-ID: <Yd8T7xbV+2zEqJA8@casper.infradead.org> (raw)
In-Reply-To: <20220112171937.GA19154@magnolia>

On Wed, Jan 12, 2022 at 09:19:37AM -0800, Darrick J. Wong wrote:
> I for one wouldn't mind if tmpfs no longer instantiated cache pages for
> a read from a hole -- it's a little strange, since most disk filesystems
> (well ok xfs and ext4, haven't checked the others) don't do that.
> Anyone who really wants a preallocated page should probably be using
> fallocate or something...

We don't allocate disk blocks, but we do allocate pages.

filemap_read()
  filemap_get_pages()
    page_cache_sync_readahead()
      page_cache_sync_ra()
        ondemand_readahead()
	  do_page_cache_ra()
	    page_cache_ra_unbounded()
	      __page_cache_alloc()
	      add_to_page_cache_lru()

At this point, we haven't called into the filesystem, so we don't
know that we're allocating pages for a hole.

Although tmpfs doesn't take this path; it has its own
shmem_file_read_iter() instead of calling filemap_read().  I do rather
regret that because it means that tmpfs doesn't take advantage of
readahead, which means that swapping back _in_ is rather slow.

It's on my list of things to look at ... eventually.


      reply	other threads:[~2022-01-12 17:46 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-26  7:51 unusual behavior of loop dev with backing file in tmpfs Lukas Czerner
2022-01-12  4:28 ` Hugh Dickins
2022-01-12 12:29   ` Mikulas Patocka
2022-01-12 17:19   ` Darrick J. Wong
2022-01-12 17:46     ` Matthew Wilcox [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=Yd8T7xbV+2zEqJA8@casper.infradead.org \
    --to=willy@infradead.org \
    --cc=djwong@kernel.org \
    --cc=hughd@google.com \
    --cc=lczerner@redhat.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --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).