linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
To: linux-kernel@vger.kernel.org
Cc: mingo@kernel.org, laijs@cn.fujitsu.com, dipankar@in.ibm.com,
	akpm@linux-foundation.org, mathieu.desnoyers@efficios.com,
	josh@joshtriplett.org, tglx@linutronix.de, peterz@infradead.org,
	rostedt@goodmis.org, dhowells@redhat.com, edumazet@google.com,
	dvhart@linux.intel.com, fweisbec@gmail.com, oleg@redhat.com,
	bobby.prani@gmail.com,
	"Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
Subject: [PATCH RFC tip/core/rcu 9/9] rcu: Improve RCU-tasks energy efficiency
Date: Mon, 28 Jul 2014 15:56:20 -0700	[thread overview]
Message-ID: <1406588180-21933-9-git-send-email-paulmck@linux.vnet.ibm.com> (raw)
In-Reply-To: <1406588180-21933-1-git-send-email-paulmck@linux.vnet.ibm.com>

From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>

The current RCU-tasks implementation uses strict polling to detect
callback arrivals.  This works quite well, but is not so good for
energy efficiency.  This commit therefore replaces the strict polling
with a wait queue.

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>

Conflicts:
	kernel/rcu/update.c
---
 kernel/rcu/update.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/kernel/rcu/update.c b/kernel/rcu/update.c
index 7d3e56f7b623..34625ef543f6 100644
--- a/kernel/rcu/update.c
+++ b/kernel/rcu/update.c
@@ -372,6 +372,7 @@ static DEFINE_SPINLOCK(rcu_tasks_global_lock);
 /* Global list of callbacks and associated lock. */
 static struct rcu_head *rcu_tasks_cbs_head;
 static struct rcu_head **rcu_tasks_cbs_tail = &rcu_tasks_cbs_head;
+static DECLARE_WAIT_QUEUE_HEAD(rcu_tasks_cbs_wq);
 static DEFINE_RAW_SPINLOCK(rcu_tasks_cbs_lock);
 
 /* Control stall timeouts.  Disable with <= 0, otherwise jiffies till stall. */
@@ -382,13 +383,17 @@ module_param(rcu_task_stall_timeout, int, 0644);
 void call_rcu_tasks(struct rcu_head *rhp, void (*func)(struct rcu_head *rhp))
 {
 	unsigned long flags;
+	bool needwake;
 
 	rhp->next = NULL;
 	rhp->func = func;
 	raw_spin_lock_irqsave(&rcu_tasks_cbs_lock, flags);
+	needwake = !rcu_tasks_cbs_head;
 	*rcu_tasks_cbs_tail = rhp;
 	rcu_tasks_cbs_tail = &rhp->next;
 	raw_spin_unlock_irqrestore(&rcu_tasks_cbs_lock, flags);
+	if (needwake)
+		wake_up(&rcu_tasks_cbs_wq);
 }
 EXPORT_SYMBOL_GPL(call_rcu_tasks);
 
@@ -786,8 +791,12 @@ static int __noreturn rcu_tasks_kthread(void *arg)
 
 		/* If there were none, wait a bit and start over. */
 		if (!list) {
-			schedule_timeout_interruptible(HZ);
-			flush_signals(current);
+			wait_event_interruptible(rcu_tasks_cbs_wq,
+						 rcu_tasks_cbs_head);
+			if (!rcu_tasks_cbs_head) {
+				flush_signals(current);
+				schedule_timeout_interruptible(HZ/10);
+			}
 			continue;
 		}
 
@@ -844,6 +853,7 @@ static int __noreturn rcu_tasks_kthread(void *arg)
 			list = next;
 			cond_resched();
 		}
+		schedule_timeout_uninterruptible(HZ/10);
 	}
 }
 
