All of lore.kernel.org
 help / color / mirror / Atom feed
From: Matthew Wilcox <willy@infradead.org>
To: David Howells <dhowells@redhat.com>
Cc: dwysocha@redhat.com, Rohith Surabattula <rohiths.msft@gmail.com>,
	Steve French <sfrench@samba.org>,
	Shyam Prasad N <nspmangalore@gmail.com>,
	Dominique Martinet <asmadeus@codewreck.org>,
	Ilya Dryomov <idryomov@gmail.com>,
	linux-cachefs@redhat.com, linux-cifs@vger.kernel.org,
	linux-afs@lists.infradead.org,
	v9fs-developer@lists.sourceforge.net, ceph-devel@vger.kernel.org,
	linux-nfs@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [RFC PATCH v2] mm, netfs, fscache: Stop read optimisation when folio removed from pagecache
Date: Tue, 15 Nov 2022 04:09:06 +0000	[thread overview]
Message-ID: <Y3MQ4l1AJOgniprT@casper.infradead.org> (raw)
In-Reply-To: <166844174069.1124521.10890506360974169994.stgit@warthog.procyon.org.uk>

On Mon, Nov 14, 2022 at 04:02:20PM +0000, David Howells wrote:
> +++ b/mm/filemap.c
> @@ -3941,6 +3941,10 @@ bool filemap_release_folio(struct folio *folio, gfp_t gfp)
>  	struct address_space * const mapping = folio->mapping;
>  
>  	BUG_ON(!folio_test_locked(folio));
> +	if ((!mapping || !mapping_release_always(mapping))
> +	    && !folio_test_private(folio) &&
> +	    !folio_test_private_2(folio))
> +		return true;

Why do you need to test 'mapping' here?  Also this is the most
inconsistent style ...

	if ((!mapping || !mapping_release_always(mapping)) &&
	    !folio_test_private(folio) && !folio_test_private_2(folio))

works fine, but if you insist on splitting over three lines, then:

	if ((!mapping || !mapping_release_always(mapping)) &&
	    !folio_test_private(folio) && 
	    !folio_test_private_2(folio))

> @@ -276,7 +275,7 @@ static long mapping_evict_folio(struct address_space *mapping,
>  	if (folio_ref_count(folio) >
>  			folio_nr_pages(folio) + folio_has_private(folio) + 1)

I think this line is incorrect, right?  You don't increment the folio
refcount just because the folio has private2 set, do you?

>  		return 0;
> -	if (folio_has_private(folio) && !filemap_release_folio(folio, 0))
> +	if (!filemap_release_folio(folio, 0))
>  		return 0;
>  
>  	return remove_mapping(mapping, folio);

Can we get rid of folio_has_private() / page_has_private() now?

  parent reply	other threads:[~2022-11-15  4:09 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-14 16:02 [RFC PATCH v2] mm, netfs, fscache: Stop read optimisation when folio removed from pagecache David Howells
2022-11-15  0:22 ` Dominique Martinet
2022-11-15  0:41 ` David Howells
2022-11-15  2:34   ` Dominique Martinet
2022-11-15  4:09 ` Matthew Wilcox [this message]
2022-11-15  9:40 ` David Howells

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=Y3MQ4l1AJOgniprT@casper.infradead.org \
    --to=willy@infradead.org \
    --cc=asmadeus@codewreck.org \
    --cc=ceph-devel@vger.kernel.org \
    --cc=dhowells@redhat.com \
    --cc=dwysocha@redhat.com \
    --cc=idryomov@gmail.com \
    --cc=linux-afs@lists.infradead.org \
    --cc=linux-cachefs@redhat.com \
    --cc=linux-cifs@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=nspmangalore@gmail.com \
    --cc=rohiths.msft@gmail.com \
    --cc=sfrench@samba.org \
    --cc=v9fs-developer@lists.sourceforge.net \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.