On Tue, Dec 01 2020 at 16:01, Peter Zijlstra wrote: > On Tue, Dec 01, 2020 at 03:35:45PM +0100, Frederic Weisbecker wrote: >> And that one too makes things simple. But note that >> >> account_hardirq_enter_time() >> >> will still need some preempt count checks to see if >> this is a nested hardirq, a hardirq interrupting a softirq >> or a hardirq interrupting a task. > > So the current tests get that all correct in a single function. > Splitting it out will just result in more lines to get wrong. > > That is, I don't think you can do it saner than: > > account_softirq_enter() := irqtime_account_irq(curr, SOFTIRQ_OFFSET); > account_softirq_exit() := irqtime_account_irq(curr, 0); > account_hardirq_enter() := irqtime_account_irq(curr, HARDIRQ_OFFSET); > account_hardirq_exit() := irqtime_account_irq(curr, 0); > > Fundamentally you have to determine the previous context to determine > where to account the delta to. Note that when the previous context is > task context we throw away the delta.
Fair enough.

