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?

> +}
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to