ANDROID: sched: add vendor hook in find_new_ilb

Add new vendor hook to find new ilb cpu for power tuning.

We also set ilb initial is -1 by this patch, and we set ilb
as nr_cpu_ids by our vendor when ilb cpu not be found.

If ilb initial is 0, then when hook is not registered,
find ilb will return CPU 0.
But when hook is not registered, it should do for_each_cpu_and()
to find best ilb cpu, instead of return CPU 0 direct.

So we set ilb initial is -1, it means anyone doesn't register the hook
or the registered hook doesn't do anything, instead of ilb cpu not
be found by vendor.

Bug: 264821176
Change-Id: Idb5a8bd5862f7dd1fa30fa99aec3b42214375915
Signed-off-by: Jing-Ting Wu <Jing-Ting.Wu@mediatek.com>
This commit is contained in:
Jing-Ting Wu
2023-01-09 14:42:39 +08:00
committed by Treehugger Robot
parent 272cf01f5e
commit 81ebefd895
3 changed files with 10 additions and 1 deletions

View File

@@ -325,6 +325,10 @@ DECLARE_HOOK(android_vh_set_wake_flags,
TP_PROTO(int *wake_flags, unsigned int *mode),
TP_ARGS(wake_flags, mode));
DECLARE_RESTRICTED_HOOK(android_rvh_find_new_ilb,
TP_PROTO(struct cpumask *nohz_idle_cpus_mask, int *ilb),
TP_ARGS(nohz_idle_cpus_mask, ilb), 1);
/* macro versions of hooks are no longer required */
#endif /* _TRACE_HOOK_SCHED_H */

View File

@@ -10887,9 +10887,13 @@ static inline int on_null_domain(struct rq *rq)
static inline int find_new_ilb(void)
{
int ilb;
int ilb = -1;
const struct cpumask *hk_mask;
trace_android_rvh_find_new_ilb(nohz.idle_cpus_mask, &ilb);
if (ilb >= 0)
return ilb;
hk_mask = housekeeping_cpumask(HK_TYPE_MISC);
for_each_cpu_and(ilb, nohz.idle_cpus_mask, hk_mask) {

View File

@@ -84,3 +84,4 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_update_topology_flags_workfn);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_update_thermal_stats);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_do_wake_up_sync);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_set_wake_flags);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_find_new_ilb);