hc
2023-12-11 6778948f9de86c3cfaf36725a7c87dcff9ba247f
kernel/include/linux/vtime.h
....@@ -11,11 +11,15 @@
1111 struct task_struct;
1212
1313 /*
14
- * vtime_accounting_cpu_enabled() definitions/declarations
14
+ * vtime_accounting_enabled_this_cpu() definitions/declarations
1515 */
1616 #if defined(CONFIG_VIRT_CPU_ACCOUNTING_NATIVE)
17
-static inline bool vtime_accounting_cpu_enabled(void) { return true; }
17
+
18
+static inline bool vtime_accounting_enabled_this_cpu(void) { return true; }
19
+extern void vtime_task_switch(struct task_struct *prev);
20
+
1821 #elif defined(CONFIG_VIRT_CPU_ACCOUNTING_GEN)
22
+
1923 /*
2024 * Checks if vtime is enabled on some CPU. Cputime readers want to be careful
2125 * in that case and compute the tickless cputime.
....@@ -24,46 +28,43 @@
2428 */
2529 static inline bool vtime_accounting_enabled(void)
2630 {
27
- return context_tracking_is_enabled();
31
+ return context_tracking_enabled();
2832 }
2933
30
-static inline bool vtime_accounting_cpu_enabled(void)
34
+static inline bool vtime_accounting_enabled_cpu(int cpu)
3135 {
32
- if (vtime_accounting_enabled()) {
33
- if (context_tracking_cpu_is_enabled())
34
- return true;
35
- }
36
-
37
- return false;
36
+ return context_tracking_enabled_cpu(cpu);
3837 }
39
-#else /* !CONFIG_VIRT_CPU_ACCOUNTING */
40
-static inline bool vtime_accounting_cpu_enabled(void) { return false; }
41
-#endif
4238
39
+static inline bool vtime_accounting_enabled_this_cpu(void)
40
+{
41
+ return context_tracking_enabled_this_cpu();
42
+}
43
+
44
+extern void vtime_task_switch_generic(struct task_struct *prev);
45
+
46
+static inline void vtime_task_switch(struct task_struct *prev)
47
+{
48
+ if (vtime_accounting_enabled_this_cpu())
49
+ vtime_task_switch_generic(prev);
50
+}
51
+
52
+#else /* !CONFIG_VIRT_CPU_ACCOUNTING */
53
+
54
+static inline bool vtime_accounting_enabled_cpu(int cpu) {return false; }
55
+static inline bool vtime_accounting_enabled_this_cpu(void) { return false; }
56
+static inline void vtime_task_switch(struct task_struct *prev) { }
57
+
58
+#endif
4359
4460 /*
4561 * Common vtime APIs
4662 */
4763 #ifdef CONFIG_VIRT_CPU_ACCOUNTING
48
-
49
-#ifdef __ARCH_HAS_VTIME_TASK_SWITCH
50
-extern void vtime_task_switch(struct task_struct *prev);
51
-#else
52
-extern void vtime_common_task_switch(struct task_struct *prev);
53
-static inline void vtime_task_switch(struct task_struct *prev)
54
-{
55
- if (vtime_accounting_cpu_enabled())
56
- vtime_common_task_switch(prev);
57
-}
58
-#endif /* __ARCH_HAS_VTIME_TASK_SWITCH */
59
-
60
-extern void vtime_account_system(struct task_struct *tsk);
64
+extern void vtime_account_kernel(struct task_struct *tsk);
6165 extern void vtime_account_idle(struct task_struct *tsk);
62
-
6366 #else /* !CONFIG_VIRT_CPU_ACCOUNTING */
64
-
65
-static inline void vtime_task_switch(struct task_struct *prev) { }
66
-static inline void vtime_account_system(struct task_struct *tsk) { }
67
+static inline void vtime_account_kernel(struct task_struct *tsk) { }
6768 #endif /* !CONFIG_VIRT_CPU_ACCOUNTING */
6869
6970 #ifdef CONFIG_VIRT_CPU_ACCOUNTING_GEN
....@@ -86,7 +87,7 @@
8687 static inline void vtime_account_irq_exit(struct task_struct *tsk)
8788 {
8889 /* On hard|softirq exit we always account to hard|softirq cputime */
89
- vtime_account_system(tsk);
90
+ vtime_account_kernel(tsk);
9091 }
9192 extern void vtime_flush(struct task_struct *tsk);
9293 #else /* !CONFIG_VIRT_CPU_ACCOUNTING_NATIVE */