-- 
1.8.1.5


  parent reply	other threads:[~2014-07-28 22:57 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-28 22:55 [PATCH tip/core/rcu 0/9] RCU-tasks implementation Paul E. McKenney
2014-07-28 22:56 ` [PATCH RFC tip/core/rcu 1/9] rcu: Add call_rcu_tasks() Paul E. McKenney
2014-07-28 22:56   ` [PATCH RFC tip/core/rcu 2/9] rcu: Provide cond_resched_rcu_qs() to force quiescent states in long loops Paul E. McKenney
2014-07-29  7:55     ` Peter Zijlstra
2014-07-29 16:22       ` Paul E. McKenney
2014-07-29 17:25         ` Peter Zijlstra
2014-07-29 17:33           ` Paul E. McKenney
2014-07-29 17:36             ` Peter Zijlstra
2014-07-29 17:37               ` Peter Zijlstra
2014-07-29 17:55                 ` Paul E. McKenney
2014-07-28 22:56   ` [PATCH RFC tip/core/rcu 3/9] rcu: Add synchronous grace-period waiting for RCU-tasks Paul E. McKenney
2014-07-28 22:56   ` [PATCH RFC tip/core/rcu 4/9] rcu: Export RCU-tasks APIs to GPL modules Paul E. McKenney
2014-07-28 22:56   ` [PATCH RFC tip/core/rcu 5/9] rcutorture: Add torture tests for RCU-tasks Paul E. McKenney
2014-07-28 22:56   ` [PATCH RFC tip/core/rcu 6/9] rcutorture: Add RCU-tasks test cases Paul E. McKenney
2014-07-28 22:56   ` [PATCH RFC tip/core/rcu 7/9] rcu: Add stall-warning checks for RCU-tasks Paul E. McKenney
2014-07-28 22:56   ` [PATCH RFC tip/core/rcu 8/9] rcu: Make RCU-tasks track exiting tasks Paul E. McKenney
2014-07-30 17:04     ` Oleg Nesterov
2014-07-30 18:24       ` Paul E. McKenney
2014-07-28 22:56   ` Paul E. McKenney [this message]
2014-07-29  7:50   ` [PATCH RFC tip/core/rcu 1/9] rcu: Add call_rcu_tasks() Peter Zijlstra
2014-07-29 15:57     ` Paul E. McKenney
2014-07-29 16:07       ` Peter Zijlstra
2014-07-29 16:33         ` Paul E. McKenney
2014-07-29 17:31           ` Peter Zijlstra
2014-07-29 18:19             ` Paul E. McKenney
2014-07-29 19:25               ` Peter Zijlstra
2014-07-29 20:11                 ` Paul E. McKenney
2014-07-29  8:12   ` Peter Zijlstra
2014-07-29 16:36     ` Paul E. McKenney
2014-07-29  8:12   ` Peter Zijlstra
2014-07-29  8:14   ` Peter Zijlstra
2014-07-29 17:23     ` Paul E. McKenney
2014-07-29 17:33       ` Peter Zijlstra
2014-07-29 18:06         ` Paul E. McKenney
2014-07-30 13:23           ` Mike Galbraith
2014-07-30 14:23             ` Paul E. McKenney
2014-07-31  7:37               ` Mike Galbraith
2014-07-31 16:38                 ` Paul E. McKenney
2014-08-01  2:59                   ` Mike Galbraith
2014-08-01 15:16                     ` Paul E. McKenney
2014-07-30  6:52   ` Lai Jiangshan
2014-07-30 15:07     ` Paul E. McKenney
2014-07-30 13:41   ` Frederic Weisbecker
2014-07-30 16:10     ` Paul E. McKenney
2014-07-30 15:49   ` Oleg Nesterov
2014-07-30 16:08     ` Paul E. McKenney

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1406588180-21933-9-git-send-email-paulmck@linux.vnet.ibm.com \
    --to=paulmck@linux.vnet.ibm.com \
    --cc=akpm@linux-foundation.org \
    --cc=bobby.prani@gmail.com \
    --cc=dhowells@redhat.com \
    --cc=dipankar@in.ibm.com \
    --cc=dvhart@linux.intel.com \
    --cc=edumazet@google.com \
    --cc=fweisbec@gmail.com \
    --cc=josh@joshtriplett.org \
    --cc=laijs@cn.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=mingo@kernel.org \
    --cc=oleg@redhat.com \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).