Re: [PATCH v2] sched: Defend cfs and rt bandwidth quota against overflow

From: Peter Zijlstra
Date: Mon May 11 2020 - 09:03:42 EST


On Mon, Apr 27, 2020 at 11:29:30AM -0700, bsegall@xxxxxxxxxx wrote:
> Huaixin Chang <changhuaixin@xxxxxxxxxxxxxxxxx> writes:
>
> > When users write some huge number into cpu.cfs_quota_us or
> > cpu.rt_runtime_us, overflow might happen during to_ratio() shifts of
> > schedulable checks.
> >
> > to_ratio() could be altered to avoid unnecessary internal overflow, but
> > min_cfs_quota_period is less than 1 << BW_SHIFT, so a cutoff would still
> > be needed. Set a cap MAX_BW for cfs_quota_us and rt_runtime_us to
> > prevent overflow.
>
> Reviewed-by: Ben Segall <bsegall@xxxxxxxxxx>

Thanks!