Re: [PATCH] sched: prevent getting too much vruntime

From: Peter Zijlstra
Date: Wed Nov 11 2015 - 04:26:57 EST

On Wed, Nov 11, 2015 at 05:50:27PM +0900, byungchul.park@xxxxxxx wrote:

I've not actually read anything; my brain isn't working right today.

> +static inline void vruntime_unnormalize(struct cfs_rq *cfs_rq, struct sched_entity *se)
> +{
> + se->vruntime += cfs_rq->min_vruntime;
> + if (unlikely((s64)se->vruntime < 0))
> + se->vruntime = 0;
> +}

But this is broken. This simply _cannot_ be right.

vruntime very much needs to wrap in u64 space. While regular time in ns
takes some 584 year to wrap, vruntime is scaled. The fastest vruntime is
2/1024 or 512 times faster than normal time. Making it take just over a
year to wrap around. This will happen.

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at