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.

sched_ext: Minor cleanups to scx_task_iter

- Use memset() in scx_task_iter_start() instead of zeroing fields individually.

- In scx_task_iter_next(), move __scx_task_iter_maybe_relock() after the batch
check which is simpler.

- Update comment to reflect that tasks are removed from scx_tasks when dead
(commit 7900aa699c34 ("sched_ext: Fix cgroup exit ordering by moving
sched_ext_free() to finish_task_switch()")).

No functional changes.

Signed-off-by: Tejun Heo <tj@kernel.org>

Tejun Heo d723f36e 023af03c

+5 -6
+5 -6
kernel/sched/ext.c
··· 470 470 * RCU read lock or obtaining a reference count. 471 471 * 472 472 * All tasks which existed when the iteration started are guaranteed to be 473 - * visited as long as they still exist. 473 + * visited as long as they are not dead. 474 474 */ 475 475 static void scx_task_iter_start(struct scx_task_iter *iter) 476 476 { 477 + memset(iter, 0, sizeof(*iter)); 478 + 477 479 spin_lock_irq(&scx_tasks_lock); 478 480 479 481 iter->cursor = (struct sched_ext_entity){ .flags = SCX_TASK_CURSOR }; 480 482 list_add(&iter->cursor.tasks_node, &scx_tasks); 481 - iter->locked_task = NULL; 482 - iter->cnt = 0; 483 483 iter->list_locked = true; 484 484 } 485 485 ··· 545 545 struct list_head *cursor = &iter->cursor.tasks_node; 546 546 struct sched_ext_entity *pos; 547 547 548 - __scx_task_iter_maybe_relock(iter); 549 - 550 548 if (!(++iter->cnt % SCX_TASK_ITER_BATCH)) { 551 549 scx_task_iter_unlock(iter); 552 550 cond_resched(); 553 - __scx_task_iter_maybe_relock(iter); 554 551 } 552 + 553 + __scx_task_iter_maybe_relock(iter); 555 554 556 555 list_for_each_entry(pos, cursor, tasks_node) { 557 556 if (&pos->tasks_node == &scx_tasks)