Blame view
include/linux/vtime.h
3.58 KB
dcbf832e5 vtime: Gather vti... |
1 2 |
#ifndef _LINUX_KERNEL_VTIME_H #define _LINUX_KERNEL_VTIME_H |
b04934061 vtime: Optimize f... |
3 |
#include <linux/context_tracking_state.h> |
a5725ac23 vtime: Describe o... |
4 5 6 |
#ifdef CONFIG_VIRT_CPU_ACCOUNTING_NATIVE #include <asm/vtime.h> #endif |
b04934061 vtime: Optimize f... |
7 |
|
dcbf832e5 vtime: Gather vti... |
8 |
struct task_struct; |
b04934061 vtime: Optimize f... |
9 |
/* |
55dbdcfa0 sched/cputime: Re... |
10 |
* vtime_accounting_cpu_enabled() definitions/declarations |
b04934061 vtime: Optimize f... |
11 |
*/ |
8612f17ab sched/cputime: Re... |
12 |
#if defined(CONFIG_VIRT_CPU_ACCOUNTING_NATIVE) |
55dbdcfa0 sched/cputime: Re... |
13 |
static inline bool vtime_accounting_cpu_enabled(void) { return true; } |
8612f17ab sched/cputime: Re... |
14 |
#elif defined(CONFIG_VIRT_CPU_ACCOUNTING_GEN) |
e59253946 sched/cputime: In... |
15 16 17 18 19 20 21 22 23 24 |
/* * Checks if vtime is enabled on some CPU. Cputime readers want to be careful * in that case and compute the tickless cputime. * For now vtime state is tied to context tracking. We might want to decouple * those later if necessary. */ static inline bool vtime_accounting_enabled(void) { return context_tracking_is_enabled(); } |
55dbdcfa0 sched/cputime: Re... |
25 |
static inline bool vtime_accounting_cpu_enabled(void) |
b04934061 vtime: Optimize f... |
26 |
{ |
e59253946 sched/cputime: In... |
27 |
if (vtime_accounting_enabled()) { |
d0df09ebf context_tracking:... |
28 |
if (context_tracking_cpu_is_enabled()) |
b04934061 vtime: Optimize f... |
29 30 31 32 33 |
return true; } return false; } |
8612f17ab sched/cputime: Re... |
34 |
#else /* !CONFIG_VIRT_CPU_ACCOUNTING */ |
55dbdcfa0 sched/cputime: Re... |
35 |
static inline bool vtime_accounting_cpu_enabled(void) { return false; } |
8612f17ab sched/cputime: Re... |
36 |
#endif |
b04934061 vtime: Optimize f... |
37 38 39 40 41 |
/* * Common vtime APIs */ |
dcbf832e5 vtime: Gather vti... |
42 |
#ifdef CONFIG_VIRT_CPU_ACCOUNTING |
b04934061 vtime: Optimize f... |
43 44 |
#ifdef __ARCH_HAS_VTIME_TASK_SWITCH |
dcbf832e5 vtime: Gather vti... |
45 |
extern void vtime_task_switch(struct task_struct *prev); |
b04934061 vtime: Optimize f... |
46 47 48 49 |
#else extern void vtime_common_task_switch(struct task_struct *prev); static inline void vtime_task_switch(struct task_struct *prev) { |
55dbdcfa0 sched/cputime: Re... |
50 |
if (vtime_accounting_cpu_enabled()) |
b04934061 vtime: Optimize f... |
51 52 53 |
vtime_common_task_switch(prev); } #endif /* __ARCH_HAS_VTIME_TASK_SWITCH */ |
dcbf832e5 vtime: Gather vti... |
54 |
extern void vtime_account_system(struct task_struct *tsk); |
fd25b4c2f vtime: Remove the... |
55 |
extern void vtime_account_idle(struct task_struct *tsk); |
bcebdf846 vtime: Explicitly... |
56 |
extern void vtime_account_user(struct task_struct *tsk); |
3f4724ea8 cputime: Allow dy... |
57 |
|
3f4724ea8 cputime: Allow dy... |
58 |
#else /* !CONFIG_VIRT_CPU_ACCOUNTING */ |
6a61671bb cputime: Safely r... |
59 |
|
dcbf832e5 vtime: Gather vti... |
60 |
static inline void vtime_task_switch(struct task_struct *prev) { } |
11113334d vtime: Make vtime... |
61 |
static inline void vtime_account_system(struct task_struct *tsk) { } |
abf917cd9 cputime: Generic ... |
62 |
static inline void vtime_account_user(struct task_struct *tsk) { } |
b04934061 vtime: Optimize f... |
63 |
#endif /* !CONFIG_VIRT_CPU_ACCOUNTING */ |
abf917cd9 cputime: Generic ... |
64 65 |
#ifdef CONFIG_VIRT_CPU_ACCOUNTING_GEN |
6a61671bb cputime: Safely r... |
66 |
extern void arch_vtime_task_switch(struct task_struct *tsk); |
6a61671bb cputime: Safely r... |
67 |
extern void vtime_user_enter(struct task_struct *tsk); |
b04934061 vtime: Optimize f... |
68 |
|
abf917cd9 cputime: Generic ... |
69 70 71 72 |
static inline void vtime_user_exit(struct task_struct *tsk) { vtime_account_user(tsk); } |
6a61671bb cputime: Safely r... |
73 74 |
extern void vtime_guest_enter(struct task_struct *tsk); extern void vtime_guest_exit(struct task_struct *tsk); |
45eacc692 vtime: Use consis... |
75 |
extern void vtime_init_idle(struct task_struct *tsk, int cpu); |
b04934061 vtime: Optimize f... |
76 |
#else /* !CONFIG_VIRT_CPU_ACCOUNTING_GEN */ |
abf917cd9 cputime: Generic ... |
77 78 |
static inline void vtime_user_enter(struct task_struct *tsk) { } static inline void vtime_user_exit(struct task_struct *tsk) { } |
6a61671bb cputime: Safely r... |
79 80 |
static inline void vtime_guest_enter(struct task_struct *tsk) { } static inline void vtime_guest_exit(struct task_struct *tsk) { } |
45eacc692 vtime: Use consis... |
81 |
static inline void vtime_init_idle(struct task_struct *tsk, int cpu) { } |
dcbf832e5 vtime: Gather vti... |
82 |
#endif |
8612f17ab sched/cputime: Re... |
83 84 85 86 87 88 89 90 91 92 93 |
#ifdef CONFIG_VIRT_CPU_ACCOUNTING_NATIVE extern void vtime_account_irq_enter(struct task_struct *tsk); static inline void vtime_account_irq_exit(struct task_struct *tsk) { /* On hard|softirq exit we always account to hard|softirq cputime */ vtime_account_system(tsk); } #else /* !CONFIG_VIRT_CPU_ACCOUNTING_NATIVE */ static inline void vtime_account_irq_enter(struct task_struct *tsk) { } static inline void vtime_account_irq_exit(struct task_struct *tsk) { } #endif |
3e1df4f50 cputime: Separate... |
94 95 |
#ifdef CONFIG_IRQ_TIME_ACCOUNTING extern void irqtime_account_irq(struct task_struct *tsk); |
dcbf832e5 vtime: Gather vti... |
96 |
#else |
3e1df4f50 cputime: Separate... |
97 |
static inline void irqtime_account_irq(struct task_struct *tsk) { } |
dcbf832e5 vtime: Gather vti... |
98 |
#endif |
6a61671bb cputime: Safely r... |
99 |
static inline void account_irq_enter_time(struct task_struct *tsk) |
fa5058f3b cputime: Speciali... |
100 |
{ |
6a61671bb cputime: Safely r... |
101 |
vtime_account_irq_enter(tsk); |
3e1df4f50 cputime: Separate... |
102 |
irqtime_account_irq(tsk); |
fa5058f3b cputime: Speciali... |
103 |
} |
6a61671bb cputime: Safely r... |
104 |
static inline void account_irq_exit_time(struct task_struct *tsk) |
fa5058f3b cputime: Speciali... |
105 |
{ |
6a61671bb cputime: Safely r... |
106 |
vtime_account_irq_exit(tsk); |
3e1df4f50 cputime: Separate... |
107 |
irqtime_account_irq(tsk); |
fa5058f3b cputime: Speciali... |
108 |
} |
dcbf832e5 vtime: Gather vti... |
109 |
#endif /* _LINUX_KERNEL_VTIME_H */ |