[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251014112640.261770-2-dongml2@chinatelecom.cn>
Date: Tue, 14 Oct 2025 19:26:37 +0800
From: Menglong Dong <menglong8.dong@...il.com>
To: ast@...nel.org,
paulmck@...nel.org
Cc: daniel@...earbox.net,
andrii@...nel.org,
martin.lau@...ux.dev,
eddyz87@...il.com,
song@...nel.org,
yonghong.song@...ux.dev,
john.fastabend@...il.com,
kpsingh@...nel.org,
sdf@...ichev.me,
haoluo@...gle.com,
jolsa@...nel.org,
jakub@...udflare.com,
davem@...emloft.net,
edumazet@...gle.com,
kuba@...nel.org,
pabeni@...hat.com,
horms@...nel.org,
jiang.biao@...ux.dev,
bpf@...r.kernel.org,
linux-kernel@...r.kernel.org,
netdev@...r.kernel.org
Subject: [PATCH bpf-next 1/4] rcu: factor out migrate_enable_rcu and migrate_disable_rcu
Factor out migrate_enable_rcu/migrate_disable_rcu from
rcu_read_lock_dont_migrate/rcu_read_unlock_migrate.
These functions will be used in the following patches.
It's a little weird to define them in rcupdate.h. Maybe we should move
them to sched.h?
Signed-off-by: Menglong Dong <dongml2@...natelecom.cn>
---
include/linux/rcupdate.h | 20 +++++++++++++++++---
1 file changed, 17 insertions(+), 3 deletions(-)
diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
index c5b30054cd01..43626ccc07e2 100644
--- a/include/linux/rcupdate.h
+++ b/include/linux/rcupdate.h
@@ -988,18 +988,32 @@ static inline notrace void rcu_read_unlock_sched_notrace(void)
preempt_enable_notrace();
}
-static __always_inline void rcu_read_lock_dont_migrate(void)
+/* This can only be used with rcu_read_lock held */
+static inline void migrate_enable_rcu(void)
+{
+ WARN_ON_ONCE(!rcu_read_lock_held());
+ if (IS_ENABLED(CONFIG_PREEMPT_RCU))
+ migrate_enable();
+}
+
+/* This can only be used with rcu_read_lock held */
+static inline void migrate_disable_rcu(void)
{
+ WARN_ON_ONCE(!rcu_read_lock_held());
if (IS_ENABLED(CONFIG_PREEMPT_RCU))
migrate_disable();
+}
+
+static __always_inline void rcu_read_lock_dont_migrate(void)
+{
rcu_read_lock();
+ migrate_disable_rcu();
}
static inline void rcu_read_unlock_migrate(void)
{
+ migrate_enable_rcu();
rcu_read_unlock();
- if (IS_ENABLED(CONFIG_PREEMPT_RCU))
- migrate_enable();
}
/**
--
2.51.0
Powered by blists - more mailing lists