mirror of https://github.com/OpenIPC/firmware.git
74 lines
1.8 KiB
Diff
74 lines
1.8 KiB
Diff
diff -drupN a/kernel/sched/cputime.c b/kernel/sched/cputime.c
|
|
--- a/kernel/sched/cputime.c 2018-08-06 17:23:04.000000000 +0300
|
|
+++ b/kernel/sched/cputime.c 2022-06-12 05:28:14.000000000 +0300
|
|
@@ -4,11 +4,12 @@
|
|
#include <linux/kernel_stat.h>
|
|
#include <linux/static_key.h>
|
|
#include <linux/context_tracking.h>
|
|
+#include <linux/cpufreq_times.h>
|
|
#include "sched.h"
|
|
#ifdef CONFIG_PARAVIRT
|
|
#include <asm/paravirt.h>
|
|
#endif
|
|
-
|
|
+#include "walt.h"
|
|
|
|
#ifdef CONFIG_IRQ_TIME_ACCOUNTING
|
|
|
|
@@ -46,11 +47,18 @@ void irqtime_account_irq(struct task_str
|
|
struct irqtime *irqtime = this_cpu_ptr(&cpu_irqtime);
|
|
s64 delta;
|
|
int cpu;
|
|
+#ifdef CONFIG_SCHED_WALT
|
|
+ u64 wallclock;
|
|
+ bool account = true;
|
|
+#endif
|
|
|
|
if (!sched_clock_irqtime)
|
|
return;
|
|
|
|
cpu = smp_processor_id();
|
|
+#ifdef CONFIG_SCHED_WALT
|
|
+ wallclock = sched_clock_cpu(cpu);
|
|
+#endif
|
|
delta = sched_clock_cpu(cpu) - irqtime->irq_start_time;
|
|
irqtime->irq_start_time += delta;
|
|
|
|
@@ -65,8 +73,16 @@ void irqtime_account_irq(struct task_str
|
|
irqtime->hardirq_time += delta;
|
|
else if (in_serving_softirq() && curr != this_cpu_ksoftirqd())
|
|
irqtime->softirq_time += delta;
|
|
+#ifdef CONFIG_SCHED_WALT
|
|
+ else
|
|
+ account = false;
|
|
+#endif
|
|
|
|
u64_stats_update_end(&irqtime->sync);
|
|
+#ifdef CONFIG_SCHED_WALT
|
|
+ if (account)
|
|
+ walt_account_irqtime(cpu, curr, delta, wallclock);
|
|
+#endif
|
|
}
|
|
EXPORT_SYMBOL_GPL(irqtime_account_irq);
|
|
|
|
@@ -147,6 +163,9 @@ void account_user_time(struct task_struc
|
|
|
|
/* Account for user time used */
|
|
acct_account_cputime(p);
|
|
+
|
|
+ /* Account power usage for user time */
|
|
+ cpufreq_acct_update_power(p, cputime);
|
|
}
|
|
|
|
/*
|
|
@@ -197,6 +216,9 @@ void __account_system_time(struct task_s
|
|
|
|
/* Account for system time used */
|
|
acct_account_cputime(p);
|
|
+
|
|
+ /* Account power usage for system time */
|
|
+ cpufreq_acct_update_power(p, cputime);
|
|
}
|
|
|
|
/*
|