History

sched/kcpustat: Introduce vtime-aware kcpustat accessor for CPUTIME_SYSTEM

Kcpustat is not correctly supported on nohz_full CPUs. The tick doesn't fire and the cputime therefore doesn't move forward. The issue has shown up after the vanishing of the remaining 1Hz which has made the stall visible. We are solving that with checking the task running on a CPU through RCU and reading its vtime delta that we add to the raw kcpustat values. We make sure that we fetch a coherent raw-kcpustat/vtime-delta couple sequence while checking that the CPU referred by the target vtime is the correct one, under the locked vtime seqcount. Only CPUTIME_SYSTEM is handled here as a start because it's the trivial case. User and guest time will require more preparation work to correctly handle niceness.

Frederic Weisbecker committed 7 years ago

Commit 64eea631 parent 023e9de2 files · +93 −0Browse files

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

Unified · Split

include/linux/kernel_stat.h+11−0
@@ -78,6 +78,17 @@ static inline unsigned int kstat_cpu_irqs_sum(unsigned int cpu) · 77 unmodified lines
7878 return kstat_cpu(cpu).irqs_sum;
7979 }
8080
81+#ifdef CONFIG_VIRT_CPU_ACCOUNTING_GEN
82+extern u64 kcpustat_field(struct kernel_cpustat *kcpustat,
83+ enum cpu_usage_stat usage, int cpu);
84+#else
85+static inline u64 kcpustat_field(struct kernel_cpustat *kcpustat,
86+ enum cpu_usage_stat usage, int cpu)
87+{
88+ return kcpustat->cpustat[usage];
89+}
90+#endif
91+
8192 extern void account_user_time(struct task_struct *, u64);
8293 extern void account_guest_time(struct task_struct *, u64);
8394 extern void account_system_time(struct task_struct *, int, u64);

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