* [PATCH] srcu: refactor __srcu_read_(un)lock_lite() declarations
@ 2025-01-14 10:52 Masahiro Yamada
2025-01-16 16:03 ` Paul E. McKenney
0 siblings, 1 reply; 2+ messages in thread
From: Masahiro Yamada @ 2025-01-14 10:52 UTC (permalink / raw)
To: Paul E . McKenney, Frederic Weisbecker, Neeraj Upadhyay,
Joel Fernandes, Josh Triplett, Boqun Feng, Uladzislau Rezki, rcu
Cc: linux-kernel, Masahiro Yamada, Lai Jiangshan, Mathieu Desnoyers,
Steven Rostedt
For CONFIG_TREE_SRCU, __srcu_read_(un)lock_lite() are defined as static
inline functions in <linux/srcutree.h>. The later function declarations
are redundant.
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
---
include/linux/srcu.h | 9 ++-------
include/linux/srcutree.h | 4 ++--
2 files changed, 4 insertions(+), 9 deletions(-)
diff --git a/include/linux/srcu.h b/include/linux/srcu.h
index 08339eb8a01c..314f0bca6eb7 100644
--- a/include/linux/srcu.h
+++ b/include/linux/srcu.h
@@ -45,6 +45,8 @@ int init_srcu_struct(struct srcu_struct *ssp);
#ifdef CONFIG_TINY_SRCU
#include <linux/srcutiny.h>
+#define __srcu_read_lock_lite __srcu_read_lock
+#define __srcu_read_unlock_lite __srcu_read_unlock
#elif defined(CONFIG_TREE_SRCU)
#include <linux/srcutree.h>
#else
@@ -56,13 +58,6 @@ void call_srcu(struct srcu_struct *ssp, struct rcu_head *head,
void cleanup_srcu_struct(struct srcu_struct *ssp);
int __srcu_read_lock(struct srcu_struct *ssp) __acquires(ssp);
void __srcu_read_unlock(struct srcu_struct *ssp, int idx) __releases(ssp);
-#ifdef CONFIG_TINY_SRCU
-#define __srcu_read_lock_lite __srcu_read_lock
-#define __srcu_read_unlock_lite __srcu_read_unlock
-#else // #ifdef CONFIG_TINY_SRCU
-int __srcu_read_lock_lite(struct srcu_struct *ssp) __acquires(ssp);
-void __srcu_read_unlock_lite(struct srcu_struct *ssp, int idx) __releases(ssp);
-#endif // #else // #ifdef CONFIG_TINY_SRCU
void synchronize_srcu(struct srcu_struct *ssp);
#define SRCU_GET_STATE_COMPLETED 0x1
diff --git a/include/linux/srcutree.h b/include/linux/srcutree.h
index 490aeecc6bb4..16a7d631c185 100644
--- a/include/linux/srcutree.h
+++ b/include/linux/srcutree.h
@@ -219,7 +219,7 @@ void srcu_torture_stats_print(struct srcu_struct *ssp, char *tt, char *tf);
* or because it is a read-modify-write atomic operation, depending on
* the whims of the architecture.
*/
-static inline int __srcu_read_lock_lite(struct srcu_struct *ssp)
+static inline int __srcu_read_lock_lite(struct srcu_struct *ssp) __acquires(ssp)
{
int idx;
@@ -241,7 +241,7 @@ static inline int __srcu_read_lock_lite(struct srcu_struct *ssp)
* or because it is a read-modify-write atomic operation, depending on
* the whims of the architecture.
*/
-static inline void __srcu_read_unlock_lite(struct srcu_struct *ssp, int idx)
+static inline void __srcu_read_unlock_lite(struct srcu_struct *ssp, int idx) __releases(ssp)
{
barrier(); /* Avoid leaking the critical section. */
this_cpu_inc(ssp->sda->srcu_unlock_count[idx].counter); /* Z */
--
2.43.0
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] srcu: refactor __srcu_read_(un)lock_lite() declarations
2025-01-14 10:52 [PATCH] srcu: refactor __srcu_read_(un)lock_lite() declarations Masahiro Yamada
@ 2025-01-16 16:03 ` Paul E. McKenney
0 siblings, 0 replies; 2+ messages in thread
From: Paul E. McKenney @ 2025-01-16 16:03 UTC (permalink / raw)
To: Masahiro Yamada
Cc: Frederic Weisbecker, Neeraj Upadhyay, Joel Fernandes,
Josh Triplett, Boqun Feng, Uladzislau Rezki, rcu, linux-kernel,
Lai Jiangshan, Mathieu Desnoyers, Steven Rostedt
On Tue, Jan 14, 2025 at 07:52:13PM +0900, Masahiro Yamada wrote:
> For CONFIG_TREE_SRCU, __srcu_read_(un)lock_lite() are defined as static
> inline functions in <linux/srcutree.h>. The later function declarations
> are redundant.
>
> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Hello, Masahiro, and thank you for the patch!
This part of the code has seen quite a bit of churn over the past month
or so. So could you please rebase this patch on top of my -rcu tree's
"dev" branch?
git://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu.git
Thanx, Paul
> ---
>
> include/linux/srcu.h | 9 ++-------
> include/linux/srcutree.h | 4 ++--
> 2 files changed, 4 insertions(+), 9 deletions(-)
>
> diff --git a/include/linux/srcu.h b/include/linux/srcu.h
> index 08339eb8a01c..314f0bca6eb7 100644
> --- a/include/linux/srcu.h
> +++ b/include/linux/srcu.h
> @@ -45,6 +45,8 @@ int init_srcu_struct(struct srcu_struct *ssp);
>
> #ifdef CONFIG_TINY_SRCU
> #include <linux/srcutiny.h>
> +#define __srcu_read_lock_lite __srcu_read_lock
> +#define __srcu_read_unlock_lite __srcu_read_unlock
> #elif defined(CONFIG_TREE_SRCU)
> #include <linux/srcutree.h>
> #else
> @@ -56,13 +58,6 @@ void call_srcu(struct srcu_struct *ssp, struct rcu_head *head,
> void cleanup_srcu_struct(struct srcu_struct *ssp);
> int __srcu_read_lock(struct srcu_struct *ssp) __acquires(ssp);
> void __srcu_read_unlock(struct srcu_struct *ssp, int idx) __releases(ssp);
> -#ifdef CONFIG_TINY_SRCU
> -#define __srcu_read_lock_lite __srcu_read_lock
> -#define __srcu_read_unlock_lite __srcu_read_unlock
> -#else // #ifdef CONFIG_TINY_SRCU
> -int __srcu_read_lock_lite(struct srcu_struct *ssp) __acquires(ssp);
> -void __srcu_read_unlock_lite(struct srcu_struct *ssp, int idx) __releases(ssp);
> -#endif // #else // #ifdef CONFIG_TINY_SRCU
> void synchronize_srcu(struct srcu_struct *ssp);
>
> #define SRCU_GET_STATE_COMPLETED 0x1
> diff --git a/include/linux/srcutree.h b/include/linux/srcutree.h
> index 490aeecc6bb4..16a7d631c185 100644
> --- a/include/linux/srcutree.h
> +++ b/include/linux/srcutree.h
> @@ -219,7 +219,7 @@ void srcu_torture_stats_print(struct srcu_struct *ssp, char *tt, char *tf);
> * or because it is a read-modify-write atomic operation, depending on
> * the whims of the architecture.
> */
> -static inline int __srcu_read_lock_lite(struct srcu_struct *ssp)
> +static inline int __srcu_read_lock_lite(struct srcu_struct *ssp) __acquires(ssp)
> {
> int idx;
>
> @@ -241,7 +241,7 @@ static inline int __srcu_read_lock_lite(struct srcu_struct *ssp)
> * or because it is a read-modify-write atomic operation, depending on
> * the whims of the architecture.
> */
> -static inline void __srcu_read_unlock_lite(struct srcu_struct *ssp, int idx)
> +static inline void __srcu_read_unlock_lite(struct srcu_struct *ssp, int idx) __releases(ssp)
> {
> barrier(); /* Avoid leaking the critical section. */
> this_cpu_inc(ssp->sda->srcu_unlock_count[idx].counter); /* Z */
> --
> 2.43.0
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-01-16 16:03 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-14 10:52 [PATCH] srcu: refactor __srcu_read_(un)lock_lite() declarations Masahiro Yamada
2025-01-16 16:03 ` Paul E. McKenney
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.