On Mon, May 16, 2022 at 04:40:45PM +0800, Chengming Zhou wrote: > When the first iocg activate after blk_iocost_init(), now->vnow > maybe smaller than ioc->margins.target, cause very large vtarget > since it's u64. > > vtarget = now->vnow - ioc->margins.target; > atomic64_add(vtarget - vtime, &iocg->vtime); > > Then the iocg's vtime will be very large too, larger than now->vnow. It's a wrapping counter. Please take a look at how time_before64() and friends work. Nacked-by: Tejun Heo <tj@xxxxxxxxxx> Again, please spend more effort understanding the code before sending these subtle patches. Thanks. -- tejun