2012-10-03 18:22:12

by Frederic Weisbecker

[permalink] [raw]
Subject: [PATCH] rcu: Remove rcu_switch()

It's only there to call rcu_user_hooks_switch(). Let's
just call rcu_user_hooks_switch() directly, we don't need this
function in the middle.

Signed-off-by: Frederic Weisbecker <[email protected]>
Cc: Josh Triplett <[email protected]>
Cc: Peter Zijlstra <[email protected]>
---
include/linux/rcupdate.h | 2 ++
include/linux/sched.h | 8 --------
kernel/sched/core.c | 2 +-
3 files changed, 3 insertions(+), 9 deletions(-)

diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
index 7c968e4..5d009de 100644
--- a/include/linux/rcupdate.h
+++ b/include/linux/rcupdate.h
@@ -204,6 +204,8 @@ static inline void rcu_user_enter(void) { }
static inline void rcu_user_exit(void) { }
static inline void rcu_user_enter_after_irq(void) { }
static inline void rcu_user_exit_after_irq(void) { }
+static inline void rcu_user_hooks_switch(struct task_struct *prev,
+ struct task_struct *next) { }
#endif /* CONFIG_RCU_USER_QS */

extern void exit_rcu(void);
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 9d51e26..65e2694 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -1886,14 +1886,6 @@ static inline void rcu_copy_process(struct task_struct *p)

#endif

