linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: LAK <linux-arm-kernel@lists.infradead.org>
Cc: Peter Zijlstra <peterz@infradead.org>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Will Deacon <will@kernel.org>,
	LKML <linux-kernel@vger.kernel.org>
Subject: [PATCH] arm64: Avoid pointless schedule_preempt_irq() invocations
Date: Wed, 17 Jul 2019 10:43:59 +0200 (CEST)	[thread overview]
Message-ID: <alpine.DEB.2.21.1907171036490.1767@nanos.tec.linutronix.de> (raw)

When preempt_count is zero on return from interrupt then
schedule_preempt_irq() is invoked even if TIF_NEED_RESCHED is not set.

That does not make sense because schedule_preempt_irq() has to go through a
full __schedule() for nothing in that case.

Check TIF_NEED_RESCHED and invoke schedule_preempt_irq() only if set.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
Found while staring at some RT wrecakge in that area.
---
 arch/arm64/kernel/entry.S |    4 ++++
 1 file changed, 4 insertions(+)

--- a/arch/arm64/kernel/entry.S
+++ b/arch/arm64/kernel/entry.S
@@ -680,6 +680,10 @@ alternative_if ARM64_HAS_IRQ_PRIO_MASKIN
 	orr	x24, x24, x0
 alternative_else_nop_endif
 	cbnz	x24, 1f				// preempt count != 0 || NMI return path
+
+	ldr	x0, [tsk, #TSK_TI_FLAGS]        // get flags
+	tbz	x0, #TIF_NEED_RESCHED, 1f      	// needs rescheduling?
+
 	bl	preempt_schedule_irq		// irq en/disable is done inside
 1:
 #endif

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

             reply	other threads:[~2019-07-17  8:44 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-17  8:43 Thomas Gleixner [this message]
2019-07-17  9:54 ` [PATCH] arm64: Avoid pointless schedule_preempt_irq() invocations Valentin Schneider
2019-07-17 10:04   ` Thomas Gleixner

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=alpine.DEB.2.21.1907171036490.1767@nanos.tec.linutronix.de \
    --to=tglx@linutronix.de \
    --cc=catalin.marinas@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peterz@infradead.org \
    --cc=will@kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).