History

sched/vtime: Introduce vtime_accounting_enabled_cpu()

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.

Frederic Weisbecker committed 7 years ago

Commit 9adbb9d1 parent e44fcb41 file · +7 −6Browse files

Showing the changes to include/linux (1 of 1 file). Show all

Unified · Split

include/linux/vtime.h+7−6
@@ -31,14 +31,14 @@ static inline bool vtime_accounting_enabled(void) · 30 unmodified lines
3131 return context_tracking_enabled();
3232 }
3333
34−static inline bool vtime_accounting_enabled_this_cpu(void)
34+static inline bool vtime_accounting_enabled_cpu(int cpu)
3535 {
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+}
4038
41− return false;
39+static inline bool vtime_accounting_enabled_this_cpu(void)
40+{
41+ return (vtime_accounting_enabled() && context_tracking_enabled_this_cpu());
4242 }
4343
4444 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
5151
5252 #else /* !CONFIG_VIRT_CPU_ACCOUNTING */
5353
54+static inline bool vtime_accounting_enabled_cpu(int cpu) {return false; }
5455 static inline bool vtime_accounting_enabled_this_cpu(void) { return false; }
5556 static inline void vtime_task_switch(struct task_struct *prev) { }
5657

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t