[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <a7a24c05-87ca-49d1-9fa3-be4c3555e238@bytedance.com>
Date: Fri, 24 Jan 2025 17:58:26 +0800
From: Abel Wu <wuyun.abel@...edance.com>
To: Michal Koutný <mkoutny@...e.com>
Cc: Tejun Heo <tj@...nel.org>, Johannes Weiner <hannes@...xchg.org>,
Jonathan Corbet <corbet@....net>, Ingo Molnar <mingo@...hat.com>,
Peter Zijlstra <peterz@...radead.org>, Juri Lelli <juri.lelli@...hat.com>,
Vincent Guittot <vincent.guittot@...aro.org>,
Dietmar Eggemann <dietmar.eggemann@....com>,
Steven Rostedt <rostedt@...dmis.org>, Ben Segall <bsegall@...gle.com>,
Mel Gorman <mgorman@...e.de>, Valentin Schneider <vschneid@...hat.com>,
Thomas Gleixner <tglx@...utronix.de>, Yury Norov <yury.norov@...il.com>,
Andrew Morton <akpm@...ux-foundation.org>, Bitao Hu
<yaoma@...ux.alibaba.com>, Chen Ridong <chenridong@...wei.com>,
"open list:CONTROL GROUP (CGROUP)" <cgroups@...r.kernel.org>,
"open list:DOCUMENTATION" <linux-doc@...r.kernel.org>,
open list <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 1/3] cgroup/rstat: Fix forceidle time in cpu.stat
On 1/24/25 5:22 PM, Michal Koutný Wrote:
> Hello.
>
> On Fri, Jan 24, 2025 at 01:47:01AM +0800, Abel Wu <wuyun.abel@...edance.com> wrote:
>> The commit b824766504e4 ("cgroup/rstat: add force idle show helper")
>> retrieves forceidle_time outside cgroup_rstat_lock for non-root cgroups
>> which can be potentially inconsistent with other stats.
>>
>> Rather than reverting that commit, fix it in a way that retains the
>> effort of cleaning up the ifdef-messes.
>
> Sorry, I'm blind, where's the change moving wrt cgroup_rstat_lock?
> (I only see unuse of root cgroup's bstat and a few renames).
Hi Michal,
The following hunk deleted the snapshot of cgrp->bstat.forceidle_sum:
if (cgroup_parent(cgrp)) {
cgroup_rstat_flush_hold(cgrp);
usage = cgrp->bstat.cputime.sum_exec_runtime;
cputime_adjust(&cgrp->bstat.cputime, &cgrp->prev_cputime,
&utime, &stime);
-#ifdef CONFIG_SCHED_CORE
- forceidle_time = cgrp->bstat.forceidle_sum;
-#endif
cgroup_rstat_flush_release(cgrp);
} else {
and then read forceidle_sum from @cgrp directly outside of the lock,
but its value can be changed in this window, so...
-#ifdef CONFIG_SCHED_CORE
- seq_printf(seq, "core_sched.force_idle_usec %llu\n", forceidle_time);
-#endif
+ cgroup_force_idle_show(seq, &cgrp->bstat);
}
result in the inconsistence between forceidle and other cputimes.
Best Regards,
Abel
Powered by blists - more mailing lists