Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 69020
b: refs/heads/master
c: 08e2388
h: refs/heads/master
v: v3
  • Loading branch information
Ingo Molnar committed Oct 15, 2007
1 parent b69b9e4 commit 3083bae
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 24 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: 1091985b482fdd577a5c511059b9d7b4467bd15d
refs/heads/master: 08e2388aa1e40cb06f7d04ac621e2ae94e1d8fdc
31 changes: 8 additions & 23 deletions trunk/kernel/sched_fair.c
Original file line number Diff line number Diff line change
Expand Up @@ -397,27 +397,16 @@ update_stats_wait_start(struct cfs_rq *cfs_rq, struct sched_entity *se)
schedstat_set(se->wait_start, rq_of(cfs_rq)->clock);
}

/*
* We calculate fair deltas here, so protect against the random effects
* of a multiplication overflow by capping it to the runtime limit:
*/
#if BITS_PER_LONG == 32
static inline unsigned long
calc_weighted(unsigned long delta, unsigned long weight, int shift)
calc_weighted(unsigned long delta, struct sched_entity *se)
{
u64 tmp = (u64)delta * weight >> shift;
unsigned long weight = se->load.weight;

if (unlikely(tmp > sysctl_sched_runtime_limit*2))
return sysctl_sched_runtime_limit*2;
return tmp;
if (unlikely(weight != NICE_0_LOAD))
return (u64)delta * se->load.weight >> NICE_0_SHIFT;
else
return delta;
}
#else
static inline unsigned long
calc_weighted(unsigned long delta, unsigned long weight, int shift)
{
return delta * weight >> shift;
}
#endif

/*
* Task is being enqueued - update stats:
Expand Down Expand Up @@ -469,9 +458,7 @@ __update_stats_wait_end(struct cfs_rq *cfs_rq, struct sched_entity *se,
schedstat_set(se->wait_max, max(se->wait_max,
rq_of(cfs_rq)->clock - se->wait_start));

if (unlikely(se->load.weight != NICE_0_LOAD))
delta_fair = calc_weighted(delta_fair, se->load.weight,
NICE_0_SHIFT);
delta_fair = calc_weighted(delta_fair, se);

add_wait_runtime(cfs_rq, se, delta_fair);
}
Expand Down Expand Up @@ -554,9 +541,7 @@ static void __enqueue_sleeper(struct cfs_rq *cfs_rq, struct sched_entity *se,
delta_fair = div64_likely32((u64)delta_fair * load,
load + se->load.weight);

if (unlikely(se->load.weight != NICE_0_LOAD))
delta_fair = calc_weighted(delta_fair, se->load.weight,
NICE_0_SHIFT);
delta_fair = calc_weighted(delta_fair, se);

prev_runtime = se->wait_runtime;
__add_wait_runtime(cfs_rq, se, delta_fair);
Expand Down

0 comments on commit 3083bae

Please sign in to comment.