Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 54cf84a5 authored by YT Chang's avatar YT Chang Committed by Todd Kjos
Browse files

ANDROID: sched: add restrict vendor hook to modify load balance behavior



For modifying load balance policy, we add the hook on
find_busiest_group().
It allows us to modify load balance paths.

Bug: 168248326
Signed-off-by: default avatarYT Chang <yt.chang@mediatek.com>
Change-Id: I77ec043576139806551b978eb1bdf9f637442dfb
(cherry picked from commit a2ca8408de6183364b4c17f341f06e875bc7a1c1)
(cherry picked from commit 489646b879ede582b6b00803edd3f777aede4d85)
parent 42a391fe
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -62,3 +62,4 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_printk_store);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_show_regs);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_wq_lockup_pool);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_sysrq_crash);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_find_busiest_group);
 No newline at end of file
+6 −0
Original line number Diff line number Diff line
@@ -65,6 +65,11 @@ DECLARE_RESTRICTED_HOOK(android_rvh_set_user_nice,
DECLARE_RESTRICTED_HOOK(android_rvh_setscheduler,
	TP_PROTO(struct task_struct *p),
	TP_ARGS(p), 1);

struct sched_group;
DECLARE_RESTRICTED_HOOK(android_rvh_find_busiest_group,
	TP_PROTO(struct sched_group *busiest, struct rq *dst_rq, int *out_balance),
		TP_ARGS(busiest, dst_rq, out_balance), 1);
#else
#define trace_android_rvh_select_task_rq_fair(p, prev_cpu, sd_flag, wake_flags, new_cpu)
#define trace_android_rvh_select_task_rq_rt(p, prev_cpu, sd_flag, wake_flags, new_cpu)
@@ -79,6 +84,7 @@ DECLARE_RESTRICTED_HOOK(android_rvh_setscheduler,
#define trace_android_rvh_rtmutex_prepare_setprio(p, pi_task)
#define trace_android_rvh_set_user_nice(p, nice)
#define trace_android_rvh_setscheduler(p)
#define trace_android_rvh_find_busiest_group(busiest, dst_rq, out_balance)
#endif
#endif /* _TRACE_HOOK_SCHED_H */
/* This part must be outside protection */
+5 −1
Original line number Diff line number Diff line
@@ -8736,8 +8736,12 @@ static struct sched_group *find_busiest_group(struct lb_env *env)

	if (sched_energy_enabled()) {
		struct root_domain *rd = env->dst_rq->rd;
		int out_balance = 1;

		if (rcu_dereference(rd->pd) && !READ_ONCE(rd->overutilized))
		trace_android_rvh_find_busiest_group(sds.busiest, env->dst_rq,
					&out_balance);
		if (rcu_dereference(rd->pd) && !READ_ONCE(rd->overutilized)
					&& out_balance)
			goto out_balanced;
	}