rcu: Throttle invoke_rcu_core() invocations due to non-lazy callbacks
authorPaul E. McKenney <paulmck@linux.vnet.ibm.com>
Fri, 6 Sep 2013 00:02:11 +0000 (17:02 -0700)
committerJiri Slaby <jslaby@suse.cz>
Wed, 12 Mar 2014 12:25:37 +0000 (13:25 +0100)
commit c337f8f58ed7cf150651d232af8222421a71463d upstream.

If a non-lazy callback arrives on a CPU that has previously gone idle
with no non-lazy callbacks, invoke_rcu_core() forces the RCU core to
run.  However, it does not update the conditions, which could result
in several closely spaced invocations of the RCU core, which in turn
could result in an excessively high context-switch rate and resulting
high overhead.

This commit therefore updates the ->all_lazy and ->nonlazy_posted_snap
fields to prevent closely spaced invocations.

Reported-by: Tibor Billes <tbilles@gmx.com>
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Tested-by: Tibor Billes <tbilles@gmx.com>
Reviewed-by: Josh Triplett <josh@joshtriplett.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
kernel/rcutree_plugin.h

index fd71cef0d789adc54f8d8594455991fcddbf1aab..d9cd0c2e34cbe3d93b2283cd91f087e6f7e15a3a 100644 (file)
@@ -1739,6 +1739,8 @@ static void rcu_prepare_for_idle(int cpu)
         */
        if (rdtp->all_lazy &&
            rdtp->nonlazy_posted != rdtp->nonlazy_posted_snap) {
+               rdtp->all_lazy = false;
+               rdtp->nonlazy_posted_snap = rdtp->nonlazy_posted;
                invoke_rcu_core();
                return;
        }