mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Nikhil Rao <ncrao@google.com>
To: Ingo Molnar <mingo@elte.hu>,
	Peter Zijlstra <peterz@infradead.org>,
	Mike Galbraith <efault@gmx.de>,
	linux-kernel@vger.kernel.org
Cc: Venkatesh Pallipadi <venki@google.com>,
	Ken Chen <kenchen@google.com>, Paul Turner <pjt@google.com>,
	Nikhil Rao <ncrao@google.com>
Subject: [PATCH 1/6] sched: account SCHED_IDLE tasks on rq->idle_nr_running
Date: Thu, 29 Jul 2010 22:19:01 -0700	[thread overview]
Message-ID: <1280467146-32218-2-git-send-email-ncrao@google.com> (raw)
In-Reply-To: <1280467146-32218-1-git-send-email-ncrao@google.com>

Account SCHED_IDLE tasks on rq->idle_nr_running in addition to rq->nr_running.
This is a preparatory patch for the SCHED_IDLE load balancer.

Signed-off-by: Nikhil Rao <ncrao@google.com>
---
 kernel/sched.c |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/kernel/sched.c b/kernel/sched.c
index f52a880..26e74e9 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -456,6 +456,7 @@ struct rq {
 	unsigned long nr_running;
 	#define CPU_LOAD_IDX_MAX 5
 	unsigned long cpu_load[CPU_LOAD_IDX_MAX];
+	unsigned long idle_nr_running;
 #ifdef CONFIG_NO_HZ
 	u64 nohz_stamp;
 	unsigned char in_nohz_recently;
@@ -1838,6 +1839,16 @@ static void dec_nr_running(struct rq *rq)
 	rq->nr_running--;
 }
 
+static void inc_idle_nr_running(struct rq *rq)
+{
+	rq->idle_nr_running++;
+}
+
+static void dec_idle_nr_running(struct rq *rq)
+{
+	rq->idle_nr_running--;
+}
+
 static void set_load_weight(struct task_struct *p)
 {
 	if (task_has_rt_policy(p)) {
@@ -1885,6 +1896,8 @@ static void activate_task(struct rq *rq, struct task_struct *p, int flags)
 
 	enqueue_task(rq, p, flags);
 	inc_nr_running(rq);
+	if (p->policy == SCHED_IDLE)
+		inc_idle_nr_running(rq);
 }
 
 /*
@@ -1897,6 +1910,8 @@ static void deactivate_task(struct rq *rq, struct task_struct *p, int flags)
 
 	dequeue_task(rq, p, flags);
 	dec_nr_running(rq);
+	if (p->policy == SCHED_IDLE)
+		dec_idle_nr_running(rq);
 }
 
 #include "sched_idletask.c"
-- 
1.7.1


  reply	other threads:[~2010-07-30  5:19 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-30  5:19 [PATCH 0/6] [RFC] Large weight differential leads to inefficient load balancing Nikhil Rao
2010-07-30  5:19 ` Nikhil Rao [this message]
2010-07-30  5:19 ` [PATCH 2/6] sched: add SD_IDLE_LOAD_BALANCE to sched domain flags Nikhil Rao
2010-07-30  5:19 ` [PATCH 3/6] sched: add moving average of time spent servicing SCHED_NORMAL tasks Nikhil Rao
2010-07-30  5:19 ` [PATCH 4/6] sched: add sched_idle_balance argument to lb functions Nikhil Rao
2010-07-30  5:19 ` [PATCH 5/6] sched: add SCHED_IDLE load balancer Nikhil Rao
2010-07-30  5:19 ` [PATCH 6/6] sched: enable SD_IDLE_LOAD_BALANCE on MC, CPU and NUMA (x86) domains Nikhil Rao
2010-07-30 13:32 ` [PATCH 0/6] [RFC] Large weight differential leads to inefficient load balancing Mike Galbraith
2010-07-30 18:59   ` Nikhil Rao
2010-07-30 19:03   ` Paul Turner
2010-08-02 11:39 ` Peter Zijlstra
2010-08-03 21:28   ` Nikhil Rao
2010-08-04 10:18     ` Peter Zijlstra

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=1280467146-32218-2-git-send-email-ncrao@google.com \
    --to=ncrao@google.com \
    --cc=efault@gmx.de \
    --cc=kenchen@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=peterz@infradead.org \
    --cc=pjt@google.com \
    --cc=venki@google.com \
    /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

all inboxes | Powered by JetHome®