On Thu, Jul 28, 2022 at 10:55:51AM +0800, Yu Zhe wrote: > 在 2022年07月28日 00:00, Peter Zijlstra 写道: > > > On Wed, Jul 27, 2022 at 11:14:05AM +0800, Yu Zhe wrote: > > > time_is_before_jiffies deals with timer wrapping correctly. > > Please explain how the current code does not. > > 1. If the timer wrap changes in the future you won't have to alter your code. > > 2. unsigned long ut; > > ut = ULONG_MAX + 4; > > printf("time_after(ut, ULONG_MAX), ut:%d, %d --> %d\n", ut, > time_after(ut, ULONG_MAX), (ULONG_MAX - ut) < 0); > > > In this case, time_after returns true, it's correct. Now try the same with the existing code...