How can I make cgroup cpu quota and task priority work together without cpuset?

From: 王志强
Date: Wed Oct 26 2022 - 06:30:00 EST



Hi~!


I am not sure whether this has been raised before:
I have two tasks with different priorities, and I set those two task into
a cpu cgroup with cpu_quota equal to cpu_period, hence the two tasks
would only use up 1 cpu core at most,  and the node has multi-cores.
But it turn out cpu cgroup dose not take process priority into
consideration, what I got is that when the task with higher priority
need cpu resources, it would only take 50% if the task with lower
priority is scheduled on another cpu, while the expectation would be >90%.
The problem could be solved if I assign a cpu core statically to those two tasks via cpuset cgroup.....
Is there other solution for this? 

If those two tasks would be scheduled on same cpu anytime, not necessarily
on the same cpu during each scheduling period, it would be enough.
I tried PR_SCHED_CORE prctl, but no luck.


I think this issue is typical when moving from VM to container,  an API
in kernel which would bind a group of task together during scheduling
would be nice, or better if cpu cgroup could take priority into account?




Thanks
David