Re: [PATCH] delayacct/sched: add SOFTIRQ delay

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Peter Zijlstra <peterz@xxxxxxxxxxxxx> 于2025年8月19日周二 18:14写道:
>
> On Tue, Aug 19, 2025 at 05:27:39PM +0800, Tio Zhang wrote:
> > Intro SOFTIRQ delay, so we can separate softirq as SOFTIRQ delay
> > and hardirq as {IRQ - SOFTIRQ} delay.
> >
> > A typical scenario is when tasks delayed by network,
> > if they delayed by rx net packets, i.e, net_rx_action(),
> > SOFTIRQ delay is almost same as IRQ delay;
> > if they delayed by, e.g, bad driver or broken hardware,
> > SOFTIRQ delay is almost 0 while IRQ delay remains big.
> >
> > Examples tool usage could be found in
> > Documentation/accounting/delay-accounting.rst
>
> accounting will be the death of us :/
>
> How do you account ksoftirqd ?

delay accounting should count delay within the task's own context,
so ksoftirqd should not be take into consideration in "SOFTIRQ delay".

When a task is delayed by ksoftirqd, the task is exactly delayed
by ksoftirqd's preemption, not softirq context:
--------------------------------------------------------------------------------------------
              TASK A
    <runs in A's context>
    <IRQ context>
        | -------------------------------------------------------
        |              counts in A's IRQ delay               |
        | -------------------------------------------------------
    <SOFTIRQ context>
        | -------------------------------------------------------
        |              counts in A's SOFTIRQ delay      |
        | -------------------------------------------------------
     wakeup_softirqd
     preempted by ksoftirqd
     <A in rq waiting>
        | ------------------------------------------------------------------------
        |  counts in A's CPU delay (A->sched_info.run_delay) |
        | ------------------------------------------------------------------------
     ksoftirqd gives the cpu
     <runs in A's context>
--------------------------------------------------------------------------------------------

So when ksoftirqd plays a significant role, we will FISRT see
SOFTIRQ delay increasing in task's delay, THEN see CPU delay
increasing.
We should always find out the task delayed by softirq.

Though not working in PRERMPT_RT (No IRQ delay but always CPU delay).

Btw, I did miss exclude ksoftirqd in irqtime_account_irq, will add in V2.





[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux