[RFC] scx_rusty: Perform task migration immediately #994
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
According to #611, the load balancer produce new domain id into "lb_data" for every load balancing period, however, sometimes these tasks isn't going to be scheduled in the coming scheduling period. So there will be no task migration actually performed.
Utilize BPF_PROG_TYPE_SYSCALL so the load balancer can update the task context's domain right away and transfer related information between push domain and pull domain immediately.
The implementation still has some points to be considered.
dom_active_tptrs
has some problems , according to scx_rusty: Temporary fix of duplicate active tptr #941 , we should re-design the structure and keep it synchronized with each load balancing decision. Oncedom_active_tptrs
is always up-to-date, the tasks information in userspace can be easily keep up, and should be safe to regeneratedom.tasks
each time.(Personally , I think we should fix the problem of
dom_active_tptrs
first, as it will eventually need to be synchronize with task migrations. )Test
( Test cases and metrics to be considered might not be enough coverage now, please let me know if you have any suggestions or ideas, I'll be happy to add more tests to verify everything. )
The test is done on AMD Ryzen 7 5700X3D 8-Core Processor , architecture is x86_64
Kernel Compilation workload
We ran the rusty scheduler with the following command
Take kernel compilation as a test workload, the number of migration and the total time of kernel compilation needed is shown below
And the total kernel compilation time
After the change, the stats are shown below
While kernel compilation time shrink alittle, we can observe that the number of migrations has been decreased alot, which implies that the migration operation is more effective to decrease the load unbalance situation between domains, so the load balancer wouldn't have to perform so many useless operation.
Stress test
Run the rusty scheduler ( collect metrics every 50 secs )
Test the change with stress-ng
The metrics result shown below
It performs almost the same with and without the change for heavy workload on every cores.
Related Issue
#611