From: Frederic Weisbecker <frederic@kernel.org>
To: Thomas Gleixner <tglx@linutronix.de>
Cc: Peter Zijlstra <peterz@infradead.org>,
LKML <linux-kernel@vger.kernel.org>,
Tony Luck <tony.luck@intel.com>,
Vasily Gorbik <gor@linux.ibm.com>,
Michael Ellerman <mpe@ellerman.id.au>,
Benjamin Herrenschmidt <benh@kernel.crashing.org>,
Paul Mackerras <paulus@samba.org>,
Christian Borntraeger <borntraeger@de.ibm.com>,
Fenghua Yu <fenghua.yu@intel.com>,
Heiko Carstens <hca@linux.ibm.com>
Subject: Re: [PATCH 4/5] irqtime: Move irqtime entry accounting after irq offset incrementation
Date: Tue, 1 Dec 2020 15:35:45 +0100 [thread overview]
Message-ID: <20201201143545.GC72897@lothringen> (raw)
In-Reply-To: <87blfdhcp2.fsf@nanos.tec.linutronix.de>
On Tue, Dec 01, 2020 at 02:34:49PM +0100, Thomas Gleixner wrote:
> On Tue, Dec 01 2020 at 12:40, Frederic Weisbecker wrote:
> > On Tue, Dec 01, 2020 at 12:33:26PM +0100, Thomas Gleixner wrote:
> >> > /*
> >> > * We do not account for softirq time from ksoftirqd here.
> >> > * We want to continue accounting softirq time to ksoftirqd thread
> >> > * in that case, so as not to confuse scheduler with a special task
> >> > * that do not consume any time, but still wants to run.
> >> > */
> >> > if (pc & HARDIRQ_MASK)
> >> > irqtime_account_delta(irqtime, delta, CPUTIME_IRQ);
> >> > else if ((pc & SOFTIRQ_OFFSET) && curr != this_cpu_ksoftirqd())
> >> > irqtime_account_delta(irqtime, delta, CPUTIME_SOFTIRQ);
> >> > }
> >>
> >> Why not making all of this explicit instead of these conditionals?
> >
> > Hmm, I'm not sure I get what you suggest?
>
> Instead of playing games with preeempt count and offsets and checking
> for ksoftirqd, can't you just have:
>
> account_hardirqtime()
> account_softirqtime()
>
> and call them from the right spots. See the below for illustration (it's
> obviously incomplete).
>
> Thanks,
>
> tglx
> ---
> --- a/kernel/softirq.c
> +++ b/kernel/softirq.c
> @@ -377,6 +377,7 @@ static inline void invoke_softirq(void)
> return;
>
> if (!force_irqthreads) {
> + account_softirq_enter_time(current);
> #ifdef CONFIG_HAVE_IRQ_EXIT_ON_IRQ_STACK
> /*
> * We can safely execute softirq on the current stack if
> @@ -391,6 +392,7 @@ static inline void invoke_softirq(void)
> * to prevent from any overrun.
> */
> do_softirq_own_stack();
> + account_softirq_exit_time(current);
Indeed for the softirq part it simplifies things.
> #endif
> } else {
> wakeup_softirqd();
> @@ -417,7 +419,7 @@ static inline void __irq_exit_rcu(void)
> #else
> lockdep_assert_irqs_disabled();
> #endif
> - account_irq_exit_time(current);
> + account_hardirq_exit_time(current);
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.
But I think it's a win in the end. I'll try that.
Thanks.
> preempt_count_sub(HARDIRQ_OFFSET);
> if (!in_interrupt() && local_softirq_pending())
> invoke_softirq();
next prev parent reply other threads:[~2020-12-01 14:36 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-01 0:12 [PATCH 0/5] irq: Reorder time handling against HARDIRQ_OFFSET on IRQ entry v2 Frederic Weisbecker
2020-12-01 0:12 ` [PATCH 1/5] sched/cputime: Remove symbol exports from IRQ time accounting Frederic Weisbecker
2020-12-01 0:12 ` [PATCH 2/5] sched/vtime: Consolidate " Frederic Weisbecker
2020-12-01 0:12 ` [PATCH 3/5] s390/vtime: Convert to consolidated " Frederic Weisbecker
2020-12-01 0:12 ` [PATCH 4/5] irqtime: Move irqtime entry accounting after irq offset incrementation Frederic Weisbecker
2020-12-01 9:20 ` Peter Zijlstra
2020-12-01 11:23 ` Frederic Weisbecker
2020-12-01 11:33 ` Thomas Gleixner
2020-12-01 11:40 ` Frederic Weisbecker
2020-12-01 13:34 ` Thomas Gleixner
2020-12-01 14:35 ` Frederic Weisbecker [this message]
2020-12-01 15:01 ` Peter Zijlstra
2020-12-01 15:53 ` Thomas Gleixner
2020-12-01 0:12 ` [PATCH 5/5] irq: Call tick_irq_enter() inside HARDIRQ_OFFSET Frederic Weisbecker
-- strict thread matches above, loose matches on Subject: below --
2020-12-02 11:57 [PATCH 0/5] irq: Reorder time handling against HARDIRQ_OFFSET on IRQ entry v3 Frederic Weisbecker
2020-12-02 11:57 ` [PATCH 4/5] irqtime: Move irqtime entry accounting after irq offset incrementation Frederic Weisbecker
2020-12-02 12:36 ` Peter Zijlstra
2020-12-28 2:15 ` Qais Yousef
2020-12-29 13:41 ` Frederic Weisbecker
2020-12-29 14:12 ` Qais Yousef
2020-12-29 14:30 ` Frederic Weisbecker
2020-12-29 15:58 ` Qais Yousef
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201201143545.GC72897@lothringen \
--to=frederic@kernel.org \
--cc=benh@kernel.crashing.org \
--cc=borntraeger@de.ibm.com \
--cc=fenghua.yu@intel.com \
--cc=gor@linux.ibm.com \
--cc=hca@linux.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mpe@ellerman.id.au \
--cc=paulus@samba.org \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
--cc=tony.luck@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.