Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

tick/nohz: Update obsolete comments

Some comments are obsolete enough to assume that IRQ exit restarts the
tick in idle or RCU is turned on at the same time as the tick, among
other details.

Update them and add more.

Signed-off-by: Frederic Weisbecker <frederic@kernel.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/r/20230912104406.312185-3-frederic@kernel.org

authored by

Frederic Weisbecker and committed by
Thomas Gleixner
822deeed dba428a6

+36 -10
+36 -10
kernel/time/tick-sched.c
··· 1175 1175 } 1176 1176 1177 1177 /** 1178 - * tick_nohz_irq_exit - update next tick event from interrupt exit 1178 + * tick_nohz_irq_exit - Notify the tick about IRQ exit 1179 1179 * 1180 - * When an interrupt fires while we are idle and it doesn't cause 1181 - * a reschedule, it may still add, modify or delete a timer, enqueue 1182 - * an RCU callback, etc... 1183 - * So we need to re-calculate and reprogram the next tick event. 1180 + * A timer may have been added/modified/deleted either by the current IRQ, 1181 + * or by another place using this IRQ as a notification. This IRQ may have 1182 + * also updated the RCU callback list. These events may require a 1183 + * re-evaluation of the next tick. Depending on the context: 1184 + * 1185 + * 1) If the CPU is idle and no resched is pending, just proceed with idle 1186 + * time accounting. The next tick will be re-evaluated on the next idle 1187 + * loop iteration. 1188 + * 1189 + * 2) If the CPU is nohz_full: 1190 + * 1191 + * 2.1) If there is any tick dependency, restart the tick if stopped. 1192 + * 1193 + * 2.2) If there is no tick dependency, (re-)evaluate the next tick and 1194 + * stop/update it accordingly. 1184 1195 */ 1185 1196 void tick_nohz_irq_exit(void) 1186 1197 { ··· 1341 1330 } 1342 1331 1343 1332 /** 1344 - * tick_nohz_idle_exit - restart the idle tick from the idle task 1333 + * tick_nohz_idle_exit - Update the tick upon idle task exit 1345 1334 * 1346 - * Restart the idle tick when the CPU is woken up from idle 1347 - * This also exit the RCU extended quiescent state. The CPU 1348 - * can use RCU again after this function is called. 1335 + * When the idle task exits, update the tick depending on the 1336 + * following situations: 1337 + * 1338 + * 1) If the CPU is not in nohz_full mode (most cases), then 1339 + * restart the tick. 1340 + * 1341 + * 2) If the CPU is in nohz_full mode (corner case): 1342 + * 2.1) If the tick can be kept stopped (no tick dependencies) 1343 + * then re-eavaluate the next tick and try to keep it stopped 1344 + * as long as possible. 1345 + * 2.2) If the tick has dependencies, restart the tick. 1346 + * 1349 1347 */ 1350 1348 void tick_nohz_idle_exit(void) 1351 1349 { ··· 1384 1364 } 1385 1365 1386 1366 /* 1387 - * The nohz low res interrupt handler 1367 + * In low-resolution mode, the tick handler must be implemented directly 1368 + * at the clockevent level. hrtimer can't be used instead because its 1369 + * infrastructure actually relies on the tick itself as a backend in 1370 + * low-resolution mode (see hrtimer_run_queues()). 1371 + * 1372 + * This low-resolution handler still makes use of some hrtimer APIs meanwhile 1373 + * for commodity with expiration calculation and forwarding. 1388 1374 */ 1389 1375 static void tick_nohz_lowres_handler(struct clock_event_device *dev) 1390 1376 {