[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20130821082801.GL3258@twins.programming.kicks-ass.net>
Date: Wed, 21 Aug 2013 10:28:01 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: Oleg Nesterov <oleg@...hat.com>
Cc: Frederic Weisbecker <fweisbec@...il.com>,
LKML <linux-kernel@...r.kernel.org>,
Fernando Luis Vazquez Cao <fernando_b1@....ntt.co.jp>,
Tetsuo Handa <penguin-kernel@...ove.SAKURA.ne.jp>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...nel.org>,
Andrew Morton <akpm@...ux-foundation.org>,
Arjan van de Ven <arjan@...ux.intel.com>
Subject: Re: [PATCH RESEND 0/4] nohz: Fix racy sleeptime stats
On Tue, Aug 20, 2013 at 08:15:00PM +0200, Oleg Nesterov wrote:
> While at it.
>
> I do not also understand the cpu_online() checks in fs/proc/stat.c.
>
> OK, I agree, if cpu is offline it should not participate in cpu
> summary. But if it goes offline, why it should switch from
> ->iowait_sleeptime + cpustat[CPUTIME_IDLE] as it seen by /proc/stat?
>
> This can be another source of "idle goes backward", no?
>
> IOW. Ignoring the other problems we have, perhaps something like
> below makes sense?
Agreed, however
>
> +++ x/kernel/time/tick-sched.c
> @@ -477,7 +477,7 @@ u64 get_cpu_idle_time_us(int cpu, u64 *l
> update_ts_time_stats(cpu, ts, now, last_update_time);
> idle = ts->idle_sleeptime;
> } else {
> - if (ts->idle_active && !nr_iowait_cpu(cpu)) {
> + if (ts->idle_active && cpu_online(cpu) && !nr_iowait_cpu(cpu)) {
> ktime_t delta = ktime_sub(now, ts->idle_entrytime);
>
> idle = ktime_add(ts->idle_sleeptime, delta);
> @@ -518,7 +518,7 @@ u64 get_cpu_iowait_time_us(int cpu, u64
> update_ts_time_stats(cpu, ts, now, last_update_time);
> iowait = ts->iowait_sleeptime;
> } else {
> - if (ts->idle_active && nr_iowait_cpu(cpu) > 0) {
> + if (ts->idle_active && cpu_online(cpu) && nr_iowait_cpu(cpu)) {
> ktime_t delta = ktime_sub(now, ts->idle_entrytime);
>
> iowait = ktime_add(ts->iowait_sleeptime, delta);
>
That's still mighty odd, but I guess that's in part due to the whacky
semantics. We could simply transfer any open nr_iowait to the cpu
doing the hotplug and then we have offline cpus that have nr_iowait == 0
and the above becomes simpler again.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists