LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: "Siddha, Suresh B" <suresh.b.siddha@intel.com>
To: mingo@elte.hu
Cc: linux-kernel@vger.kernel.org, npiggin@suse.de, rostedt@goodmis.org
Subject: [patch 1/2] sched: fix idle load balancing in softirqd context
Date: Fri, 16 Feb 2007 18:03:35 -0800 [thread overview]
Message-ID: <20070216180335.A8744@unix-os.sc.intel.com> (raw)
In-Reply-To: <20070130135709.B32010@unix-os.sc.intel.com>; from suresh.b.siddha@intel.com on Tue, Jan 30, 2007 at 01:57:09PM -0800
Periodic load balancing in recent kernels happen in the softirq.
In certain -rt configurations, these softirqs are handled in softirqd
context. And hence the check for idle processor was always returning
busy (as nr_running > 1).
This patch captures the idle information at the tick and passes this info
to softirq context through an element 'idle_at_tick' in rq.
Signed-off-by: Suresh Siddha <suresh.b.siddha@intel.com>
---
diff -pNru linux-2.6.20.x86_64/kernel/sched.c linux/kernel/sched.c
--- linux-2.6.20.x86_64/kernel/sched.c 2007-02-10 03:41:27.000000000 -0800
+++ linux/kernel/sched.c 2007-02-16 16:22:44.000000000 -0800
@@ -240,6 +240,7 @@ struct rq {
unsigned long raw_weighted_load;
#ifdef CONFIG_SMP
unsigned long cpu_load[3];
+ unsigned char idle_at_tick;
#endif
unsigned long long nr_switches;
@@ -3350,12 +3351,7 @@ static void run_rebalance_domains(struct
struct rq *this_rq = cpu_rq(this_cpu);
unsigned long interval;
struct sched_domain *sd;
- /*
- * We are idle if there are no processes running. This
- * is valid even if we are the idle process (SMT).
- */
- enum idle_type idle = !this_rq->nr_running ?
- SCHED_IDLE : NOT_IDLE;
+ enum idle_type idle = this_rq->idle_at_tick ? SCHED_IDLE : NOT_IDLE;
/* Earliest time when we have to call run_rebalance_domains again */
unsigned long next_balance = jiffies + 60*HZ;
@@ -3651,20 +3647,21 @@ void scheduler_tick(void)
{
unsigned long long now = sched_clock();
struct task_struct *p = current;
- int cpu = smp_processor_id();
+ int cpu = smp_processor_id(), idle_at_tick = idle_cpu(cpu);
struct rq *rq = cpu_rq(cpu);
BUG_ON(!irqs_disabled());
update_cpu_clock(p, rq, now);
- if (p == rq->idle)
+ if (idle_at_tick)
/* Task on the idle queue */
wake_priority_sleeper(rq);
else
task_running_tick(rq, p);
#ifdef CONFIG_SMP
update_load(rq);
+ rq->idle_at_tick = idle_at_tick;
if (time_after_eq(jiffies, rq->next_balance))
raise_softirq(SCHED_SOFTIRQ);
#endif
next prev parent reply other threads:[~2007-02-17 2:38 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-12-11 23:53 [RFC] Patch: dynticks: idle load balancing Siddha, Suresh B
2006-12-13 22:43 ` Ingo Molnar
2006-12-13 23:13 ` Ingo Molnar
2006-12-13 23:03 ` Siddha, Suresh B
2006-12-13 23:31 ` Ingo Molnar
2006-12-13 23:19 ` Siddha, Suresh B
2006-12-14 0:34 ` Ingo Molnar
2006-12-19 20:12 ` Ingo Molnar
2006-12-19 21:12 ` Siddha, Suresh B
2007-01-16 11:35 ` Ingo Molnar
2007-01-30 21:57 ` Siddha, Suresh B
2007-02-07 22:19 ` Siddha, Suresh B
2007-02-17 2:03 ` Siddha, Suresh B [this message]
2007-02-17 2:08 ` [patch 2/2] sched: dynticks idle load balancing - v2 Siddha, Suresh B
2007-02-21 20:23 ` Andrew Morton
2007-02-22 3:14 ` Nick Piggin
2007-02-24 2:01 ` [patch] sched: dynticks idle load balancing - v3 Siddha, Suresh B
2007-02-22 3:26 ` [patch 2/2] sched: dynticks idle load balancing - v2 Nick Piggin
2007-02-22 22:33 ` Siddha, Suresh B
2007-02-23 3:43 ` Nick Piggin
2007-02-17 14:42 ` [patch 1/2] sched: fix idle load balancing in softirqd context Steven Rostedt
2007-02-21 6:25 ` Siddha, Suresh B
2007-02-21 20:13 ` Andrew Morton
2006-12-13 23:48 ` [RFC] Patch: dynticks: idle load balancing Ingo Molnar
2006-12-20 0:49 ` Steven Rostedt
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=20070216180335.A8744@unix-os.sc.intel.com \
--to=suresh.b.siddha@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=npiggin@suse.de \
--cc=rostedt@goodmis.org \
--subject='Re: [patch 1/2] sched: fix idle load balancing in softirqd context' \
/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
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).