Round_jiffies and apiround_jiffies on the kernel scheduled mechanism API
Round_jiffies on the kernel timing mechanism API
Unsigned long _ round_jiffies (unsigned long j, int cpu) The user converts jiffies to an integer multiple of HZ, that is, the whole second. source code analysis: unsigned long _ round_jiffies (unsigned long j, int cpu) {return round_jiffies_common (j, cpu, false);} static unsigned long round_jiffies_common (unsigned long j, int cpu, bool force_up) {int rem; unsigned long original = j; j + = cpu * 3; rem = j % HZ; # force_up here is false, therefore, the rem <HZ/4 is decomposed here to determine whether it is round_down or round_upif (rem < HZ/4 &&! Force_up)/* round down */j = j-rem; else/* round up */j = j-rem + HZ;/* now that we have rounded, subtract the extra skew again */j-= cpu * 3;/** Make sure j is still in the future. otherwise return the * unmodified value. */# Check whether the current jiffies is faster than the parameter j. Generally, it should not. Therefore, the jreturn time_is_after_jiffies (j) after round is returned here )? J: original;} the larger the number of CPUs, the larger the value returned by this function.