diff options
Diffstat (limited to 'kernel/sched/sched.h')
-rw-r--r-- | kernel/sched/sched.h | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h index ef5a1ff65196..99589411f980 100644 --- a/kernel/sched/sched.h +++ b/kernel/sched/sched.h @@ -365,7 +365,7 @@ struct rq { /* time-based average load */ u64 nr_last_stamp; - unsigned int ave_nr_running; + u64 nr_running_integral; seqcount_t ave_seqcnt; /* capture load from *all* tasks on this cpu: */ @@ -924,32 +924,26 @@ static inline void cpuacct_charge(struct task_struct *tsk, u64 cputime) {} * 25 ~= 33554432ns = 33.5ms * 24 ~= 16777216ns = 16.8ms */ -#define NR_AVE_PERIOD_EXP 27 #define NR_AVE_SCALE(x) ((x) << FSHIFT) -#define NR_AVE_PERIOD (1 << NR_AVE_PERIOD_EXP) -#define NR_AVE_DIV_PERIOD(x) ((x) >> NR_AVE_PERIOD_EXP) -static inline unsigned int do_avg_nr_running(struct rq *rq) + +static inline u64 do_nr_running_integral(struct rq *rq) { s64 nr, deltax; - unsigned int ave_nr_running = rq->ave_nr_running; + u64 nr_running_integral = rq->nr_running_integral; deltax = rq->clock_task - rq->nr_last_stamp; nr = NR_AVE_SCALE(rq->nr_running); - if (deltax > NR_AVE_PERIOD) - ave_nr_running = nr; - else - ave_nr_running += - NR_AVE_DIV_PERIOD(deltax * (nr - ave_nr_running)); + nr_running_integral += nr * deltax; - return ave_nr_running; + return nr_running_integral; } static inline void inc_nr_running(struct rq *rq) { write_seqcount_begin(&rq->ave_seqcnt); - rq->ave_nr_running = do_avg_nr_running(rq); + rq->nr_running_integral = do_nr_running_integral(rq); rq->nr_last_stamp = rq->clock_task; rq->nr_running++; write_seqcount_end(&rq->ave_seqcnt); @@ -958,7 +952,7 @@ static inline void inc_nr_running(struct rq *rq) static inline void dec_nr_running(struct rq *rq) { write_seqcount_begin(&rq->ave_seqcnt); - rq->ave_nr_running = do_avg_nr_running(rq); + rq->nr_running_integral = do_nr_running_integral(rq); rq->nr_last_stamp = rq->clock_task; rq->nr_running--; write_seqcount_end(&rq->ave_seqcnt); |