public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCHSET sched_ext/for-6.12-fixes] sched_ext: Fix RCU and other stalls while iterating tasks during enable/disable
@ 2024-10-09 21:40 Tejun Heo
  2024-10-09 21:40 ` [PATCH 1/6] Revert "sched_ext: Use shorter slice while bypassing" Tejun Heo
                   ` (6 more replies)
  0 siblings, 7 replies; 17+ messages in thread
From: Tejun Heo @ 2024-10-09 21:40 UTC (permalink / raw)
  To: void; +Cc: kernel-team, linux-kernel, sched-ext

The enable/disable paths walk all tasks a couple times in bypass mode. There
are a couple problems:

- Bypass mode incorrectly depends on ops.select_cpu() which must not be
  trusted in bypass mode.

- scx_tasks_lock is held while walking all tasks. This can lead to RCU and
  other stalls on a large heavily contended system with many tasks.

Fix the former by always using the default select_cpu() in bypass mode and
the latter by periodically dropping scx_tasks_lock while iterating tasks.

This patchset contains the following patches:

 0001-Revert-sched_ext-Use-shorter-slice-while-bypassing.patch
 0002-sched_ext-Start-schedulers-with-consistent-p-scx.sli.patch
 0003-sched_ext-Move-scx_buildin_idle_enabled-check-to-scx.patch
 0004-sched_ext-bypass-mode-shouldn-t-depend-on-ops.select.patch
 0005-sched_ext-Move-scx_tasks_lock-handling-into-scx_task.patch
 0006-sched_ext-Don-t-hold-scx_tasks_lock-for-too-long.patch

 0001 reverts an unnecessary earlier change.

 0002 makes sure that p->scx.slice is consistent on scheduler load.

 0003-0004 make bypass mode always use the default select_cpu().

 0005-0006 make task iteration drop scx_tasks_lock periodically.

and is also available in the following git branch:

 git://git.kernel.org/pub/scm/linux/kernel/git/tj/sched_ext.git scx-fix-task_iter-stalls

diffstat follows. Thanks.

 kernel/sched/ext.c |  183 +++++++++++++++++++++++++++++++++++++-------------------------------
 1 file changed, 100 insertions(+), 83 deletions(-)

--
tejun

^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2024-10-10 23:39 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-09 21:40 [PATCHSET sched_ext/for-6.12-fixes] sched_ext: Fix RCU and other stalls while iterating tasks during enable/disable Tejun Heo
2024-10-09 21:40 ` [PATCH 1/6] Revert "sched_ext: Use shorter slice while bypassing" Tejun Heo
2024-10-10 17:59   ` David Vernet
2024-10-09 21:40 ` [PATCH 2/6] sched_ext: Start schedulers with consistent p->scx.slice values Tejun Heo
2024-10-10 18:00   ` David Vernet
2024-10-09 21:40 ` [PATCH 3/6] sched_ext: Move scx_buildin_idle_enabled check to scx_bpf_select_cpu_dfl() Tejun Heo
2024-10-09 21:41 ` [PATCH 4/6] sched_ext: bypass mode shouldn't depend on ops.select_cpu() Tejun Heo
2024-10-10 18:15   ` David Vernet
2024-10-10 18:26     ` Tejun Heo
2024-10-10 18:31       ` David Vernet
2024-10-09 21:41 ` [PATCH 5/6] sched_ext: Move scx_tasks_lock handling into scx_task_iter helpers Tejun Heo
2024-10-10 18:36   ` David Vernet
2024-10-09 21:41 ` [PATCH 6/6] sched_ext: Don't hold scx_tasks_lock for too long Tejun Heo
2024-10-10 19:12   ` David Vernet
2024-10-10 21:38     ` Tejun Heo
2024-10-10 23:38       ` Waiman Long
2024-10-10 21:43 ` [PATCHSET sched_ext/for-6.12-fixes] sched_ext: Fix RCU and other stalls while iterating tasks during enable/disable Tejun Heo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox