Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 169893
b: refs/heads/master
c: 1b9508f
h: refs/heads/master
i:
  169891: 8edfd2d
v: v3
  • Loading branch information
Mike Galbraith authored and Ingo Molnar committed Nov 4, 2009
1 parent 16186a6 commit ac569a4
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: a1f84a3ab8e002159498814eaa7e48c33752b04b
refs/heads/master: 1b9508f6831e10d53256825de8904caa22d1ca2c
22 changes: 21 additions & 1 deletion trunk/kernel/sched.c
Original file line number Diff line number Diff line change
Expand Up @@ -589,6 +589,8 @@ struct rq {

u64 rt_avg;
u64 age_stamp;
u64 idle_stamp;
u64 avg_idle;
#endif

/* calc_load related fields */
Expand Down Expand Up @@ -2353,6 +2355,17 @@ static int try_to_wake_up(struct task_struct *p, unsigned int state,
if (rq != orig_rq)
update_rq_clock(rq);

if (rq->idle_stamp) {
u64 delta = rq->clock - rq->idle_stamp;
u64 max = 2*sysctl_sched_migration_cost;

if (delta > max)
rq->avg_idle = max;
else
update_avg(&rq->avg_idle, delta);
rq->idle_stamp = 0;
}

WARN_ON(p->state != TASK_WAKING);
cpu = task_cpu(p);

Expand Down Expand Up @@ -4389,6 +4402,11 @@ static void idle_balance(int this_cpu, struct rq *this_rq)
int pulled_task = 0;
unsigned long next_balance = jiffies + HZ;

this_rq->idle_stamp = this_rq->clock;

if (this_rq->avg_idle < sysctl_sched_migration_cost)
return;

for_each_domain(this_cpu, sd) {
unsigned long interval;

Expand All @@ -4403,8 +4421,10 @@ static void idle_balance(int this_cpu, struct rq *this_rq)
interval = msecs_to_jiffies(sd->balance_interval);
if (time_after(next_balance, sd->last_balance + interval))
next_balance = sd->last_balance + interval;
if (pulled_task)
if (pulled_task) {
this_rq->idle_stamp = 0;
break;
}
}
if (pulled_task || time_after(jiffies, this_rq->next_balance)) {
/*
Expand Down
4 changes: 4 additions & 0 deletions trunk/kernel/sched_debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -285,12 +285,16 @@ static void print_cpu(struct seq_file *m, int cpu)

#ifdef CONFIG_SCHEDSTATS
#define P(n) SEQ_printf(m, " .%-30s: %d\n", #n, rq->n);
#define P64(n) SEQ_printf(m, " .%-30s: %Ld\n", #n, rq->n);

P(yld_count);

P(sched_switch);
P(sched_count);
P(sched_goidle);
#ifdef CONFIG_SMP
P64(avg_idle);
#endif

P(ttwu_count);
P(ttwu_local);
Expand Down

0 comments on commit ac569a4

Please sign in to comment.