Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 211990
b: refs/heads/master
c: aa48380
h: refs/heads/master
v: v3
  • Loading branch information
Venkatesh Pallipadi authored and Ingo Molnar committed Oct 18, 2010
1 parent 966eaa6 commit ca4afbe
Show file tree
Hide file tree
Showing 4 changed files with 31 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: 305e6835e05513406fa12820e40e4a8ecb63743c
refs/heads/master: aa483808516ca5cacfa0e5849691f64fec25828e
18 changes: 18 additions & 0 deletions trunk/kernel/sched.c
Original file line number Diff line number Diff line change
Expand Up @@ -519,6 +519,10 @@ struct rq {
u64 avg_idle;
#endif

#ifdef CONFIG_IRQ_TIME_ACCOUNTING
u64 prev_irq_time;
#endif

/* calc_load related fields */
unsigned long calc_load_update;
long calc_load_active;
Expand Down Expand Up @@ -643,6 +647,7 @@ static inline struct task_group *task_group(struct task_struct *p)
#endif /* CONFIG_CGROUP_SCHED */

static u64 irq_time_cpu(int cpu);
static void sched_irq_time_avg_update(struct rq *rq, u64 irq_time);

inline void update_rq_clock(struct rq *rq)
{
Expand All @@ -654,6 +659,8 @@ inline void update_rq_clock(struct rq *rq)
irq_time = irq_time_cpu(cpu);
if (rq->clock - irq_time > rq->clock_task)
rq->clock_task = rq->clock - irq_time;

sched_irq_time_avg_update(rq, irq_time);
}
}

Expand Down Expand Up @@ -1985,13 +1992,24 @@ void account_system_vtime(struct task_struct *curr)
local_irq_restore(flags);
}

static void sched_irq_time_avg_update(struct rq *rq, u64 curr_irq_time)
{
if (sched_clock_irqtime && sched_feat(NONIRQ_POWER)) {
u64 delta_irq = curr_irq_time - rq->prev_irq_time;
rq->prev_irq_time = curr_irq_time;
sched_rt_avg_update(rq, delta_irq);
}
}

#else

static u64 irq_time_cpu(int cpu)
{
return 0;
}

static void sched_irq_time_avg_update(struct rq *rq, u64 curr_irq_time) { }

#endif

#include "sched_idletask.c"
Expand Down
8 changes: 7 additions & 1 deletion trunk/kernel/sched_fair.c
Original file line number Diff line number Diff line change
Expand Up @@ -2275,7 +2275,13 @@ unsigned long scale_rt_power(int cpu)
u64 total, available;

total = sched_avg_period() + (rq->clock - rq->age_stamp);
available = total - rq->rt_avg;

if (unlikely(total < rq->rt_avg)) {
/* Ensures that power won't end up being negative */
available = 0;
} else {
available = total - rq->rt_avg;
}

if (unlikely((s64)total < SCHED_LOAD_SCALE))
total = SCHED_LOAD_SCALE;
Expand Down
5 changes: 5 additions & 0 deletions trunk/kernel/sched_features.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,8 @@ SCHED_FEAT(ASYM_EFF_LOAD, 1)
* release the lock. Decreases scheduling overhead.
*/
SCHED_FEAT(OWNER_SPIN, 1)

/*
* Decrement CPU power based on irq activity
*/
SCHED_FEAT(NONIRQ_POWER, 1)

0 comments on commit ca4afbe

Please sign in to comment.