[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20250827111444659yr8tENNnk9xU2ZFnz94FO@zte.com.cn>
Date: Wed, 27 Aug 2025 11:14:44 +0800 (CST)
From: <wang.yaxin@....com.cn>
To: <tiozhang@...iglobal.com>
Cc: <akpm@...ux-foundation.org>, <fan.yu9@....com.cn>, <corbet@....net>,
<bsingharora@...il.com>, <yang.yang29@....com.cn>,
<linux-kernel@...r.kernel.org>, <linux-doc@...r.kernel.org>,
<mingo@...hat.com>, <peterz@...radead.org>, <juri.lelli@...hat.com>,
<vincent.guittot@...aro.org>, <dietmar.eggemann@....com>,
<rostedt@...dmis.org>, <bsegall@...gle.com>, <mgorman@...e.de>,
<vschneid@...hat.com>, <jiang.kun2@....com.cn>, <xu.xin16@....com.cn>,
<tiozhang@...iglobal.com>, <zyhtheonly@...il.com>,
<zyhtheonly@...h.net>
Subject: Re: [PATCH v2] delayaccy/sched: add SOFTIRQ delay
> Taking the difference of two successive readings of a given
> counter (say cpu_delay_total) for a task will give the delay
>@@ -123,6 +124,8 @@ Get sum and peak of delays, since system boot, for all pids with tgid 242::
> 156 11215873 0.072ms 0.207403ms 0.033913ms
> IRQ count delay total delay average delay max delay min
> 0 0 0.000ms 0.000000ms 0.000000ms
>+ SOFTIRQ count delay total delay average delay max delay min
>+ 0 0 0.000ms 0.000000ms 0.000000ms
>
> Get IO accounting for pid 1, it works only with -p::
If possible, you can construct some abnormal scenarios to assign values to IRQ and SOFTIRQ,
highlighting the differences between them. Additionally, this should cover the testing of
new features. If the delay info is entirely zero, it may fail to demonstrate such differences.
>+ /*
>+ * We only account softirq time when we are called by
>+ * account_softirq_enter{,exit}
>+ * and we do not account ksoftirqd here.
>+ */
>+ if (curr != this_cpu_ksoftirqd() &&
>+ ((offset & SOFTIRQ_OFFSET) || (pc & SOFTIRQ_OFFSET))) {
>+ delta_soft = cpu_clock - irqtime->soft_start_time;
>+ irqtime->soft_start_time += delta_soft;
>+ }
>+
> /*
> * We do not account for softirq time from ksoftirqd here.
> * We want to continue accounting softirq time to ksoftirqd thread
>@@ -75,9 +88,9 @@ void irqtime_account_irq(struct task_struct *curr, unsigned int offset)
> * that do not consume any time, but still wants to run.
> */
> if (pc & HARDIRQ_MASK)
>- irqtime_account_delta(irqtime, delta, CPUTIME_IRQ);
>+ irqtime_account_delta(irqtime, delta, delta_soft, CPUTIME_IRQ);
> else if ((pc & SOFTIRQ_OFFSET) && curr != this_cpu_ksoftirqd())
>- irqtime_account_delta(irqtime, delta, CPUTIME_SOFTIRQ);
>+ irqtime_account_delta(irqtime, delta, delta_soft, CPUTIME_SOFTIRQ);
> }
>
> static u64 irqtime_tick_accounted(u64 maxtime)
As you mentioned, delta_soft represents SOFTIRQ, but it appears to have been accumulated once
under the condition of (pc & HARDIRQ_MASK). Is there a potential double-counting issue?
replacing delta_soft with 0 when in HARDIRQ might make it more intuitive.
Thanks,
Yaxin
Powered by blists - more mailing lists