From: David Hildenbrand <david@redhat.com>
To: Matthew Wilcox <willy@infradead.org>
Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org,
Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH v1] mm: remove total_mapcount()
Date: Thu, 22 Feb 2024 18:16:26 +0100 [thread overview]
Message-ID: <d11304b9-4e95-4f04-b652-43eb15aaa9d5@redhat.com> (raw)
In-Reply-To: <ZdeAys9D98RBaPL1@casper.infradead.org>
On 22.02.24 18:13, Matthew Wilcox wrote:
> On Thu, Feb 22, 2024 at 05:09:43PM +0100, David Hildenbrand wrote:
>> We always get a head page, so we can just naturally interpret is as a folio
>> (similar to other code).
>
> memfd seems rather confused about how to iterate over the page cache.
> Perhaps we could sort that out and then delete total_mapcount as a
> second patch?
>
> I haven't tested this at all, but ...
>
> Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
>
> diff --git a/mm/memfd.c b/mm/memfd.c
> index d3a1ba4208c9..45e55b0e3cbe 100644
> --- a/mm/memfd.c
> +++ b/mm/memfd.c
> @@ -29,28 +29,29 @@
> #define MEMFD_TAG_PINNED PAGECACHE_TAG_TOWRITE
> #define LAST_SCAN 4 /* about 150ms max */
>
> +static bool memfd_extra_refs(struct folio *folio)
> +{
> + return folio_ref_count(folio) - folio_mapcount(folio) !=
> + folio_nr_pages(folio);
> +}
That is an obvious improvement I should have realized myself.
Let me play with that.
Thanks!
--
Cheers,
David / dhildenb
prev parent reply other threads:[~2024-02-22 17:16 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-22 16:09 [PATCH v1] mm: remove total_mapcount() David Hildenbrand
2024-02-22 17:13 ` Matthew Wilcox
2024-02-22 17:16 ` David Hildenbrand [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=d11304b9-4e95-4f04-b652-43eb15aaa9d5@redhat.com \
--to=david@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=willy@infradead.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