[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <784be226-d4a8-43bf-9096-dbb7ca8f0cff@bytedance.com>
Date: Wed, 29 Jan 2025 12:47:54 +0800
From: Abel Wu <wuyun.abel@...edance.com>
To: Tejun Heo <tj@...nel.org>
Cc: Johannes Weiner <hannes@...xchg.org>, Michal Koutný
<mkoutny@...e.com>, 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>,
Andrew Morton <akpm@...ux-foundation.org>, Bitao Hu
<yaoma@...ux.alibaba.com>, Yury Norov <yury.norov@...il.com>,
Thomas Gleixner <tglx@...utronix.de>, 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: Re: [PATCH v2 2/3] cgroup/rstat: Cleanup cpu.stat once for all
Hi Tejun,
On 1/28/25 4:17 AM, Tejun Heo Wrote:
> On Sat, Jan 25, 2025 at 01:25:11PM +0800, Abel Wu wrote:
>> There were efforts like b824766504e4 ("cgroup/rstat: add force idle show helper")
>> to escape from #ifdef hells, and there could be new stats coming out in
>> the future, let's clean it up once for all.
>>
>> Signed-off-by: Abel Wu <wuyun.abel@...edance.com>
>> ---
>> kernel/cgroup/rstat.c | 47 ++++++++++++++++++++++++-------------------
>> 1 file changed, 26 insertions(+), 21 deletions(-)
>
> Is this materially better? The existing code has ifdef in one place which
> the new code can't avoid.
Indeed, # of ifdefs will stay unchanged, but they will be folded
into one place inside the bstats[] array quite the same as the
definition of the struct cgroup_base_stat, which IMHO won't hurt
readability.
> The new code is more complex and has more lines.
> Does the balance get better with additions of new entries?
The line diff is 5, and 4 of them are for readability. If adding
one more field into cpu.stat, 1 or 3 lines will be added w/o or
w/ ifdef respectively, comparing to 8 or 10 lines without this
cleanup. So the balance will be better if cpu.stat extends. And
it would also be better cleanup duplicated code for each field.
Thanks,
Abel
Powered by blists - more mailing lists