* [PATCH REPOST] [0/3] SCHED: Trivial scheduler fixes
@ 2008-11-15 13:37 Andi Kleen
2008-11-15 13:38 ` [PATCH REPOST] [1/3] SCHED: cache task_hot result Andi Kleen
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Andi Kleen @ 2008-11-15 13:37 UTC (permalink / raw)
To: mingo, peterz, linux-kernel
[I posted this as a four patch series a few days ago.
One of the patches was apparently obsolete in linux-next -- I dropped
that one -- but the others still apply to linux-next as of today.]
This patch series fixes a couple of minor issues I noticed
while reading the scheduler code.
Patches against 2.6.28-rc4
-Andi
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH REPOST] [1/3] SCHED: cache task_hot result
2008-11-15 13:37 [PATCH REPOST] [0/3] SCHED: Trivial scheduler fixes Andi Kleen
@ 2008-11-15 13:38 ` Andi Kleen
2008-11-15 13:38 ` [PATCH REPOST] [2/3] SCHED: Mark all frequently used sysctls __read_mostly Andi Kleen
2008-11-15 13:38 ` [PATCH REPOST] [3/3] SCHED: don't inline idle_balance into schedule() Andi Kleen
2 siblings, 0 replies; 4+ messages in thread
From: Andi Kleen @ 2008-11-15 13:38 UTC (permalink / raw)
To: mingo, peterz, linux-kernel
Minor scheduler optimization: cache the result of task_hot() in
can migrate task instead of computing it three times.
Signed-off-by: Andi Kleen <ak@linux.intel.com>
---
kernel/sched.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
Index: linux-2.6.28-rc4-test/kernel/sched.c
===================================================================
--- linux-2.6.28-rc4-test.orig/kernel/sched.c 2008-11-10 08:50:24.000000000 +0100
+++ linux-2.6.28-rc4-test/kernel/sched.c 2008-11-12 12:32:52.000000000 +0100
@@ -2907,6 +2907,8 @@
struct sched_domain *sd, enum cpu_idle_type idle,
int *all_pinned)
{
+ int hot;
+
/*
* We do not migrate tasks that are:
* 1) running (obviously), or
@@ -2930,10 +2932,11 @@
* 2) too many balance attempts have failed.
*/
- if (!task_hot(p, rq->clock, sd) ||
- sd->nr_balance_failed > sd->cache_nice_tries) {
+ hot = task_hot(p, rq->clock, sd);
+
+ if (!hot || sd->nr_balance_failed > sd->cache_nice_tries) {
#ifdef CONFIG_SCHEDSTATS
- if (task_hot(p, rq->clock, sd)) {
+ if (hot) {
schedstat_inc(sd, lb_hot_gained[idle]);
schedstat_inc(p, se.nr_forced_migrations);
}
@@ -2941,7 +2944,7 @@
return 1;
}
- if (task_hot(p, rq->clock, sd)) {
+ if (hot) {
schedstat_inc(p, se.nr_failed_migrations_hot);
return 0;
}
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH REPOST] [2/3] SCHED: Mark all frequently used sysctls __read_mostly
2008-11-15 13:37 [PATCH REPOST] [0/3] SCHED: Trivial scheduler fixes Andi Kleen
2008-11-15 13:38 ` [PATCH REPOST] [1/3] SCHED: cache task_hot result Andi Kleen
@ 2008-11-15 13:38 ` Andi Kleen
2008-11-15 13:38 ` [PATCH REPOST] [3/3] SCHED: don't inline idle_balance into schedule() Andi Kleen
2 siblings, 0 replies; 4+ messages in thread
From: Andi Kleen @ 2008-11-15 13:38 UTC (permalink / raw)
To: mingo, peterz, linux-kernel
There are more optimizations possible here, but that's for another
patch.
Signed-off-by: Andi Kleen <ak@linux.intel.com>
---
kernel/sched.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
Index: linux-2.6.28-rc4-test/kernel/sched.c
===================================================================
--- linux-2.6.28-rc4-test.orig/kernel/sched.c 2008-11-12 12:32:52.000000000 +0100
+++ linux-2.6.28-rc4-test/kernel/sched.c 2008-11-12 12:52:52.000000000 +0100
@@ -686,7 +686,7 @@
#define SCHED_FEAT(name, enabled) \
(1UL << __SCHED_FEAT_##name) * enabled |
-const_debug unsigned int sysctl_sched_features =
+const_debug unsigned int sysctl_sched_features __read_mostly =
#include "sched_features.h"
0;
@@ -809,26 +809,26 @@
* Number of tasks to iterate in a single balance run.
* Limited because this is done with IRQs disabled.
*/
-const_debug unsigned int sysctl_sched_nr_migrate = 32;
+const_debug unsigned int sysctl_sched_nr_migrate __read_mostly = 32;
/*
* ratelimit for updating the group shares.
* default: 0.25ms
*/
-unsigned int sysctl_sched_shares_ratelimit = 250000;
+unsigned int sysctl_sched_shares_ratelimit __read_mostly = 250000;
/*
* Inject some fuzzyness into changing the per-cpu group shares
* this avoids remote rq-locks at the expense of fairness.
* default: 4
*/
-unsigned int sysctl_sched_shares_thresh = 4;
+unsigned int sysctl_sched_shares_thresh __read_mostly = 4;
/*
* period over which we measure -rt task cpu usage in us.
* default: 1s
*/
-unsigned int sysctl_sched_rt_period = 1000000;
+unsigned int sysctl_sched_rt_period __read_mostly = 1000000;
static __read_mostly int scheduler_running;
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH REPOST] [3/3] SCHED: don't inline idle_balance into schedule()
2008-11-15 13:37 [PATCH REPOST] [0/3] SCHED: Trivial scheduler fixes Andi Kleen
2008-11-15 13:38 ` [PATCH REPOST] [1/3] SCHED: cache task_hot result Andi Kleen
2008-11-15 13:38 ` [PATCH REPOST] [2/3] SCHED: Mark all frequently used sysctls __read_mostly Andi Kleen
@ 2008-11-15 13:38 ` Andi Kleen
2 siblings, 0 replies; 4+ messages in thread
From: Andi Kleen @ 2008-11-15 13:38 UTC (permalink / raw)
To: mingo, peterz, linux-kernel
This function is not called under load, so it makes sense to out of line
it to get better register allocation in schedule() and make the assembler
easier to read.
Signed-off-by: Andi Kleen <ak@linux.intel.com>
---
kernel/sched.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Index: linux-2.6.28-rc4-test/kernel/sched.c
===================================================================
--- linux-2.6.28-rc4-test.orig/kernel/sched.c 2008-11-12 12:52:52.000000000 +0100
+++ linux-2.6.28-rc4-test/kernel/sched.c 2008-11-12 13:07:53.000000000 +0100
@@ -3696,7 +3696,7 @@
* idle_balance is called by schedule() if this_cpu is about to become
* idle. Attempts to pull tasks from other CPUs.
*/
-static void idle_balance(int this_cpu, struct rq *this_rq)
+static void noinline idle_balance(int this_cpu, struct rq *this_rq)
{
struct sched_domain *sd;
int pulled_task = -1;
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2008-11-15 13:39 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-11-15 13:37 [PATCH REPOST] [0/3] SCHED: Trivial scheduler fixes Andi Kleen
2008-11-15 13:38 ` [PATCH REPOST] [1/3] SCHED: cache task_hot result Andi Kleen
2008-11-15 13:38 ` [PATCH REPOST] [2/3] SCHED: Mark all frequently used sysctls __read_mostly Andi Kleen
2008-11-15 13:38 ` [PATCH REPOST] [3/3] SCHED: don't inline idle_balance into schedule() Andi Kleen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox