Commit 14c1da3
committed
sched_ext: Allocate scx_kick_cpus_pnt_seqs lazily using kvzalloc()
On systems with >4096 CPUs, scx_kick_cpus_pnt_seqs allocation fails during
boot because it exceeds the 32,768 byte percpu allocator limit.
Restructure to use DEFINE_PER_CPU() for the per-CPU pointers, with each CPU
pointing to its own kvzalloc'd array. Move allocation from boot time to
scx_enable() and free in scx_disable(), so the O(nr_cpu_ids^2) memory is only
consumed when sched_ext is active.
Use RCU to guard against racing with free. Arrays are freed via call_rcu()
and kick_cpus_irq_workfn() uses rcu_dereference_bh() with a NULL check.
While at it, rename to scx_kick_pseqs for brevity and update comments to
clarify these are pick_task sequence numbers.
v2: RCU protect scx_kick_seqs to manage kick_cpus_irq_workfn() racing
against disable as per Andrea.
v3: Fix bugs notcied by Andrea.
Reported-by: Phil Auld <pauld@redhat.com>
Link: http://lkml.kernel.org/r/20251007133523.GA93086@pauld.westford.csb
Cc: Andrea Righi <arighi@nvidia.com>
Reviewed-by: Emil Tsalapatis <emil@etsalapatis.com>
Reviewed-by: Phil Auld <pauld@redhat.com>
Reviewed-by: Andrea Righi <arighi@nvidia.com>
Signed-off-by: Tejun Heo <tj@kernel.org>1 parent a8ad873 commit 14c1da3
1 file changed
+79
-10
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
67 | 67 | | |
68 | 68 | | |
69 | 69 | | |
70 | | - | |
71 | | - | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
72 | 83 | | |
73 | 84 | | |
74 | 85 | | |
| |||
3877 | 3888 | | |
3878 | 3889 | | |
3879 | 3890 | | |
| 3891 | + | |
| 3892 | + | |
| 3893 | + | |
| 3894 | + | |
| 3895 | + | |
| 3896 | + | |
| 3897 | + | |
| 3898 | + | |
| 3899 | + | |
| 3900 | + | |
| 3901 | + | |
| 3902 | + | |
| 3903 | + | |
| 3904 | + | |
| 3905 | + | |
| 3906 | + | |
| 3907 | + | |
| 3908 | + | |
| 3909 | + | |
| 3910 | + | |
| 3911 | + | |
3880 | 3912 | | |
3881 | 3913 | | |
3882 | 3914 | | |
| |||
4013 | 4045 | | |
4014 | 4046 | | |
4015 | 4047 | | |
| 4048 | + | |
4016 | 4049 | | |
4017 | 4050 | | |
4018 | 4051 | | |
| |||
4375 | 4408 | | |
4376 | 4409 | | |
4377 | 4410 | | |
| 4411 | + | |
| 4412 | + | |
| 4413 | + | |
| 4414 | + | |
| 4415 | + | |
| 4416 | + | |
| 4417 | + | |
| 4418 | + | |
| 4419 | + | |
| 4420 | + | |
| 4421 | + | |
| 4422 | + | |
| 4423 | + | |
| 4424 | + | |
| 4425 | + | |
| 4426 | + | |
| 4427 | + | |
| 4428 | + | |
| 4429 | + | |
| 4430 | + | |
| 4431 | + | |
| 4432 | + | |
| 4433 | + | |
| 4434 | + | |
| 4435 | + | |
| 4436 | + | |
| 4437 | + | |
4378 | 4438 | | |
4379 | 4439 | | |
4380 | 4440 | | |
| |||
4517 | 4577 | | |
4518 | 4578 | | |
4519 | 4579 | | |
| 4580 | + | |
| 4581 | + | |
| 4582 | + | |
| 4583 | + | |
4520 | 4584 | | |
4521 | 4585 | | |
4522 | | - | |
| 4586 | + | |
4523 | 4587 | | |
4524 | 4588 | | |
4525 | 4589 | | |
4526 | 4590 | | |
4527 | 4591 | | |
4528 | | - | |
| 4592 | + | |
4529 | 4593 | | |
4530 | 4594 | | |
4531 | 4595 | | |
| |||
4728 | 4792 | | |
4729 | 4793 | | |
4730 | 4794 | | |
| 4795 | + | |
| 4796 | + | |
4731 | 4797 | | |
4732 | 4798 | | |
4733 | 4799 | | |
| |||
5109 | 5175 | | |
5110 | 5176 | | |
5111 | 5177 | | |
5112 | | - | |
| 5178 | + | |
5113 | 5179 | | |
| 5180 | + | |
5114 | 5181 | | |
5115 | 5182 | | |
| 5183 | + | |
| 5184 | + | |
| 5185 | + | |
| 5186 | + | |
| 5187 | + | |
| 5188 | + | |
| 5189 | + | |
5116 | 5190 | | |
5117 | 5191 | | |
5118 | 5192 | | |
| |||
5235 | 5309 | | |
5236 | 5310 | | |
5237 | 5311 | | |
5238 | | - | |
5239 | | - | |
5240 | | - | |
5241 | | - | |
5242 | | - | |
5243 | 5312 | | |
5244 | 5313 | | |
5245 | 5314 | | |
| |||
0 commit comments