[PATCH 3.13, 3.14, 3.16, 3.17] rcu: Reduce rcu kthread wakeups
Kamal Mostafa
kamal at canonical.com
Mon Oct 13 20:01:26 UTC 2014
On Mon, 2014-10-13 at 12:29 -0400, Pranith Kumar wrote:
> Backport 2aa792e and parts of 48a7639 to 3.13 which is Ubuntu LTS kernel.
>
> This commit reduces the number of rcu kthread wakeups. Tested for over a week on
> my desktop 14.04 system.
>
> Signed-off-by: Pranith Kumar <bobby.prani at gmail.com>
> CC: Paul E. McKenney <paulmck at linux.vnet.ibm.com>
Hi Pranith and Paul-
This looks good, but how about lets split it back into two commits (the
second a clean cherry-pick) and submit it for 3.{14,16,17}-stable also:
3.13 and 3.14 could apply the attached 48a7639 mini-backport (just
supplying rcu_gp_kthread_wake), and then cherry-pick 2aa792e.
3.16 and 3.17 carry 48a7639 already, so could just cherry-pick 2aa792e.
-Kamal
> kernel/rcu/tree.c | 22 +++++++++++++++++++---
> 1 file changed, 19 insertions(+), 3 deletions(-)
>
> diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
> index dd08198..9b3beea 100644
> --- a/kernel/rcu/tree.c
> +++ b/kernel/rcu/tree.c
> @@ -1193,6 +1193,22 @@ static int rcu_future_gp_cleanup(struct rcu_state *rsp, struct rcu_node *rnp)
> }
>
> /*
> + * Awaken the grace-period kthread for the specified flavor of RCU.
> + * Don't do a self-awaken, and don't bother awakening when there is
> + * nothing for the grace-period kthread to do (as in several CPUs
> + * raced to awaken, and we lost), and finally don't try to awaken
> + * a kthread that has not yet been created.
> + */
> +static void rcu_gp_kthread_wake(struct rcu_state *rsp)
> +{
> + if (current == rsp->gp_kthread ||
> + !ACCESS_ONCE(rsp->gp_flags) ||
> + !rsp->gp_kthread)
> + return;
> + wake_up(&rsp->gp_wq);
> +}
> +
> +/*
> * If there is room, assign a ->completed number to any callbacks on
> * this CPU that have not already been assigned. Also accelerate any
> * callbacks that were previously assigned a ->completed number that has
> @@ -1625,7 +1641,7 @@ static void rsp_wakeup(struct irq_work *work)
> struct rcu_state *rsp = container_of(work, struct rcu_state, wakeup_work);
>
> /* Wake up rcu_gp_kthread() to start the grace period. */
> - wake_up(&rsp->gp_wq);
> + rcu_gp_kthread_wake(rsp);
> }
>
> /*
> @@ -1701,7 +1717,7 @@ static void rcu_report_qs_rsp(struct rcu_state *rsp, unsigned long flags)
> {
> WARN_ON_ONCE(!rcu_gp_in_progress(rsp));
> raw_spin_unlock_irqrestore(&rcu_get_root(rsp)->lock, flags);
> - wake_up(&rsp->gp_wq); /* Memory barrier implied by wake_up() path. */
> + rcu_gp_kthread_wake(rsp);
> }
>
> /*
> @@ -2271,7 +2287,7 @@ static void force_quiescent_state(struct rcu_state *rsp)
> }
> rsp->gp_flags |= RCU_GP_FLAG_FQS;
> raw_spin_unlock_irqrestore(&rnp_old->lock, flags);
> - wake_up(&rsp->gp_wq); /* Memory barrier implied by wake_up() path. */
> + rcu_gp_kthread_wake(rsp);
> }
>
> /*
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-rcu-Make-callers-awaken-grace-period-kthread.patch
Type: text/x-patch
Size: 4508 bytes
Desc: not available
URL: <https://lists.ubuntu.com/archives/kernel-team/attachments/20141013/a568c6e1/attachment.bin>
More information about the kernel-team
mailing list