TEST: RFC: Simplify pick_task() and fix selection issue

pick_task() is complex and confusing. Let us add the 0-cookie task
(untagged) to the tag rbtree as well to keep it simple.

This also handles the following "bug" in the existing code as well that
Vineeth brought up in OSPM: Suppose 2 siblings of a core: rq 1 and rq 2.

In priority order (high to low), say we have the tasks:
A - untagged  (rq 1)
B - tagged    (rq 2)
C - untagged  (rq 2)

Say, B and C are in the same scheduling class.

When the pick_next_task() loop runs, it looks at rq 1 and max is A, A is
tenantively selected for rq 1. Then it looks at rq 2 and the class_pick is B.
But that's not compatible with A. So rq 2 gets forced idle.

In reality, rq 2 could have run C instead of idle. The fix is to add C to the
tag tree as Peter suggested in OSPM 2020.

Reported-by: Vineeth Pillai <vpillai@digitalocean.com>
Suggested-by: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: Joel Fernandes (Google) <joel@joelfernandes.org>
Change-Id: I13ecceb7c83fc26826971dee640c6e8c6d03e982
1 file changed