ANDROID: vendor_hooks: add hook tick_nohz_idle_stop_tick

This hook will allow to stop extra timers that is created during scheduler_tick.
The background is described as follows:
1) In some cases, we find the 4ms tick is not enough for task scheduling so we
will start a new timer in scheduler_tick to do extra task scheduling.
The hook in scheduler_tick already exists but when cpus enter idle, the timer
needs to be stopped for saving power (same logic as nohz idle).
2) We can get about 7% power saving without hurting the performance in certain
use case after enabled this feature.
3) Actually we are considering to upstream it to mainline kernel but it can
takes time to get really merged. An initial submit is preferred to get the
community noticed the potential optimized point.

Bug: 333160399
Change-Id: Ie97599ef562def39e13716adfc7cddef14b72075
Signed-off-by: zhouxuewen <zhouxuewen@oppo.com>
This commit is contained in:
zhouxuewen
2024-04-09 10:51:17 +08:00
committed by Treehugger Robot
parent 0d04e7e6af
commit 480541041d
3 changed files with 6 additions and 0 deletions
+3
View File
@@ -473,6 +473,9 @@ DECLARE_RESTRICTED_HOOK(android_rvh_dequeue_entity_delayed,
TP_PROTO(struct cfs_rq *cfs_rq, struct sched_entity *se, bool *delay),
TP_ARGS(cfs_rq, se, delay), 1);
DECLARE_HOOK(android_vh_tick_nohz_idle_stop_tick,
TP_PROTO(void *unused),
TP_ARGS(unused));
/* macro versions of hooks are no longer required */
#endif /* _TRACE_HOOK_SCHED_H */
+1
View File
@@ -116,6 +116,7 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_update_load_avg_blocked_se);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_update_load_avg_se);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_update_load_avg_cfs_rq);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_update_rt_rq_load_avg_internal);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_tick_nohz_idle_stop_tick);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_map_util_freq);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_reweight_entity);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_sched_move_task);
+2
View File
@@ -1216,6 +1216,8 @@ void tick_nohz_idle_stop_tick(void)
int cpu = smp_processor_id();
ktime_t expires;
trace_android_vh_tick_nohz_idle_stop_tick(NULL);
/*
* If tick_nohz_get_sleep_length() ran tick_nohz_next_event(), the
* tick timer expiration time is known already.