]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
rcu: Apply micro-optimization and int/bool fixes to RCU's idle handling
authorPaul E. McKenney <paul.mckenney@linaro.org>
Wed, 5 Sep 2012 00:35:31 +0000 (17:35 -0700)
committerPaul E. McKenney <paulmck@linux.vnet.ibm.com>
Wed, 5 Sep 2012 01:11:52 +0000 (18:11 -0700)
Checking "user" before "is_idle_task()" allows better optimizations
in cases where inlining is possible.  Also, "bool" should be passed
"true" or "false" rather than "1" or "0".  This commit therefore makes
these changes, as noted in Josh's review.

Reported-by: Josh Triplett <josh@joshtriplett.org>
Signed-off-by: Paul E. McKenney <paul.mckenney@linaro.org>
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Reviewed-by: Josh Triplett <josh@joshtriplett.org>
kernel/rcutree.c

index d34094ae176e17a0de838adf733aafa9fbc2d645..ce41aebd00d1f0156ebc672abc8adc909d268855 100644 (file)
@@ -359,7 +359,7 @@ static void rcu_eqs_enter_common(struct rcu_dynticks *rdtp, long long oldval,
                                bool user)
 {
        trace_rcu_dyntick("Start", oldval, 0);
-       if (!is_idle_task(current) && !user) {
+       if (!user && !is_idle_task(current)) {
                struct task_struct *idle = idle_task(smp_processor_id());
 
                trace_rcu_dyntick("Error on entry: not idle task", oldval, 0);
@@ -423,7 +423,7 @@ void rcu_idle_enter(void)
        unsigned long flags;
 
        local_irq_save(flags);
-       rcu_eqs_enter(0);
+       rcu_eqs_enter(false);
        local_irq_restore(flags);
 }
 EXPORT_SYMBOL_GPL(rcu_idle_enter);
@@ -448,7 +448,7 @@ void rcu_user_enter(void)
        rdtp = &__get_cpu_var(rcu_dynticks);
        if (!rdtp->ignore_user_qs && !rdtp->in_user) {
                rdtp->in_user = true;
-               rcu_eqs_enter(1);
+               rcu_eqs_enter(true);
        }
        local_irq_restore(flags);
 }
@@ -506,7 +506,7 @@ void rcu_irq_exit(void)
        if (rdtp->dynticks_nesting)
                trace_rcu_dyntick("--=", oldval, rdtp->dynticks_nesting);
        else
-               rcu_eqs_enter_common(rdtp, oldval, 1);
+               rcu_eqs_enter_common(rdtp, oldval, true);
        local_irq_restore(flags);
 }
 
@@ -527,7 +527,7 @@ static void rcu_eqs_exit_common(struct rcu_dynticks *rdtp, long long oldval,
        WARN_ON_ONCE(!(atomic_read(&rdtp->dynticks) & 0x1));
        rcu_cleanup_after_idle(smp_processor_id());
        trace_rcu_dyntick("End", oldval, rdtp->dynticks_nesting);
-       if (!is_idle_task(current) && !user) {
+       if (!user && !is_idle_task(current)) {
                struct task_struct *idle = idle_task(smp_processor_id());
 
                trace_rcu_dyntick("Error on exit: not idle task",
@@ -574,7 +574,7 @@ void rcu_idle_exit(void)
        unsigned long flags;
 
        local_irq_save(flags);
-       rcu_eqs_exit(0);
+       rcu_eqs_exit(false);
        local_irq_restore(flags);
 }
 EXPORT_SYMBOL_GPL(rcu_idle_exit);
@@ -595,7 +595,7 @@ void rcu_user_exit(void)
        rdtp = &__get_cpu_var(rcu_dynticks);
        if (rdtp->in_user) {
                rdtp->in_user = false;
-               rcu_eqs_exit(1);
+               rcu_eqs_exit(true);
        }
        local_irq_restore(flags);
 }
@@ -657,7 +657,7 @@ void rcu_irq_enter(void)
        if (oldval)
                trace_rcu_dyntick("++=", oldval, rdtp->dynticks_nesting);
        else
-               rcu_eqs_exit_common(rdtp, oldval, 1);
+               rcu_eqs_exit_common(rdtp, oldval, true);
        local_irq_restore(flags);
 }