[cores/sched] Refactor scheduling class assignment

The assignment of a task scheduling class depends on its priority as well
as the user-defined policy. So far, if a task has not RT priority it always
gets the CFS scheduling class assigned.


This patch makes the scheduling class assignment more modular by checking
RT priority as well as (eventually) the user-defined scheduling policy.
Thus it prepares the ground to add different scheduling policies in
between the RT and CFS ones.

Signed-off-by: Patrick Bellasi <derkling@gmail.com>
[core/sched/cbs] Add CBS load weight computations

The load weight assigned to tasks managed by the CBS policy are computed
similar to CFS class.

Signed-off-by: Patrick Bellasi <derkling@gmail.com>
[core/sched/cbs] Add SCHED_CBS policy to core scheduler

Tasks with a SCHED_CBS policy are allowed to fork and the CBS scheduling
class is assigned to them.

Signed-off-by: Patrick Bellasi <derkling@gmail.com>
BP2 ad3ee00 - [cores/sched] Refactor scheduling class assignment

Signed-off-by: Patrick Bellasi <derkling@gmail.com>
[core/sched/cbs] Bugfix SE references

SE data related to CBS managed tasks are hosted by the task_struct.cbs
structure. This patch fixes some typos or incorrect references.

Signed-off-by: Patrick Bellasi <derkling@gmail.com>
[core/sched/cbs] Bugfix HEAD enqueue enforcing

New (ready to run) SE _must_ be enqueued at the list head according to the
current round scheduling implementation.

Signed-off-by: Patrick Bellasi <derkling@gmail.com>
[core/sched/cbs] Bugfix SE put/pick on sched_class changes

Once the RQ of a running task is changed we should consider the case of
such a task entering the CBS scheduler.
In that case, the task has not been scheduler for execution by the CBS
thus it is safer to request a new rescheduling to properly trigger the
CBS policy.

These changes are triggered so far by
- core::rt_mutex_setptio
- core::__sched_setscheduler
- core::sched_move_task
with all of them using this pattern:
1. put_prev_task
2. // updated scheduler and/or RQ
3. set_curr_task
4. enqueue_task

This patch provides this support:
A. trigger a rescheduling once a _running_ SE enter a CBS RQ
   => this allows the CBS policy to get control on the execution of this
      task and other RQ siblings
B. put just previously CBS scheduled entities
   indeed, if a running task is moved into CBS there is not need to stop
   and put the CBS entity

Thus, each time we enter the run_cbs_entity_stop and put_prev_cbs_entity
we are granted to being putting a previously CBS scheduled entity.

Signed-off-by: Patrick Bellasi <derkling@gmail.com>
[core/sched/cbs] Use a more safe consistency check

Signed-off-by: Patrick Bellasi <derkling@gmail.com>
[core/sched/cbs] Add a set of consistency checks

These checks adds a run-time overhead and some of them could be removed
once the CBS scheduler has been proved to be reasonably stable.

Signed-off-by: Patrick Bellasi <derkling@gmail.com>