From: Arjan van de Ven <arjan@infradead.org>
To: Arjan van de Ven <arjan@infradead.org>,
Peter Zijlstra <peterz@infradead.org>
Cc: mingo@elte.hu, linux-kernel@vger.kernel.org
Subject: [PATCH 2/3] sched: Add aggressive load balancing for certain situations
Date: Sat, 24 Oct 2009 13:04:32 -0700 [thread overview]
Message-ID: <20091024130432.0c46ef27@infradead.org> (raw)
In-Reply-To: <20091024125853.35143117@infradead.org>
Subject: sched: Add aggressive load balancing for certain situations
From: Arjan van de Ven <arjan@linux.intel.com>
The scheduler, in it's "find idlest group" function currently has an unconditional
threshold for an imbalance, before it will consider moving a task.
However, there are situations where this is undesireable, and we want to opt in to a
more aggressive load balancing algorithm to minimize latencies.
This patch adds the infrastructure for this and also adds two cases for which
we select the aggressive approach
1) From interrupt context. Events that happen in irq context are very likely,
as a heuristic, to show latency sensitive behavior
2) When doing a wake_up() and the scheduler domain we're investigating has the
flag set that opts in to load balancing during wake_up()
(for example the SMT/HT domain)
Signed-off-by: Arjan van de Ven <arjan@linux.intel.com>
diff --git a/kernel/sched_fair.c b/kernel/sched_fair.c
index 4e777b4..fe9b95b 100644
--- a/kernel/sched_fair.c
+++ b/kernel/sched_fair.c
@@ -1246,7 +1246,7 @@ static int wake_affine(struct sched_domain *sd, struct task_struct *p, int sync)
*/
static struct sched_group *
find_idlest_group(struct sched_domain *sd, struct task_struct *p,
- int this_cpu, int load_idx)
+ int this_cpu, int load_idx, int agressive)
{
struct sched_group *idlest = NULL, *this = NULL, *group = sd->groups;
unsigned long min_load = ULONG_MAX, this_load = 0;
@@ -1290,7 +1290,9 @@ find_idlest_group(struct sched_domain *sd, struct task_struct *p,
}
} while (group = group->next, group != sd->groups);
- if (!idlest || 100*this_load < imbalance*min_load)
+ if (!idlest)
+ return NULL;
+ if (!agressive && 100*this_load < imbalance*min_load)
return NULL;
return idlest;
}
@@ -1412,6 +1414,7 @@ static int select_task_rq_fair(struct task_struct *p, int sd_flag, int wake_flag
int load_idx = sd->forkexec_idx;
struct sched_group *group;
int weight;
+ int agressive;
if (!(sd->flags & sd_flag)) {
sd = sd->child;
@@ -1421,7 +1424,13 @@ static int select_task_rq_fair(struct task_struct *p, int sd_flag, int wake_flag
if (sd_flag & SD_BALANCE_WAKE)
load_idx = sd->wake_idx;
- group = find_idlest_group(sd, p, cpu, load_idx);
+ agressive = 0;
+ if (in_irq())
+ agressive = 1;
+ if (sd_flag & SD_BALANCE_WAKE)
+ agressive = 1;
+
+ group = find_idlest_group(sd, p, cpu, load_idx, agressive);
if (!group) {
sd = sd->child;
continue;
--
Arjan van de Ven Intel Open Source Technology Centre
For development, discussion and tips for power savings,
visit http://www.lesswatts.org
next prev parent reply other threads:[~2009-10-24 20:03 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-10-24 19:58 [PATCH 1/3] sched: Enable wake balancing for the SMT/HT domain Arjan van de Ven
2009-10-24 20:04 ` Arjan van de Ven [this message]
2009-10-24 20:07 ` [PATCH 3/3] sched: Disable affine wakeups by default Arjan van de Ven
2009-10-25 6:55 ` Mike Galbraith
2009-10-25 16:51 ` Arjan van de Ven
2009-10-25 17:38 ` Mike Galbraith
2009-10-25 19:33 ` Arjan van de Ven
2009-10-25 22:04 ` Mike Galbraith
2009-10-26 1:53 ` Peter Zijlstra
2009-10-26 4:38 ` Mike Galbraith
2009-10-26 4:52 ` Arjan van de Ven
2009-10-26 5:08 ` Mike Galbraith
2009-10-26 5:36 ` Arjan van de Ven
2009-10-26 5:47 ` Mike Galbraith
2009-10-26 5:57 ` Mike Galbraith
2009-10-26 7:01 ` Ingo Molnar
2009-10-26 7:05 ` Arjan van de Ven
2009-10-26 11:33 ` Suresh Siddha
2009-11-10 21:59 ` Peter Zijlstra
2009-11-11 6:01 ` Arjan van de Ven
2009-10-27 14:35 ` Mike Galbraith
2009-10-28 7:25 ` Mike Galbraith
2009-10-28 18:36 ` Mike Galbraith
2009-11-04 19:33 ` [tip:sched/core] sched: Check for an idle shared cache in select_task_rq_fair() tip-bot for Mike Galbraith
2009-11-04 20:37 ` Mike Galbraith
2009-11-04 21:41 ` Mike Galbraith
2009-11-05 9:30 ` Ingo Molnar
2009-11-05 9:57 ` Mike Galbraith
2009-11-05 10:00 ` Mike Galbraith
2009-11-06 7:09 ` [tip:sched/core] sched: Fix affinity logic " tip-bot for Mike Galbraith
2009-10-26 5:21 ` [PATCH 3/3] sched: Disable affine wakeups by default Mike Galbraith
2009-10-25 8:01 ` Peter Zijlstra
2009-10-25 8:01 ` [PATCH 2/3] sched: Add aggressive load balancing for certain situations Peter Zijlstra
2009-10-25 11:48 ` Peter Zijlstra
2009-10-25 8:03 ` [PATCH 1/3] sched: Enable wake balancing for the SMT/HT domain 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=20091024130432.0c46ef27@infradead.org \
--to=arjan@infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=peterz@infradead.org \
/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