Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 100228
b: refs/heads/master
c: a8a51d5
h: refs/heads/master
v: v3
  • Loading branch information
Peter Zijlstra authored and Ingo Molnar committed Jun 27, 2008
1 parent 95f1c33 commit 9c82462
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 14 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: 039a1c41b3a489e34593ea1e1687f6fdad6b13ab
refs/heads/master: a8a51d5e59561aa5b4d66e19eca819b537783e8f
25 changes: 12 additions & 13 deletions trunk/kernel/sched.c
Original file line number Diff line number Diff line change
Expand Up @@ -554,6 +554,8 @@ struct rq {
int cpu;
int online;

unsigned long avg_load_per_task;

struct task_struct *migration_thread;
struct list_head migration_queue;
#endif
Expand Down Expand Up @@ -1427,9 +1429,18 @@ static inline void dec_cpu_load(struct rq *rq, unsigned long load)
#ifdef CONFIG_SMP
static unsigned long source_load(int cpu, int type);
static unsigned long target_load(int cpu, int type);
static unsigned long cpu_avg_load_per_task(int cpu);
static int task_hot(struct task_struct *p, u64 now, struct sched_domain *sd);

static unsigned long cpu_avg_load_per_task(int cpu)
{
struct rq *rq = cpu_rq(cpu);

if (rq->nr_running)
rq->avg_load_per_task = rq->load.weight / rq->nr_running;

return rq->avg_load_per_task;
}

#ifdef CONFIG_FAIR_GROUP_SCHED

typedef void (*tg_visitor)(struct task_group *, int, struct sched_domain *);
Expand Down Expand Up @@ -2010,18 +2021,6 @@ static unsigned long target_load(int cpu, int type)
return max(rq->cpu_load[type-1], total);
}

/*
* Return the average load per task on the cpu's run queue
*/
static unsigned long cpu_avg_load_per_task(int cpu)
{
struct rq *rq = cpu_rq(cpu);
unsigned long total = weighted_cpuload(cpu);
unsigned long n = rq->nr_running;

return n ? total / n : SCHED_LOAD_SCALE;
}

/*
* find_idlest_group finds and returns the least busy CPU group within the
* domain.
Expand Down

0 comments on commit 9c82462

Please sign in to comment.