linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Matthew Wilcox <willy@infradead.org>
To: Alistair Popple <apopple@nvidia.com>
Cc: akpm@linux-foundation.org, linux-mm@kvack.org, jack@suse.cz,
	david@fromorbit.com, jhubbard@nvidia.com
Subject: Re: [PATCH] mm: Fix serialization adding transparent huge pages to page cache
Date: Mon, 20 Jun 2022 14:56:39 +0100	[thread overview]
Message-ID: <YrB8l9KfeUgvHtUU@casper.infradead.org> (raw)
In-Reply-To: <20220620090536.1474002-1-apopple@nvidia.com>

On Mon, Jun 20, 2022 at 07:05:36PM +1000, Alistair Popple wrote:
> Commit 793917d997df ("mm/readahead: Add large folio readahead")
> introduced support for using large folios for filebacked pages if the
> filesystem supports it.
> 
> page_cache_ra_order() was introduced to allocate and add these large
> folios to the page cache. However adding pages to the page cache should
> be serialized against truncation and hole punching by taking
> invalidate_lock. Not doing so can lead to data races resulting in stale
> data getting added to the page cache and marked up-to-date. See commit
> 730633f0b7f9 ("mm: Protect operations adding pages to page cache with
> invalidate_lock") for more details.
> 
> This issue was found by inspection but a testcase revealed it was
> possible to observe in practice on XFS. Fix this by taking
> invalidate_lock in page_cache_ra_order(), to mirror what is done for the
> non-thp case in page_cache_ra_unbounded().

Thanks, added to pagecache:for-next and I'll be including it as part of
the pull request for -rc4.


      parent reply	other threads:[~2022-06-20 13:56 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-20  9:05 Alistair Popple
2022-06-20  9:57 ` Jan Kara
2022-06-20 13:56 ` 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=YrB8l9KfeUgvHtUU@casper.infradead.org \
    --to=willy@infradead.org \
    --cc=akpm@linux-foundation.org \
    --cc=apopple@nvidia.com \
    --cc=david@fromorbit.com \
    --cc=jack@suse.cz \
    --cc=jhubbard@nvidia.com \
    --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