diff options
author | Paul E. McKenney <paul.mckenney@linaro.org> | 2012-09-04 20:35:31 -0400 |
---|---|---|
committer | Frederic Weisbecker <fweisbec@gmail.com> | 2012-09-26 09:47:18 -0400 |
commit | cb349ca95407cbc11424d5e9fc7c8e700709041b (patch) | |
tree | b20795decb064af75aae8f9f6af77806b1a4769a /kernel/rcutree.c | |
parent | 1fd2b4425a5702c112b441e20b250ac8833a9608 (diff) |
rcu: Apply micro-optimization and int/bool fixes to RCU's idle handling
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>
Diffstat (limited to 'kernel/rcutree.c')
-rw-r--r-- | kernel/rcutree.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/kernel/rcutree.c b/kernel/rcutree.c index 812d04b6b395..4fb2376ddf06 100644 --- a/kernel/rcutree.c +++ b/kernel/rcutree.c | |||
@@ -335,7 +335,7 @@ static void rcu_eqs_enter_common(struct rcu_dynticks *rdtp, long long oldval, | |||
335 | bool user) | 335 | bool user) |
336 | { | 336 | { |
337 | trace_rcu_dyntick("Start", oldval, 0); | 337 | trace_rcu_dyntick("Start", oldval, 0); |
338 | if (!is_idle_task(current) && !user) { | 338 | if (!user && !is_idle_task(current)) { |
339 | struct task_struct *idle = idle_task(smp_processor_id()); | 339 | struct task_struct *idle = idle_task(smp_processor_id()); |
340 | 340 | ||
341 | trace_rcu_dyntick("Error on entry: not idle task", oldval, 0); | 341 | trace_rcu_dyntick("Error on entry: not idle task", oldval, 0); |
@@ -399,7 +399,7 @@ void rcu_idle_enter(void) | |||
399 | unsigned long flags; | 399 | unsigned long flags; |
400 | 400 | ||
401 | local_irq_save(flags); | 401 | local_irq_save(flags); |
402 | rcu_eqs_enter(0); | 402 | rcu_eqs_enter(false); |
403 | local_irq_restore(flags); | 403 | local_irq_restore(flags); |
404 | } | 404 | } |
405 | EXPORT_SYMBOL_GPL(rcu_idle_enter); | 405 | EXPORT_SYMBOL_GPL(rcu_idle_enter); |
@@ -435,7 +435,7 @@ void rcu_user_enter(void) | |||
435 | rdtp = &__get_cpu_var(rcu_dynticks); | 435 | rdtp = &__get_cpu_var(rcu_dynticks); |
436 | if (!rdtp->ignore_user_qs && !rdtp->in_user) { | 436 | if (!rdtp->ignore_user_qs && !rdtp->in_user) { |
437 | rdtp->in_user = true; | 437 | rdtp->in_user = true; |
438 | rcu_eqs_enter(1); | 438 | rcu_eqs_enter(true); |
439 | } | 439 | } |
440 | local_irq_restore(flags); | 440 | local_irq_restore(flags); |
441 | } | 441 | } |
@@ -492,7 +492,7 @@ void rcu_irq_exit(void) | |||
492 | if (rdtp->dynticks_nesting) | 492 | if (rdtp->dynticks_nesting) |
493 | trace_rcu_dyntick("--=", oldval, rdtp->dynticks_nesting); | 493 | trace_rcu_dyntick("--=", oldval, rdtp->dynticks_nesting); |
494 | else | 494 | else |
495 | rcu_eqs_enter_common(rdtp, oldval, 1); | 495 | rcu_eqs_enter_common(rdtp, oldval, true); |
496 | local_irq_restore(flags); | 496 | local_irq_restore(flags); |
497 | } | 497 | } |
498 | 498 | ||
@@ -513,7 +513,7 @@ static void rcu_eqs_exit_common(struct rcu_dynticks *rdtp, long long oldval, | |||
513 | WARN_ON_ONCE(!(atomic_read(&rdtp->dynticks) & 0x1)); | 513 | WARN_ON_ONCE(!(atomic_read(&rdtp->dynticks) & 0x1)); |
514 | rcu_cleanup_after_idle(smp_processor_id()); | 514 | rcu_cleanup_after_idle(smp_processor_id()); |
515 | trace_rcu_dyntick("End", oldval, rdtp->dynticks_nesting); | 515 | trace_rcu_dyntick("End", oldval, rdtp->dynticks_nesting); |
516 | if (!is_idle_task(current) && !user) { | 516 | if (!user && !is_idle_task(current)) { |
517 | struct task_struct *idle = idle_task(smp_processor_id()); | 517 | struct task_struct *idle = idle_task(smp_processor_id()); |
518 | 518 | ||
519 | trace_rcu_dyntick("Error on exit: not idle task", | 519 | trace_rcu_dyntick("Error on exit: not idle task", |
@@ -560,7 +560,7 @@ void rcu_idle_exit(void) | |||
560 | unsigned long flags; | 560 | unsigned long flags; |
561 | 561 | ||
562 | local_irq_save(flags); | 562 | local_irq_save(flags); |
563 | rcu_eqs_exit(0); | 563 | rcu_eqs_exit(false); |
564 | local_irq_restore(flags); | 564 | local_irq_restore(flags); |
565 | } | 565 | } |
566 | EXPORT_SYMBOL_GPL(rcu_idle_exit); | 566 | EXPORT_SYMBOL_GPL(rcu_idle_exit); |
@@ -592,7 +592,7 @@ void rcu_user_exit(void) | |||
592 | rdtp = &__get_cpu_var(rcu_dynticks); | 592 | rdtp = &__get_cpu_var(rcu_dynticks); |
593 | if (rdtp->in_user) { | 593 | if (rdtp->in_user) { |
594 | rdtp->in_user = false; | 594 | rdtp->in_user = false; |
595 | rcu_eqs_exit(1); | 595 | rcu_eqs_exit(true); |
596 | } | 596 | } |
597 | local_irq_restore(flags); | 597 | local_irq_restore(flags); |
598 | } | 598 | } |
@@ -653,7 +653,7 @@ void rcu_irq_enter(void) | |||
653 | if (oldval) | 653 | if (oldval) |
654 | trace_rcu_dyntick("++=", oldval, rdtp->dynticks_nesting); | 654 | trace_rcu_dyntick("++=", oldval, rdtp->dynticks_nesting); |
655 | else | 655 | else |
656 | rcu_eqs_exit_common(rdtp, oldval, 1); | 656 | rcu_eqs_exit_common(rdtp, oldval, true); |
657 | local_irq_restore(flags); | 657 | local_irq_restore(flags); |
658 | } | 658 | } |
659 | 659 | ||