mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-06 02:50:49 +09:00
ANDROID: vendor_hooks: add hook account_process_tick_gran
this hook will allow to account tick in every third of more ticks to save cpu time for accounting Bug: 279549765 Change-Id: I5d18e0167fdce076d13aecc653dcf6387bcb25f2 Signed-off-by: Liujie Xie <xieliujie@oppo.com>
This commit is contained in:
committed by
Treehugger Robot
parent
1a40d683e8
commit
ec8c8f6e33
@@ -347,6 +347,10 @@ DECLARE_HOOK(android_vh_sched_setaffinity_early,
|
|||||||
TP_PROTO(struct task_struct *p, const struct cpumask *new_mask, bool *retval),
|
TP_PROTO(struct task_struct *p, const struct cpumask *new_mask, bool *retval),
|
||||||
TP_ARGS(p, new_mask, retval));
|
TP_ARGS(p, new_mask, retval));
|
||||||
|
|
||||||
|
DECLARE_HOOK(android_vh_account_process_tick_gran,
|
||||||
|
TP_PROTO(int user_tick, int *ticks),
|
||||||
|
TP_ARGS(user_tick, ticks));
|
||||||
|
|
||||||
/* macro versions of hooks are no longer required */
|
/* macro versions of hooks are no longer required */
|
||||||
|
|
||||||
#endif /* _TRACE_HOOK_SCHED_H */
|
#endif /* _TRACE_HOOK_SCHED_H */
|
||||||
|
|||||||
@@ -492,23 +492,28 @@ EXPORT_SYMBOL_GPL(thread_group_cputime_adjusted);
|
|||||||
#else /* !CONFIG_VIRT_CPU_ACCOUNTING_NATIVE: */
|
#else /* !CONFIG_VIRT_CPU_ACCOUNTING_NATIVE: */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Account a single tick of CPU time.
|
* Account a single tick or a few ticks of CPU time.
|
||||||
* @p: the process that the CPU time gets accounted to
|
* @p: the process that the CPU time gets accounted to
|
||||||
* @user_tick: indicates if the tick is a user or a system tick
|
* @user_tick: indicates if the tick is a user or a system tick
|
||||||
*/
|
*/
|
||||||
void account_process_tick(struct task_struct *p, int user_tick)
|
void account_process_tick(struct task_struct *p, int user_tick)
|
||||||
{
|
{
|
||||||
u64 cputime, steal;
|
u64 cputime, steal;
|
||||||
|
int ticks = 1;
|
||||||
|
|
||||||
|
trace_android_vh_account_process_tick_gran(user_tick, &ticks);
|
||||||
|
if (!ticks)
|
||||||
|
return;
|
||||||
|
|
||||||
if (vtime_accounting_enabled_this_cpu())
|
if (vtime_accounting_enabled_this_cpu())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (sched_clock_irqtime) {
|
if (sched_clock_irqtime) {
|
||||||
irqtime_account_process_tick(p, user_tick, 1);
|
irqtime_account_process_tick(p, user_tick, ticks);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
cputime = TICK_NSEC;
|
cputime = TICK_NSEC * ticks;
|
||||||
steal = steal_account_process_time(ULONG_MAX);
|
steal = steal_account_process_time(ULONG_MAX);
|
||||||
|
|
||||||
if (steal >= cputime)
|
if (steal >= cputime)
|
||||||
|
|||||||
@@ -89,3 +89,4 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_sched_pelt_multiplier);
|
|||||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_map_util_freq);
|
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_map_util_freq);
|
||||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_set_cpus_allowed_comm);
|
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_set_cpus_allowed_comm);
|
||||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_sched_setaffinity_early);
|
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_sched_setaffinity_early);
|
||||||
|
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_account_process_tick_gran);
|
||||||
|
|||||||
Reference in New Issue
Block a user