From: Christoph Lameter <clameter@sgi.com>
To: akpm@osdl.org
Cc: Peter Williams <pwil3058@bigpond.net.au>,
linux-kernel@vger.kernel.org,
Nick Piggin <nickpiggin@yahoo.com.au>,
Christoph Lameter <clameter@sgi.com>,
"Siddha, Suresh B" <suresh.b.siddha@intel.com>,
"Chen, Kenneth W" <kenneth.w.chen@intel.com>,
Ingo Molnar <mingo@elte.hu>,
KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Subject: [PATCH 7/8] Call tasklet less frequently
Date: Tue, 14 Nov 2006 12:33:32 -0800 (PST) [thread overview]
Message-ID: <20061114203332.12761.27463.sendpatchset@schroedinger.engr.sgi.com> (raw)
In-Reply-To: <20061114203256.12761.33911.sendpatchset@schroedinger.engr.sgi.com>
Trigger softirq less frequently
We trigger the softirq before this patch using offset of
sd->interval. However, if the queue is busy then it is sufficient
to schedule the softirq with sd->interval * busy_factor.
So we modify the calculation of the next time to balance by taking
the interval added to last_balance again. This is only the
right value if the idle/busy situation continues as is.
There are two potential trouble spots:
- If the queue was idle and now gets busy then we call rebalance
early. However, that is not a problem because we will then use
the longer interval for the next period.
- If the queue was busy and becomes idle then we potentially
wait too long before rebalancing. However, when the task
goes idle then idle_balance is called. We add another calculation
of the next balance time based on sd->interval in idle_balance
so that we will rebalance soon.
V2->V3:
- Calculate rebalance time based on current jiffies and not
based on the jiffies at the last time we load balanced.
We no longer rely on staggering and therefore we can
affort to do this now.
V3->V4:
- Use functions to do jiffy comparisons.
Signed-off-by: Christoph Lameter <clameter@sgi.com>
Index: linux-2.6.19-rc5-mm1/kernel/sched.c
===================================================================
--- linux-2.6.19-rc5-mm1.orig/kernel/sched.c 2006-11-13 18:11:07.034196836 -0600
+++ linux-2.6.19-rc5-mm1/kernel/sched.c 2006-11-13 19:04:40.316317645 -0600
@@ -2777,14 +2777,28 @@ out_balanced:
static void idle_balance(int this_cpu, struct rq *this_rq)
{
struct sched_domain *sd;
+ int pulled_task = 0;
+ unsigned long next_balance = jiffies + 60 * HZ;
for_each_domain(this_cpu, sd) {
if (sd->flags & SD_BALANCE_NEWIDLE) {
/* If we've pulled tasks over stop searching: */
- if (load_balance_newidle(this_cpu, this_rq, sd))
+ pulled_task = load_balance_newidle(this_cpu,
+ this_rq, sd);
+ if (time_after(next_balance,
+ sd->last_balance + sd->balance_interval))
+ next_balance = sd->last_balance
+ + sd->balance_interval;
+ if (pulled_task)
break;
}
}
+ if (!pulled_task)
+ /*
+ * We are going idle. next_balance may be set based on
+ * a busy processor. So reset next_balance.
+ */
+ this_rq->next_balance = next_balance;
}
/*
@@ -2907,7 +2921,7 @@ static void run_rebalance_domains(struct
*/
idle = NOT_IDLE;
}
- sd->last_balance += interval;
+ sd->last_balance = jiffies;
}
if (time_after(next_balance, sd->last_balance + interval))
next_balance = sd->last_balance + interval;
next prev parent reply other threads:[~2006-11-14 20:35 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-11-14 20:32 [PATCH 0/8] sched_domain balancing via softirq V4 Christoph Lameter
2006-11-14 20:33 ` [PATCH 1/8] Avoid taking rq lock in wake_priority_sleeper Christoph Lameter
2006-11-14 20:33 ` [PATCH 2/8] Remove staggering of load balancing Christoph Lameter
2006-11-14 20:33 ` [PATCH 3/8] Disable interrupts for locking in load_balance() Christoph Lameter
2006-11-14 20:33 ` [PATCH 4/8] Extract load calculation from rebalance_tick Christoph Lameter
2006-11-14 20:33 ` [PATCH 5/8] Move idle status calculation into rebalance_tick() Christoph Lameter
2006-11-14 20:33 ` [PATCH 6/8] Use softirq for load balancing Christoph Lameter
2006-11-14 20:33 ` Christoph Lameter [this message]
2006-11-14 20:33 ` [PATCH 8/8] Add option to serialize " Christoph Lameter
2006-11-14 20:33 ` [DEBUG] Add a few scheduler event counters Christoph Lameter
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=20061114203332.12761.27463.sendpatchset@schroedinger.engr.sgi.com \
--to=clameter@sgi.com \
--cc=akpm@osdl.org \
--cc=kamezawa.hiroyu@jp.fujitsu.com \
--cc=kenneth.w.chen@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=nickpiggin@yahoo.com.au \
--cc=pwil3058@bigpond.net.au \
--cc=suresh.b.siddha@intel.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
Powered by JetHome