-static inline void rcu_switch(struct task_struct *prev,
- struct task_struct *next)
-{
-#ifdef CONFIG_RCU_USER_QS
- rcu_user_hooks_switch(prev, next);
-#endif
-}
-
static inline void tsk_restore_flags(struct task_struct *task,
unsigned long orig_flags, unsigned long flags)
{
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index c177472..a48bef7 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -1887,7 +1887,7 @@ context_switch(struct rq *rq, struct task_struct *prev,
#endif

/* Here we just switch the register state and the stack. */
- rcu_switch(prev, next);
+ rcu_user_hooks_switch(prev, next);
switch_to(prev, next, prev);

barrier();
--
1.7.5.4


2012-10-03 18:48:32

by Paul E. McKenney

[permalink] [raw]
Subject: Re: [PATCH] rcu: Remove rcu_switch()

On Wed, Oct 03, 2012 at 08:21:52PM +0200, Frederic Weisbecker wrote:
> It's only there to call rcu_user_hooks_switch(). Let's
> just call rcu_user_hooks_switch() directly, we don't need this
> function in the middle.

Hello, Frederic!

Doesn't this also require an empty definition of rcu_user_hooks_switch()
to handle the CONFIG_RCU_USER_QS=n case? Or is there already such
a definition that I am too blind to see?

Thanx, Paul

> Signed-off-by: Frederic Weisbecker <[email protected]>
> Cc: Josh Triplett <[email protected]>
> Cc: Peter Zijlstra <[email protected]>
> ---
> include/linux/rcupdate.h | 2 ++
> include/linux/sched.h | 8 --------
> kernel/sched/core.c | 2 +-
> 3 files changed, 3 insertions(+), 9 deletions(-)
>
> diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
> index 7c968e4..5d009de 100644
> --- a/include/linux/rcupdate.h
> +++ b/include/linux/rcupdate.h
> @@ -204,6 +204,8 @@ static inline void rcu_user_enter(void) { }
> static inline void rcu_user_exit(void) { }
> static inline void rcu_user_enter_after_irq(void) { }
> static inline void rcu_user_exit_after_irq(void) { }
> +static inline void rcu_user_hooks_switch(struct task_struct *prev,
> + struct task_struct *next) { }
> #endif /* CONFIG_RCU_USER_QS */
>
> extern void exit_rcu(void);
> diff --git a/include/linux/sched.h b/include/linux/sched.h
> index 9d51e26..65e2694 100644
> --- a/include/linux/sched.h
> +++ b/include/linux/sched.h
> @@ -1886,14 +1886,6 @@ static inline void rcu_copy_process(struct task_struct *p)
>
> #endif
>
> -static inline void rcu_switch(struct task_struct *prev,
> - struct task_struct *next)
> -{
> -#ifdef CONFIG_RCU_USER_QS
> - rcu_user_hooks_switch(prev, next);
> -#endif
> -}
> -
> static inline void tsk_restore_flags(struct task_struct *task,
> unsigned long orig_flags, unsigned long flags)
> {
> diff --git a/kernel/sched/core.c b/kernel/sched/core.c
> index c177472..a48bef7 100644
> --- a/kernel/sched/core.c
> +++ b/kernel/sched/core.c
> @@ -1887,7 +1887,7 @@ context_switch(struct rq *rq, struct task_struct *prev,
> #endif
>
> /* Here we just switch the register state and the stack. */
> - rcu_switch(prev, next);
> + rcu_user_hooks_switch(prev, next);
> switch_to(prev, next, prev);
>
> barrier();
> --
> 1.7.5.4
>

2012-10-03 20:05:49

by Frederic Weisbecker

[permalink] [raw]
Subject: Re: [PATCH] rcu: Remove rcu_switch()

On Wed, Oct 03, 2012 at 11:39:45AM -0700, Paul E. McKenney wrote:
> On Wed, Oct 03, 2012 at 08:21:52PM +0200, Frederic Weisbecker wrote:
> > It's only there to call rcu_user_hooks_switch(). Let's
> > just call rcu_user_hooks_switch() directly, we don't need this
> > function in the middle.
>
> Hello, Frederic!
>
> Doesn't this also require an empty definition of rcu_user_hooks_switch()
> to handle the CONFIG_RCU_USER_QS=n case? Or is there already such
> a definition that I am too blind to see?

There is, look below:

>
> Thanx, Paul
>
> > Signed-off-by: Frederic Weisbecker <[email protected]>
> > Cc: Josh Triplett <[email protected]>
> > Cc: Peter Zijlstra <[email protected]>
> > ---
> > include/linux/rcupdate.h | 2 ++
> > include/linux/sched.h | 8 --------
> > kernel/sched/core.c | 2 +-
> > 3 files changed, 3 insertions(+), 9 deletions(-)
> >
> > diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
> > index 7c968e4..5d009de 100644
> > --- a/include/linux/rcupdate.h
> > +++ b/include/linux/rcupdate.h
> > @@ -204,6 +204,8 @@ static inline void rcu_user_enter(void) { }
> > static inline void rcu_user_exit(void) { }
> > static inline void rcu_user_enter_after_irq(void) { }
> > static inline void rcu_user_exit_after_irq(void) { }
> > +static inline void rcu_user_hooks_switch(struct task_struct *prev,
> > + struct task_struct *next) { }

Here.

> > #endif /* CONFIG_RCU_USER_QS */

2012-10-03 20:30:33

by Paul E. McKenney

[permalink] [raw]
Subject: Re: [PATCH] rcu: Remove rcu_switch()

On Wed, Oct 03, 2012 at 10:05:43PM +0200, Frederic Weisbecker wrote:
> On Wed, Oct 03, 2012 at 11:39:45AM -0700, Paul E. McKenney wrote:
> > On Wed, Oct 03, 2012 at 08:21:52PM +0200, Frederic Weisbecker wrote:
> > > It's only there to call rcu_user_hooks_switch(). Let's
> > > just call rcu_user_hooks_switch() directly, we don't need this
> > > function in the middle.
> >
> > Hello, Frederic!
> >
> > Doesn't this also require an empty definition of rcu_user_hooks_switch()
> > to handle the CONFIG_RCU_USER_QS=n case? Or is there already such
> > a definition that I am too blind to see?
>
> There is, look below:

Right you are! Queued.

Thanx, Paul

> > > Signed-off-by: Frederic Weisbecker <[email protected]>
> > > Cc: Josh Triplett <[email protected]>
> > > Cc: Peter Zijlstra <[email protected]>
> > > ---
> > > include/linux/rcupdate.h | 2 ++
> > > include/linux/sched.h | 8 --------
> > > kernel/sched/core.c | 2 +-
> > > 3 files changed, 3 insertions(+), 9 deletions(-)
> > >
> > > diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
> > > index 7c968e4..5d009de 100644
> > > --- a/include/linux/rcupdate.h
> > > +++ b/include/linux/rcupdate.h
> > > @@ -204,6 +204,8 @@ static inline void rcu_user_enter(void) { }
> > > static inline void rcu_user_exit(void) { }
> > > static inline void rcu_user_enter_after_irq(void) { }
> > > static inline void rcu_user_exit_after_irq(void) { }
> > > +static inline void rcu_user_hooks_switch(struct task_struct *prev,
> > > + struct task_struct *next) { }
>
> Here.
>
> > > #endif /* CONFIG_RCU_USER_QS */
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
>