linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Jan Kara <jack@suse.cz>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Jan Kara <jack@suse.cz>,
	linux-mm@kvack.org, linux-fsdevel@vger.kernel.org,
	Lorenzo Stoakes <lstoakes@gmail.com>,
	Christoph Hellwig <hch@infradead.org>,
	David Hildenbrand <david@redhat.com>
Subject: Re: [PATCH] mm: Do not reclaim private data from pinned page
Date: Wed, 3 May 2023 11:51:54 +0200	[thread overview]
Message-ID: <20230503095154.syth4jorsdu55ko4@quack3> (raw)
In-Reply-To: <20230502132020.5a720158307c11d5b8efe1d9@linux-foundation.org>

On Tue 02-05-23 13:20:20, Andrew Morton wrote:
> On Fri, 28 Apr 2023 14:41:40 +0200 Jan Kara <jack@suse.cz> wrote:
> 
> > If the page is pinned, there's no point in trying to reclaim it.
> > Furthermore if the page is from the page cache we don't want to reclaim
> > fs-private data from the page because the pinning process may be writing
> > to the page at any time and reclaiming fs private info on a dirty page
> > can upset the filesystem (see link below).
> 
> Obviously I'll add a cc:stable here.  I'm suspecting it's so old that
> there's no real Fixes: target that makes sense?

In principle the problem is there ever since MM started to track dirty
shared pages and filesystems started to use .page_mkwrite callbacks. So
for very long, yes. That being said the fix makes sense only since we've
added page pinning infrastructure and started using it in various places
which is not that long ago (in 2020, first patches in this direction have
been merged to 5.7). So we could mark it for stable with 5.7+.

> > --- a/mm/vmscan.c
> > +++ b/mm/vmscan.c
> > @@ -1901,6 +1901,16 @@ static unsigned int shrink_folio_list(struct list_head *folio_list,
> >  			}
> >  		}
> >  
> > +		/*
> > +		 * Folio is unmapped now so it cannot be newly pinned anymore.
> > +		 * No point in trying to reclaim folio if it is pinned.
> > +		 * Furthermore we don't want to reclaim underlying fs metadata
> > +		 * if the folio is pinned and thus potentially modified by the
> > +		 * pinning process as that may upset the filesystem.
> > +		 */
> > +		if (folio_maybe_dma_pinned(folio))
> > +			goto activate_locked;
> > +
> 
> So I expect the -stable maintainers will be looking for a pre-folios
> version of this when the time comes.

Yeah, right. Luckily that's going to be pretty easy :).

								Honza
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR


      reply	other threads:[~2023-05-03  9:51 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-28 12:41 Jan Kara
2023-04-28 12:58 ` Matthew Wilcox
2023-04-28 13:05 ` Lorenzo Stoakes
2023-04-29  4:50 ` Christoph Hellwig
2023-05-01 18:12 ` John Hubbard
2023-05-02 14:45 ` David Hildenbrand
2023-05-02 15:26 ` Peter Xu
2023-05-02 15:33   ` David Hildenbrand
2023-05-02 15:48     ` Peter Xu
2023-05-02 15:53       ` David Hildenbrand
2023-05-02 20:20 ` Andrew Morton
2023-05-03  9:51   ` Jan Kara [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=20230503095154.syth4jorsdu55ko4@quack3 \
    --to=jack@suse.cz \
    --cc=akpm@linux-foundation.org \
    --cc=david@redhat.com \
    --cc=hch@infradead.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=lstoakes@gmail.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