ANDROID: Add vendorhooks to enable sched_ext in OGKI kernel.

As discussed in 401436689, Add some vendor hooks to facilitate
enabling sched_ext in subsequent OGKI kernels.

For the newly added android_vh_task_should_scx in kernel/sched/core.c,
we decided to switch all rt tasks to ext. In fact, this is not a
risky attempt. We have already done this in our released products
(hmbird scheduler), and it works well.

The concept of this hook is not to raise the priority of sched_ext
above RT, but to let sched_ext manage all tasks. Inside sched_ext,
we will still give the original rt task a very high priority and
regroup the priority of rt. The grouping basis may be heavy rt,
light rt, user experience related rt, kernel rt, etc., and make
some scheduling distinctions. At the same time, the main reason
for incorporating rt into sched_ext management is that we can
easily do core ctrl, task aggregation, task placement, interaction
with the idle system, and targeted frequency adjustment (if there
is a stable expectation for the execution of tasks on the CPU,
frequency adjustment will be easier).

Bug: 401436689

Change-Id: I78321c918e03ff28a2c74c668e86436c0e416d66
Signed-off-by: Dao Huang <huangdao1@oppo.com>
[jstultz: Slightly tweaked commit message]
Signed-off-by: John Stultz <jstultz@google.com>
This commit is contained in:
Dao Huang
2025-03-13 16:08:01 +08:00
committed by John Stultz
parent 4e4406d77c
commit 58ac22a089
4 changed files with 74 additions and 7 deletions
+22
View File
@@ -385,6 +385,28 @@ DECLARE_RESTRICTED_HOOK(android_rvh_set_task_comm,
TP_PROTO(struct task_struct *tsk, bool exec),
TP_ARGS(tsk, exec), 1);
DECLARE_HOOK(android_vh_task_should_scx,
TP_PROTO(int *should_scx, int policy, int prio),
TP_ARGS(should_scx, policy, prio));
DECLARE_HOOK(android_vh_scx_ops_consider_migration,
TP_PROTO(bool *consider_migration),
TP_ARGS(consider_migration));
DECLARE_HOOK(android_vh_scx_fix_prev_slice,
TP_PROTO(struct task_struct *p),
TP_ARGS(p));
DECLARE_HOOK(android_vh_scx_ops_enable_state,
TP_PROTO(int state),
TP_ARGS(state));
DECLARE_HOOK(android_vh_scx_enabled,
TP_PROTO(int enabled),
TP_ARGS(enabled));
DECLARE_HOOK(android_vh_scx_set_cpus_allowed,
TP_PROTO(struct task_struct *p, struct affinity_context *ac, int *done),
TP_ARGS(p, ac, done));
DECLARE_HOOK(android_vh_scx_task_switch_finish,
TP_PROTO(struct task_struct *p, int enable),
TP_ARGS(p, enable));
struct sugov_policy;
DECLARE_RESTRICTED_HOOK(android_rvh_set_sugov_update,
TP_PROTO(struct sugov_policy *sg_policy, unsigned int next_freq, bool *should_update),