sched-ext / scx

sched_ext schedulers and tools
https://bit.ly/scx_slack
GNU General Public License v2.0
844 stars 79 forks source link

bpfland: loop optimization and logical redundancy elimination #636

Closed firelzrd closed 3 weeks ago

firelzrd commented 3 weeks ago

Trying to reduce some of the logical redundancy and code amount, while maintaining readability and simpleness. cpumasks bound to respective cache levels {p, l2, l3}, dsq_ids for each of the global DSQs {preferred, shared} are now arrays, and can be iterated using loop syntax.

firelzrd commented 3 weeks ago

Comments were added. Thank you for the suggestion. I am still tackling the program won't-start issue.

firelzrd commented 3 weeks ago

I see that the eBPF verifier for some reason turns a pointer into a scalar value while copy operations from an array to another. And operations like bpf_cpumask_and and others starts to fail, since the pointer is no longer a pointer, even if it's stored in struct bpf_cpumask*. That's what I found out so far. And this makes me crazy. Let me think about how to sort this out.

firelzrd commented 3 weeks ago

It seems that currently there's no good way to make it consider as a pointer instead of a scalar when using an array of pointer. So I'm closing this PR for now. Thanks for your time!