From: "Matthew Wilcox (Oracle)" <willy@infradead.org>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: "Matthew Wilcox (Oracle)" <willy@infradead.org>,
linux-mm@kvack.org, David Hildenbrand <david@redhat.com>,
William Kucharski <william.kucharski@oracle.com>,
Miaohe Lin <linmiaohe@huawei.com>,
Muchun Song <songmuchun@bytedance.com>
Subject: [PATCH v3 03/15] mm/page_alloc: Export free_frozen_pages() instead of free_unref_page()
Date: Mon, 25 Nov 2024 21:01:35 +0000 [thread overview]
Message-ID: <20241125210149.2976098-4-willy@infradead.org> (raw)
In-Reply-To: <20241125210149.2976098-1-willy@infradead.org>
We already have the concept of "frozen pages" (eg page_ref_freeze()),
so let's not complicate things by also having the concept of "unref
pages".
Reviewed-by: David Hildenbrand <david@redhat.com>
Reviewed-by: William Kucharski <william.kucharski@oracle.com>
Reviewed-by: Miaohe Lin <linmiaohe@huawei.com>
Reviewed-by: Muchun Song <songmuchun@bytedance.com>
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
mm/internal.h | 2 +-
mm/page_alloc.c | 18 +++++++++---------
mm/page_frag_cache.c | 6 +++---
mm/swap.c | 2 +-
4 files changed, 14 insertions(+), 14 deletions(-)
diff --git a/mm/internal.h b/mm/internal.h
index cb8d8e8e3ffa..ca400c70199c 100644
--- a/mm/internal.h
+++ b/mm/internal.h
@@ -741,7 +741,7 @@ extern bool free_pages_prepare(struct page *page, unsigned int order);
extern int user_min_free_kbytes;
-void free_unref_page(struct page *page, unsigned int order);
+void free_frozen_pages(struct page *page, unsigned int order);
void free_unref_folios(struct folio_batch *fbatch);
extern void zone_pcp_reset(struct zone *zone);
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index c40a0c29a89c..adac485e3254 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -2626,9 +2626,9 @@ static int nr_pcp_high(struct per_cpu_pages *pcp, struct zone *zone,
return high;
}
-static void free_unref_page_commit(struct zone *zone, struct per_cpu_pages *pcp,
- struct page *page, int migratetype,
- unsigned int order)
+static void free_frozen_page_commit(struct zone *zone,
+ struct per_cpu_pages *pcp, struct page *page, int migratetype,
+ unsigned int order)
{
int high, batch;
int pindex;
@@ -2677,7 +2677,7 @@ static void free_unref_page_commit(struct zone *zone, struct per_cpu_pages *pcp,
/*
* Free a pcp page
*/
-void free_unref_page(struct page *page, unsigned int order)
+void free_frozen_pages(struct page *page, unsigned int order)
{
unsigned long __maybe_unused UP_flags;
struct per_cpu_pages *pcp;
@@ -2713,7 +2713,7 @@ void free_unref_page(struct page *page, unsigned int order)
pcp_trylock_prepare(UP_flags);
pcp = pcp_spin_trylock(zone->per_cpu_pageset);
if (pcp) {
- free_unref_page_commit(zone, pcp, page, migratetype, order);
+ free_frozen_page_commit(zone, pcp, page, migratetype, order);
pcp_spin_unlock(pcp);
} else {
free_one_page(zone, page, pfn, order, FPI_NONE);
@@ -2777,7 +2777,7 @@ void free_unref_folios(struct folio_batch *folios)
/*
* Free isolated pages directly to the
- * allocator, see comment in free_unref_page.
+ * allocator, see comment in free_frozen_pages.
*/
if (is_migrate_isolate(migratetype)) {
free_one_page(zone, &folio->page, pfn,
@@ -2808,7 +2808,7 @@ void free_unref_folios(struct folio_batch *folios)
migratetype = MIGRATE_MOVABLE;
trace_mm_page_free_batched(&folio->page);
- free_unref_page_commit(zone, pcp, &folio->page, migratetype,
+ free_frozen_page_commit(zone, pcp, &folio->page, migratetype,
order);
}
@@ -4871,11 +4871,11 @@ void __free_pages(struct page *page, unsigned int order)
struct alloc_tag *tag = pgalloc_tag_get(page);
if (put_page_testzero(page))
- free_unref_page(page, order);
+ free_frozen_pages(page, order);
else if (!head) {
pgalloc_tag_sub_pages(tag, (1 << order) - 1);
while (order-- > 0)
- free_unref_page(page + (1 << order), order);
+ free_frozen_pages(page + (1 << order), order);
}
}
EXPORT_SYMBOL(__free_pages);
diff --git a/mm/page_frag_cache.c b/mm/page_frag_cache.c
index 3f7a203d35c6..d2423f30577e 100644
--- a/mm/page_frag_cache.c
+++ b/mm/page_frag_cache.c
@@ -86,7 +86,7 @@ void __page_frag_cache_drain(struct page *page, unsigned int count)
VM_BUG_ON_PAGE(page_ref_count(page) == 0, page);
if (page_ref_sub_and_test(page, count))
- free_unref_page(page, compound_order(page));
+ free_frozen_pages(page, compound_order(page));
}
EXPORT_SYMBOL(__page_frag_cache_drain);
@@ -138,7 +138,7 @@ void *__page_frag_alloc_align(struct page_frag_cache *nc,
goto refill;
if (unlikely(encoded_page_decode_pfmemalloc(encoded_page))) {
- free_unref_page(page,
+ free_frozen_pages(page,
encoded_page_decode_order(encoded_page));
goto refill;
}
@@ -166,6 +166,6 @@ void page_frag_free(void *addr)
struct page *page = virt_to_head_page(addr);
if (unlikely(put_page_testzero(page)))
- free_unref_page(page, compound_order(page));
+ free_frozen_pages(page, compound_order(page));
}
EXPORT_SYMBOL(page_frag_free);
diff --git a/mm/swap.c b/mm/swap.c
index 10decd9dffa1..3a01acfd5a89 100644
--- a/mm/swap.c
+++ b/mm/swap.c
@@ -109,7 +109,7 @@ void __folio_put(struct folio *folio)
page_cache_release(folio);
folio_unqueue_deferred_split(folio);
mem_cgroup_uncharge(folio);
- free_unref_page(&folio->page, folio_order(folio));
+ free_frozen_pages(&folio->page, folio_order(folio));
}
EXPORT_SYMBOL(__folio_put);
--
2.45.2
next prev parent reply other threads:[~2024-11-25 22:18 UTC|newest]
Thread overview: 64+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-25 21:01 [PATCH v3 00/15] Allocate and free frozen pages Matthew Wilcox (Oracle)
2024-11-25 21:01 ` [PATCH v3 01/15] mm/page_alloc: Cache page_zone() result in free_unref_page() Matthew Wilcox (Oracle)
2024-11-29 14:30 ` David Hildenbrand
2024-11-29 15:37 ` Zi Yan
2024-12-03 16:53 ` Vlastimil Babka
2024-12-03 16:54 ` Vlastimil Babka
2024-12-03 17:20 ` Matthew Wilcox
2024-12-03 18:38 ` Konstantin Ryabitsev
2024-11-25 21:01 ` [PATCH v3 02/15] mm: Make alloc_pages_mpol() static Matthew Wilcox (Oracle)
2024-11-29 14:31 ` David Hildenbrand
2024-11-29 15:42 ` Zi Yan
2024-12-03 16:58 ` Vlastimil Babka
2024-11-25 21:01 ` Matthew Wilcox (Oracle) [this message]
2024-11-29 15:47 ` [PATCH v3 03/15] mm/page_alloc: Export free_frozen_pages() instead of free_unref_page() Zi Yan
2024-12-04 9:37 ` Vlastimil Babka
2024-11-25 21:01 ` [PATCH v3 04/15] mm/page_alloc: Move set_page_refcounted() to callers of post_alloc_hook() Matthew Wilcox (Oracle)
2024-11-29 14:31 ` David Hildenbrand
2024-11-29 15:51 ` Zi Yan
2024-12-04 9:46 ` Vlastimil Babka
2024-11-25 21:01 ` [PATCH v3 05/15] mm/page_alloc: Move set_page_refcounted() to callers of prep_new_page() Matthew Wilcox (Oracle)
2024-11-29 14:34 ` David Hildenbrand
2024-11-29 15:52 ` Zi Yan
2024-12-04 9:55 ` Vlastimil Babka
2024-11-25 21:01 ` [PATCH v3 06/15] mm/page_alloc: Move set_page_refcounted() to callers of get_page_from_freelist() Matthew Wilcox (Oracle)
2024-11-29 15:55 ` Zi Yan
2024-12-04 10:03 ` Vlastimil Babka
2024-11-25 21:01 ` [PATCH v3 07/15] mm/page_alloc: Move set_page_refcounted() to callers of __alloc_pages_cpuset_fallback() Matthew Wilcox (Oracle)
2024-11-29 15:58 ` Zi Yan
2024-12-04 10:36 ` Vlastimil Babka
2024-11-25 21:01 ` [PATCH v3 08/15] mm/page_alloc: Move set_page_refcounted() to callers of __alloc_pages_may_oom() Matthew Wilcox (Oracle)
2024-11-29 16:01 ` Zi Yan
2024-12-04 10:37 ` Vlastimil Babka
2024-11-25 21:01 ` [PATCH v3 09/15] mm/page_alloc: Move set_page_refcounted() to callers of __alloc_pages_direct_compact() Matthew Wilcox (Oracle)
2024-11-29 16:06 ` Zi Yan
2024-12-04 10:39 ` Vlastimil Babka
2024-11-25 21:01 ` [PATCH v3 10/15] mm/page_alloc: Move set_page_refcounted() to callers of __alloc_pages_direct_reclaim() Matthew Wilcox (Oracle)
2024-11-29 16:08 ` Zi Yan
2024-12-04 10:41 ` Vlastimil Babka
2024-11-25 21:01 ` [PATCH v3 11/15] mm/page_alloc: Move set_page_refcounted() to callers of __alloc_pages_slowpath() Matthew Wilcox (Oracle)
2024-11-29 16:10 ` Zi Yan
2024-12-04 10:57 ` Vlastimil Babka
2024-11-25 21:01 ` [PATCH v3 12/15] mm/page_alloc: Move set_page_refcounted() to end of __alloc_pages() Matthew Wilcox (Oracle)
2024-11-29 16:14 ` Zi Yan
2024-12-04 11:03 ` Vlastimil Babka
2024-11-25 21:01 ` [PATCH v3 13/15] mm/page_alloc: Add __alloc_frozen_pages() Matthew Wilcox (Oracle)
2024-11-29 14:36 ` David Hildenbrand
2024-11-29 16:19 ` Zi Yan
2024-12-04 11:10 ` Vlastimil Babka
2025-01-13 3:29 ` Andrew Morton
2024-11-25 21:01 ` [PATCH v3 14/15] mm/mempolicy: Add alloc_frozen_pages() Matthew Wilcox (Oracle)
2024-11-29 14:44 ` David Hildenbrand
2024-11-29 16:29 ` Zi Yan
2024-11-29 17:18 ` David Hildenbrand
2024-12-04 11:34 ` Vlastimil Babka
2024-12-04 13:58 ` David Hildenbrand
2024-12-04 11:29 ` Vlastimil Babka
2024-11-25 21:01 ` [PATCH v3 15/15] slab: Allocate frozen pages Matthew Wilcox (Oracle)
2024-11-27 15:07 ` David Hildenbrand
2024-11-27 15:52 ` Matthew Wilcox
2024-12-04 14:43 ` Vlastimil Babka
2025-01-13 9:18 ` Vlastimil Babka
2024-11-26 5:04 ` [PATCH v3 00/15] Allocate and free " Hyeonggon Yoo
2024-12-04 16:07 ` Vlastimil Babka
2024-12-09 0:17 ` Hyeonggon Yoo
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=20241125210149.2976098-4-willy@infradead.org \
--to=willy@infradead.org \
--cc=akpm@linux-foundation.org \
--cc=david@redhat.com \
--cc=linmiaohe@huawei.com \
--cc=linux-mm@kvack.org \
--cc=songmuchun@bytedance.com \
--cc=william.kucharski@oracle.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