lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250815061824.765906-2-dongml2@chinatelecom.cn>
Date: Fri, 15 Aug 2025 14:18:18 +0800
From: Menglong Dong <menglong8.dong@...il.com>
To: ast@...nel.org
Cc: daniel@...earbox.net,
	john.fastabend@...il.com,
	andrii@...nel.org,
	martin.lau@...ux.dev,
	eddyz87@...il.com,
	song@...nel.org,
	yonghong.song@...ux.dev,
	kpsingh@...nel.org,
	sdf@...ichev.me,
	haoluo@...gle.com,
	jolsa@...nel.org,
	bpf@...r.kernel.org,
	linux-kernel@...r.kernel.org
Subject: [PATCH bpf-next 1/7] rcu: add rcu_migrate_enable and rcu_migrate_disable

migrate_disable() is called to disable migration in the kernel, and it is
used togather with rcu_read_lock() oftenly.

However, with PREEMPT_RCU disabled, it's unnecessary, as rcu_read_lock()
will disable preemption, which will also disable migration.

Introduce rcu_migrate_enable() and rcu_migrate_disable(), which will do
the migration enable and disable only when the rcu_read_lock() can't do
it.

Signed-off-by: Menglong Dong <dongml2@...natelecom.cn>
---
 include/linux/rcupdate.h | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
index 120536f4c6eb..0d9dbd90d025 100644
--- a/include/linux/rcupdate.h
+++ b/include/linux/rcupdate.h
@@ -72,6 +72,16 @@ static inline bool same_state_synchronize_rcu(unsigned long oldstate1, unsigned
 void __rcu_read_lock(void);
 void __rcu_read_unlock(void);
 
+static inline void rcu_migrate_enable(void)
+{
+	migrate_enable();
+}
+
+static inline void rcu_migrate_disable(void)
+{
+	migrate_disable();
+}
+
 /*
  * Defined as a macro as it is a very low level header included from
  * areas that don't even know about current.  This gives the rcu_read_lock()
@@ -105,6 +115,14 @@ static inline int rcu_preempt_depth(void)
 	return 0;
 }
 
+static inline void rcu_migrate_enable(void)
+{
+}
+
+static inline void rcu_migrate_disable(void)
+{
+}
+
 #endif /* #else #ifdef CONFIG_PREEMPT_RCU */
 
 #ifdef CONFIG_RCU_LAZY
-- 
2.50.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