Thread (41 messages) 41 messages, 8 authors, 2026-02-25

Re: [PATCH 09/15] tick/sched: Move dyntick-idle cputime accounting to cputime code

From: Frederic Weisbecker <frederic@kernel.org>
Date: 2026-01-19 22:08:41
Also in: linux-s390, linuxppc-dev, lkml

Le Mon, Jan 19, 2026 at 03:35:52PM +0100, Peter Zijlstra a écrit :
On Fri, Jan 16, 2026 at 03:52:02PM +0100, Frederic Weisbecker wrote:
quoted
+static void kcpustat_idle_stop(struct kernel_cpustat *kc, ktime_t now)
 {
+	u64 *cpustat = kc->cpustat;
+	ktime_t delta;
+
+	if (!kc->idle_elapse)
+		return;
+
+	delta = ktime_sub(now, kc->idle_entrytime);
+
+	write_seqcount_begin(&kc->idle_sleeptime_seq);
+	if (nr_iowait_cpu(smp_processor_id()) > 0)
+		cpustat[CPUTIME_IOWAIT] = ktime_add(cpustat[CPUTIME_IOWAIT], delta);
+	else
+		cpustat[CPUTIME_IDLE] = ktime_add(cpustat[CPUTIME_IDLE], delta);
+
+	kc->idle_entrytime = now;
+	kc->idle_elapse = false;
+	write_seqcount_end(&kc->idle_sleeptime_seq);
 }
I realize this is mostly code movement; but do we really want to
preserve ktime_{sub,add}() and all that?

I mean, we killed that 32bit ktime nonsense ages ago.
Good point, this should just be u64.

Thanks!

-- 
Frederic Weisbecker
SUSE Labs
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help