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@xxxxxxxxxxxxx>
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