* + mm-page_alloc-remove-pcpu_spin_-wrappers.patch added to mm-new branch
@ 2026-03-01 1:18 Andrew Morton
0 siblings, 0 replies; only message in thread
From: Andrew Morton @ 2026-03-01 1:18 UTC (permalink / raw)
To: mm-commits, ziy, willy, surenb, rostedt, mhocko, mgorman,
jackmanb, hannes, david, bigeasy, vbabka, akpm
The patch titled
Subject: mm/page_alloc: remove pcpu_spin_* wrappers
has been added to the -mm mm-new branch. Its filename is
mm-page_alloc-remove-pcpu_spin_-wrappers.patch
This patch will shortly appear at
https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-page_alloc-remove-pcpu_spin_-wrappers.patch
This patch will later appear in the mm-new branch at
git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
Note, mm-new is a provisional staging ground for work-in-progress
patches, and acceptance into mm-new is a notification for others take
notice and to finish up reviews. Please do not hesitate to respond to
review feedback and post updated versions to replace or incrementally
fixup patches in mm-new.
The mm-new branch of mm.git is not included in linux-next
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a
reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next via various
branches at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
and is updated there most days
------------------------------------------------------
From: Vlastimil Babka <vbabka@kernel.org>
Subject: mm/page_alloc: remove pcpu_spin_* wrappers
Date: Fri, 27 Feb 2026 18:08:00 +0100
We only ever use pcpu_spin_trylock()/unlock() with struct per_cpu_pages so
refactor the helpers to remove the generic layer.
No functional change intended.
Link: https://lkml.kernel.org/r/20260227-b4-pcp-locking-cleanup-v1-3-f7e22e603447@kernel.org
Signed-off-by: Vlastimil Babka (SUSE) <vbabka@kernel.org>
Suggested-by: Matthew Wilcox <willy@infradead.org>
Cc: Brendan Jackman <jackmanb@google.com>
Cc: David Hildenbrand (Arm) <david@kernel.org>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Mel Gorman <mgorman@techsingularity.net>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Suren Baghdasaryan <surenb@google.com>
Cc: Zi Yan <ziy@nvidia.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
mm/page_alloc.c | 24 +++++++++---------------
1 file changed, 9 insertions(+), 15 deletions(-)
--- a/mm/page_alloc.c~mm-page_alloc-remove-pcpu_spin_-wrappers
+++ a/mm/page_alloc.c
@@ -112,35 +112,29 @@ static DEFINE_MUTEX(pcp_batch_high_lock)
#endif
/*
- * Generic helper to lookup and a per-cpu variable with an embedded spinlock.
- * Return value should be used with equivalent unlock helper.
+ * A helper to lookup and trylock pcp with embedded spinlock.
+ * The return value should be used with the unlock helper.
+ * NULL return value means the trylock failed.
*/
-#define pcpu_spin_trylock(type, member, ptr) \
+#ifdef CONFIG_SMP
+#define pcp_spin_trylock(ptr) \
({ \
- type *_ret; \
+ struct per_cpu_pages *_ret; \
pcpu_task_pin(); \
_ret = this_cpu_ptr(ptr); \
- if (!spin_trylock(&_ret->member)) { \
+ if (!spin_trylock(&_ret->lock)) { \
pcpu_task_unpin(); \
_ret = NULL; \
} \
_ret; \
})
-#define pcpu_spin_unlock(member, ptr) \
+#define pcp_spin_unlock(ptr) \
({ \
- spin_unlock(&ptr->member); \
+ spin_unlock(&ptr->lock); \
pcpu_task_unpin(); \
})
-/* struct per_cpu_pages specific helpers.*/
-#ifdef CONFIG_SMP
-#define pcp_spin_trylock(ptr) \
- pcpu_spin_trylock(struct per_cpu_pages, lock, ptr)
-
-#define pcp_spin_unlock(ptr) \
- pcpu_spin_unlock(lock, ptr)
-
/*
* On CONFIG_SMP=n the UP implementation of spin_trylock() never fails and thus
* is not compatible with our locking scheme. However we do not need pcp for
_
Patches currently in -mm which might be from vbabka@kernel.org are
mm-page_alloc-effectively-disable-pcp-with-config_smp=n.patch
mm-page_alloc-remove-irq-saving-restoring-from-pcp-locking.patch
mm-page_alloc-remove-pcpu_spin_-wrappers.patch
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-03-01 1:18 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-01 1:18 + mm-page_alloc-remove-pcpu_spin_-wrappers.patch added to mm-new branch Andrew Morton
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.