This allows us to check if a remote CPU runs vtime accounting (ie: is nohz_full). We'll need that to reliably support reading kcpustat on nohz_full CPUs. Also simplify a bit the condition in the local flavoured function while at it.
Showing the changes to include/linux (1 of 1 file). Show all
Unified · Split
| @@ -31,14 +31,14 @@ static inline bool vtime_accounting_enabled(void) · 30 unmodified lines | ||
| 31 | 31 | return context_tracking_enabled(); |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | −static inline bool vtime_accounting_enabled_this_cpu(void) | |
| 34 | +static inline bool vtime_accounting_enabled_cpu(int cpu) | |
| 35 | 35 | { |
| 36 | − if (vtime_accounting_enabled()) { | |
| 37 | − if (context_tracking_enabled_this_cpu()) | |
| 38 | − return true; | |
| 39 | − } | |
| 36 | + return (vtime_accounting_enabled() && context_tracking_enabled_cpu(cpu)); | |
| 37 | +} | |
| 40 | 38 | |
| 41 | − return false; | |
| 39 | +static inline bool vtime_accounting_enabled_this_cpu(void) | |
| 40 | +{ | |
| 41 | + return (vtime_accounting_enabled() && context_tracking_enabled_this_cpu()); | |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | extern void vtime_task_switch_generic(struct task_struct *prev); |
| @@ -51,6 +51,7 @@ static inline void vtime_task_switch(struct task_struct *prev) · 6 unmodified lines | ||
| 51 | 51 | |
| 52 | 52 | #else /* !CONFIG_VIRT_CPU_ACCOUNTING */ |
| 53 | 53 | |
| 54 | +static inline bool vtime_accounting_enabled_cpu(int cpu) {return false; } | |
| 54 | 55 | static inline bool vtime_accounting_enabled_this_cpu(void) { return false; } |
| 55 | 56 | static inline void vtime_task_switch(struct task_struct *prev) { } |
| 56 | 57 | |