tiny_rcu: Directly force QS when call_rcu_[bh|sched]() on idle_task
authorLai Jiangshan <laijs@cn.fujitsu.com>
Tue, 9 Dec 2014 09:53:34 +0000 (17:53 +0800)
committerPaul E. McKenney <paulmck@linux.vnet.ibm.com>
Tue, 6 Jan 2015 19:01:12 +0000 (11:01 -0800)
commit5f6130fa52ee0df0b1da4518c5bbef42bcfe7d83
tree4747d85a2fb1a5b2f6b904d99122a2990eb2695f
parentac59853c06993a442e8060bc19040b2ca3025aec
tiny_rcu: Directly force QS when call_rcu_[bh|sched]() on idle_task

For RCU in UP, context-switch = QS = GP, thus we can force a
context-switch when any call_rcu_[bh|sched]() is happened on idle_task.
After doing so, rcu_idle/irq_enter/exit() are useless, so we can simply
make these functions empty.

More important, this change does not change the functionality logically.
Note: raise_softirq(RCU_SOFTIRQ)/rcu_sched_qs() in rcu_idle_enter() and
outmost rcu_irq_exit() will have to wake up the ksoftirqd
(due to in_interrupt() == 0).

Before this patch After this patch:
call_rcu_sched() in idle; call_rcu_sched() in idle
  set resched
do other stuffs; do other stuffs
outmost rcu_irq_exit() outmost rcu_irq_exit() (empty function)
  (or rcu_idle_enter())   (or rcu_idle_enter(), also empty function)
start to resched. (see above)
  rcu_sched_qs() rcu_sched_qs()
    QS,and GP and advance cb   QS,and GP and advance cb
    wake up the ksoftirqd     wake up the ksoftirqd
      set resched
resched to ksoftirqd (or other) resched to ksoftirqd (or other)

These two code patches are almost the same.

Size changed after patched:

size kernel/rcu/tiny-old.o kernel/rcu/tiny-patched.o
   text    data     bss     dec     hex filename
   3449     206       8    3663     e4f kernel/rcu/tiny-old.o
   2406     144       8    2558     9fe kernel/rcu/tiny-patched.o

Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
kernel/rcu/rcu.h
kernel/rcu/tiny.c
kernel/rcu/tiny_plugin.h
kernel/rcu/tree.c