From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D6F533D9547 for ; Fri, 3 Jul 2026 13:34:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783085658; cv=none; b=aRDmgJLkaX11caIAMXJml5KD2O41QhumgJT8PgiQ+Z+zEBdyGJ5f5w6XWKa1E2D8T/FSNCwIGtBpBpQ+XM+q5xDeOrEC14tTjsrqZrAWgaf2BfRVqhHawfTbNNWcHkyBxTibqMsGRnHMG/POJfXwDznEK7jJoes+aMIpvCK1/Aw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783085658; c=relaxed/simple; bh=uwLqmMPn1yRCUY+nQxqi2pdmlFTWJxKEyF8UKiVZVCo=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Nf8eQutSyj6PwGhUs2FHkAH8AaABonsoPDd6hVBVtu8m7CPvqMai8zrWeJ+3lKIjI3wnbUKA9mrYF94cTDG2y0gEL3TnZEdDStTDRGazLSVKvHMK4AdsUrRNt3QihWSrrllJsR+l+bRCdmhaZFhslpU833tw6ncdHh/pfeiBiRo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.b=ihOt2PXa; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.b="ihOt2PXa" Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id DF20A4649; Fri, 3 Jul 2026 06:34:11 -0700 (PDT) Received: from lakrids.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id C26C43F85F; Fri, 3 Jul 2026 06:34:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=arm.com; s=foss; t=1783085656; bh=uwLqmMPn1yRCUY+nQxqi2pdmlFTWJxKEyF8UKiVZVCo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ihOt2PXamKwulysrumU4JFkCL7ojVuVztBe0pb/osr0r4Z9TieXn+SBI6BUpCESIt MnXFvq7YmN75UEVSln2ZV/5fbkDFxy2si9xiyHrI5tyj0AjlAbG8wsuuwWcYLI41hw WVXRs5+qyJ8TCe4kl7UhSUDGe2qiQpoDEeNrWa1k= From: Mark Rutland To: linux-kernel@vger.kernel.org Cc: frederic@kernel.org, jstultz@google.com, juri.lelli@redhat.com, mark.rutland@arm.com, mingo@redhat.com, peterz@infradead.org, tglx@linutronix.de, vincent.guittot@linaro.org, vschneid@redhat.com Subject: [PATCH 4/5] sched: dynamic: Simplify irqentry_exit_cond_resched() Date: Fri, 3 Jul 2026 14:33:57 +0100 Message-Id: <20260703133358.698078-5-mark.rutland@arm.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20260703133358.698078-1-mark.rutland@arm.com> References: <20260703133358.698078-1-mark.rutland@arm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit PREEMPT_DYNAMIC is now limited to the FULL and LAZY preemption models. In either model, irqentry_exit_cond_resched() is always called and never disabled. Remove the unnecessary code for this when PREEMPT_DYNAMIC is selected. Signed-off-by: Mark Rutland Cc: Frederic Weisbecker Cc: Ingo Molnar Cc: John Stultz Cc: Juri Lelli Cc: Peter Zijlstra Cc: Thomas Gleixner Cc: Valentin Schneider Cc: Vincent Guittot --- arch/powerpc/include/asm/preempt.h | 7 ------- include/linux/irq-entry-common.h | 17 +---------------- kernel/entry/common.c | 17 ++--------------- kernel/sched/core.c | 7 ------- 4 files changed, 3 insertions(+), 45 deletions(-) diff --git a/arch/powerpc/include/asm/preempt.h b/arch/powerpc/include/asm/preempt.h index 000e2b9681f30..79fc1f9df88d9 100644 --- a/arch/powerpc/include/asm/preempt.h +++ b/arch/powerpc/include/asm/preempt.h @@ -4,13 +4,6 @@ #include -#if defined(CONFIG_PREEMPT_DYNAMIC) -#include -DECLARE_STATIC_KEY_TRUE(sk_dynamic_irqentry_exit_cond_resched); -#define need_irq_preemption() \ - (static_branch_unlikely(&sk_dynamic_irqentry_exit_cond_resched)) -#else #define need_irq_preemption() (IS_ENABLED(CONFIG_PREEMPTION)) -#endif #endif /* __ASM_POWERPC_PREEMPT_H */ diff --git a/include/linux/irq-entry-common.h b/include/linux/irq-entry-common.h index 1fabf0f5ea8e7..de7e10de91d04 100644 --- a/include/linux/irq-entry-common.h +++ b/include/linux/irq-entry-common.h @@ -346,22 +346,7 @@ typedef struct irqentry_state { * * Conditional reschedule with additional sanity checks. */ -void raw_irqentry_exit_cond_resched(void); - -#ifdef CONFIG_PREEMPT_DYNAMIC -#if defined(CONFIG_HAVE_PREEMPT_DYNAMIC_CALL) -#define irqentry_exit_cond_resched_dynamic_enabled raw_irqentry_exit_cond_resched -#define irqentry_exit_cond_resched_dynamic_disabled NULL -DECLARE_STATIC_CALL(irqentry_exit_cond_resched, raw_irqentry_exit_cond_resched); -#define irqentry_exit_cond_resched() static_call(irqentry_exit_cond_resched)() -#elif defined(CONFIG_HAVE_PREEMPT_DYNAMIC_KEY) -DECLARE_STATIC_KEY_TRUE(sk_dynamic_irqentry_exit_cond_resched); -void dynamic_irqentry_exit_cond_resched(void); -#define irqentry_exit_cond_resched() dynamic_irqentry_exit_cond_resched() -#endif -#else /* CONFIG_PREEMPT_DYNAMIC */ -#define irqentry_exit_cond_resched() raw_irqentry_exit_cond_resched() -#endif /* CONFIG_PREEMPT_DYNAMIC */ +void irqentry_exit_cond_resched(void); /** * irqentry_enter_from_kernel_mode - Establish state before invoking the irq handler diff --git a/kernel/entry/common.c b/kernel/entry/common.c index e3d381fd3d251..e234b04373fea 100644 --- a/kernel/entry/common.c +++ b/kernel/entry/common.c @@ -123,7 +123,7 @@ noinstr irqentry_state_t irqentry_enter(struct pt_regs *regs) /** * arch_irqentry_exit_need_resched - Architecture specific need resched function * - * Invoked from raw_irqentry_exit_cond_resched() to check if resched is needed. + * Invoked from irqentry_exit_cond_resched() to check if resched is needed. * Defaults return true. * * The main purpose is to permit arch to avoid preemption of a task from an IRQ. @@ -134,7 +134,7 @@ static inline bool arch_irqentry_exit_need_resched(void); static inline bool arch_irqentry_exit_need_resched(void) { return true; } #endif -void raw_irqentry_exit_cond_resched(void) +void irqentry_exit_cond_resched(void) { if (!preempt_count()) { /* Sanity check RCU and thread stack */ @@ -145,19 +145,6 @@ void raw_irqentry_exit_cond_resched(void) preempt_schedule_irq(); } } -#ifdef CONFIG_PREEMPT_DYNAMIC -#if defined(CONFIG_HAVE_PREEMPT_DYNAMIC_CALL) -DEFINE_STATIC_CALL(irqentry_exit_cond_resched, raw_irqentry_exit_cond_resched); -#elif defined(CONFIG_HAVE_PREEMPT_DYNAMIC_KEY) -DEFINE_STATIC_KEY_TRUE(sk_dynamic_irqentry_exit_cond_resched); -void dynamic_irqentry_exit_cond_resched(void) -{ - if (!static_branch_unlikely(&sk_dynamic_irqentry_exit_cond_resched)) - return; - raw_irqentry_exit_cond_resched(); -} -#endif -#endif noinstr void irqentry_exit(struct pt_regs *regs, irqentry_state_t state) { diff --git a/kernel/sched/core.c b/kernel/sched/core.c index f88b9ef70a0dd..4f754f4a472f8 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -7788,9 +7788,6 @@ EXPORT_SYMBOL(__cond_resched_rwlock_write); # endif /* - * SC:irqentry_exit_cond_resched - * - * * NONE: * (unselectable) * @@ -7798,11 +7795,9 @@ EXPORT_SYMBOL(__cond_resched_rwlock_write); * (unselectable) * * FULL: - * irqentry_exit_cond_resched <- irqentry_exit_cond_resched * dynamic_preempt_lazy <- false * * LAZY: - * irqentry_exit_cond_resched <- irqentry_exit_cond_resched * dynamic_preempt_lazy <- true */ @@ -7846,14 +7841,12 @@ static void __sched_dynamic_update(int mode) { switch (mode) { case preempt_dynamic_full: - preempt_dynamic_enable(irqentry_exit_cond_resched); preempt_dynamic_key_disable(preempt_lazy); if (mode != preempt_dynamic_mode) pr_info("Dynamic Preempt: full\n"); break; case preempt_dynamic_lazy: - preempt_dynamic_enable(irqentry_exit_cond_resched); preempt_dynamic_key_enable(preempt_lazy); if (mode != preempt_dynamic_mode) pr_info("Dynamic Preempt: lazy\n"); -- 2.30.2