lkml.org 
[lkml]   [2013]   [Nov]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC][PATCH v5 07/14] sched: get CPU's activity statistic
On Fri, Oct 18, 2013 at 01:52:20PM +0200, Vincent Guittot wrote:
> +static int get_cpu_activity(int cpu)
> +{
> + struct rq *rq = cpu_rq(cpu);
> + u32 sum = rq->avg.runnable_avg_sum;
> + u32 period = rq->avg.runnable_avg_period;
> +
> + sum = min(sum, period);
> +
> + if (sum == period) {
> + u32 overload = rq->nr_running > 1 ? 1 : 0;
> + return available_of(cpu) + overload;
> + }
> +
> + return (sum * available_of(cpu)) / period;

I'm thinking this has a fair potential to overflow our u32, no?

> +}


\
 
 \ /
  Last update: 2013-11-12 12:21    [W:1.384 / U:0.444 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site