From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 132FB265CC2 for ; Thu, 6 Aug 2026 13:41:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.187 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786023666; cv=none; b=QcFF/9ua1mRag8rpgOXJLTBQdQA/zwmoCHS//tkCMJgmvnPbpwp/C4/2B31kYB/y4a//ST+qOXl0erhYl77wiK0X3769gAzB16tMNhhUgvH90Ylnt8OY5Om2YWOC0JBIWTM3Mk3vpCisYC9HxeKrttxktghe5f6fj+MBJxfTduY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786023666; c=relaxed/simple; bh=ZOU8O/Qj6aKK1isjxAzWdkezC4L8HMA+/e6pgYjoZL4=; h=Message-ID:Date:MIME-Version:Subject:To:CC:References:From: In-Reply-To:Content-Type; b=hUGp0LQGi/o9B8NRN279DuYAckIFbJf8kIlRX6uW7brVtca1Svjm1/31raId4cMivjTBBe0eM4q/CkjMrsUsZfik8wu+Bv1f9ojpyE18Acd7A1GOJMh5Nmh326CSgvsMrNSRutXagJmjN3Ctr+PokZXgCosJytjLQq15EsmpQLU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; dkim=pass (1024-bit key) header.d=huawei.com header.i=@huawei.com header.b=E8JD3xnG; dkim=pass (1024-bit key) header.d=huawei.com header.i=@huawei.com header.b=E8JD3xnG; arc=none smtp.client-ip=45.249.212.187 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=huawei.com header.i=@huawei.com header.b="E8JD3xnG"; dkim=pass (1024-bit key) header.d=huawei.com header.i=@huawei.com header.b="E8JD3xnG" dkim-signature: v=1; a=rsa-sha256; d=huawei.com; s=dkim; c=relaxed/relaxed; q=dns/txt; h=From; bh=CDMr6vAo+vvz2zN7Vso7UqNNLQXRa22Z+ZSt+K/uywA=; b=E8JD3xnGtro5ack4yoAgL47bII44YlFz9x0hVCff3Id/lCi0pp/3dkSCkInZNgUkB6gJmw9qI XTjkKmeeamXoVL0CZNdgt6yV5kPhfmhNge2bU2iGQq7If5WJjw+lHlfSeUT3J1XbOnID6hcmpfy hernEG/lw1oWcmT0MSEjpXo= Received: from canpmsgout05.his.huawei.com (unknown [172.19.92.145]) by szxga01-in.huawei.com (SkyGuard) with ESMTPS id 4hG7HW2db0z1BFPr for ; Thu, 6 Aug 2026 21:22:31 +0800 (CST) dkim-signature: v=1; a=rsa-sha256; d=huawei.com; s=dkim; c=relaxed/relaxed; q=dns/txt; h=From; bh=CDMr6vAo+vvz2zN7Vso7UqNNLQXRa22Z+ZSt+K/uywA=; b=E8JD3xnGtro5ack4yoAgL47bII44YlFz9x0hVCff3Id/lCi0pp/3dkSCkInZNgUkB6gJmw9qI XTjkKmeeamXoVL0CZNdgt6yV5kPhfmhNge2bU2iGQq7If5WJjw+lHlfSeUT3J1XbOnID6hcmpfy hernEG/lw1oWcmT0MSEjpXo= Received: from mail.maildlp.com (unknown [172.19.162.197]) by canpmsgout05.his.huawei.com (SkyGuard) with ESMTPS id 4hG74D4vckz12LDV; Thu, 6 Aug 2026 21:12:44 +0800 (CST) Received: from dggpemf500011.china.huawei.com (unknown [7.185.36.131]) by mail.maildlp.com (Postfix) with ESMTPS id 29F2A4057D; Thu, 6 Aug 2026 21:23:13 +0800 (CST) Received: from [10.67.109.254] (10.67.109.254) by dggpemf500011.china.huawei.com (7.185.36.131) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Thu, 6 Aug 2026 21:23:12 +0800 Message-ID: <1b604113-f969-4092-b3bb-06ee27178ed0@huawei.com> Date: Thu, 6 Aug 2026 21:23:11 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2 3/6] sched: dynamic: Simplify preempt_schedule{,_notrace}() To: Mark Rutland , CC: , , , , , , , , , References: <20260803191731.3244294-1-mark.rutland@arm.com> <20260803191731.3244294-4-mark.rutland@arm.com> From: Jinjie Ruan In-Reply-To: <20260803191731.3244294-4-mark.rutland@arm.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-ClientProxiedBy: kwepems100002.china.huawei.com (7.221.188.206) To dggpemf500011.china.huawei.com (7.185.36.131) 在 2026/8/4 3:17, Mark Rutland 写道: > PREEMPT_DYNAMIC is now limited to the FULL and LAZY preemption models. > In either model, both preempt_schedule() and preempt_schedule_notrace() > are always called and never disabled. > > Remove the unnecessary code for these when PREEMPT_DYNAMIC is selected. > > Signed-off-by: Mark Rutland > Reviewed-by: Shrikanth Hegde > Cc: Frederic Weisbecker > Cc: Ingo Molnar > Cc: John Stultz > Cc: Juri Lelli > Cc: Peter Zijlstra > Cc: Shrikanth Hegde > Cc: Thomas Gleixner > Cc: Valentin Schneider > Cc: Vincent Guittot > --- > arch/arm64/include/asm/preempt.h | 10 ------ > arch/s390/include/asm/preempt.h | 11 ------- > arch/x86/include/asm/preempt.h | 28 ----------------- > include/asm-generic/preempt.h | 10 ------ > kernel/sched/core.c | 52 -------------------------------- > 5 files changed, 111 deletions(-) > > diff --git a/arch/arm64/include/asm/preempt.h b/arch/arm64/include/asm/preempt.h > index 932ea4b620428..506dab34dddb2 100644 > --- a/arch/arm64/include/asm/preempt.h > +++ b/arch/arm64/include/asm/preempt.h > @@ -84,19 +84,9 @@ static inline bool should_resched(int preempt_offset) > void preempt_schedule(void); > void preempt_schedule_notrace(void); > > -#ifdef CONFIG_PREEMPT_DYNAMIC > - > -void dynamic_preempt_schedule(void); > -#define __preempt_schedule() dynamic_preempt_schedule() > -void dynamic_preempt_schedule_notrace(void); > -#define __preempt_schedule_notrace() dynamic_preempt_schedule_notrace() > - > -#else /* CONFIG_PREEMPT_DYNAMIC */ > - > #define __preempt_schedule() preempt_schedule() > #define __preempt_schedule_notrace() preempt_schedule_notrace() In both full and lazy modes for PREEMPT_DYNAMIC , "preempt_schedule" and "preempt_schedule_notrace" are enabled. Therefore, dynamic switching is not required. we can directly invoke preempt_schedule[_notrace](). LGTM Reviewed-by: Jinjie Ruan > > -#endif /* CONFIG_PREEMPT_DYNAMIC */ > #endif /* CONFIG_PREEMPTION */ > > #endif /* __ASM_PREEMPT_H */ > diff --git a/arch/s390/include/asm/preempt.h b/arch/s390/include/asm/preempt.h > index 6e5821bb047e2..797efcbfe394a 100644 > --- a/arch/s390/include/asm/preempt.h > +++ b/arch/s390/include/asm/preempt.h > @@ -148,20 +148,9 @@ static __always_inline bool should_resched(int preempt_offset) > void preempt_schedule(void); > void preempt_schedule_notrace(void); > > -#ifdef CONFIG_PREEMPT_DYNAMIC > - > -void dynamic_preempt_schedule(void); > -void dynamic_preempt_schedule_notrace(void); > -#define __preempt_schedule() dynamic_preempt_schedule() > -#define __preempt_schedule_notrace() dynamic_preempt_schedule_notrace() > - > -#else /* CONFIG_PREEMPT_DYNAMIC */ > - > #define __preempt_schedule() preempt_schedule() > #define __preempt_schedule_notrace() preempt_schedule_notrace() > > -#endif /* CONFIG_PREEMPT_DYNAMIC */ > - > #endif /* CONFIG_PREEMPTION */ > > #endif /* __ASM_PREEMPT_H */ > diff --git a/arch/x86/include/asm/preempt.h b/arch/x86/include/asm/preempt.h > index 578441db09f0b..14002c2abff44 100644 > --- a/arch/x86/include/asm/preempt.h > +++ b/arch/x86/include/asm/preempt.h > @@ -109,43 +109,15 @@ static __always_inline bool should_resched(int preempt_offset) > extern asmlinkage void preempt_schedule(void); > extern asmlinkage void preempt_schedule_thunk(void); > > -#define preempt_schedule_dynamic_enabled preempt_schedule_thunk > -#define preempt_schedule_dynamic_disabled NULL > - > extern asmlinkage void preempt_schedule_notrace(void); > extern asmlinkage void preempt_schedule_notrace_thunk(void); > > -#define preempt_schedule_notrace_dynamic_enabled preempt_schedule_notrace_thunk > -#define preempt_schedule_notrace_dynamic_disabled NULL > - > -#ifdef CONFIG_PREEMPT_DYNAMIC > - > -DECLARE_STATIC_CALL(preempt_schedule, preempt_schedule_dynamic_enabled); > - > -#define __preempt_schedule() \ > -do { \ > - __STATIC_CALL_MOD_ADDRESSABLE(preempt_schedule); \ > - asm volatile ("call " STATIC_CALL_TRAMP_STR(preempt_schedule) : ASM_CALL_CONSTRAINT); \ > -} while (0) > - > -DECLARE_STATIC_CALL(preempt_schedule_notrace, preempt_schedule_notrace_dynamic_enabled); > - > -#define __preempt_schedule_notrace() \ > -do { \ > - __STATIC_CALL_MOD_ADDRESSABLE(preempt_schedule_notrace); \ > - asm volatile ("call " STATIC_CALL_TRAMP_STR(preempt_schedule_notrace) : ASM_CALL_CONSTRAINT); \ > -} while (0) > - > -#else /* PREEMPT_DYNAMIC */ > - > #define __preempt_schedule() \ > asm volatile ("call preempt_schedule_thunk" : ASM_CALL_CONSTRAINT); > > #define __preempt_schedule_notrace() \ > asm volatile ("call preempt_schedule_notrace_thunk" : ASM_CALL_CONSTRAINT); > > -#endif /* PREEMPT_DYNAMIC */ > - > #endif /* PREEMPTION */ > > #endif /* __ASM_PREEMPT_H */ > diff --git a/include/asm-generic/preempt.h b/include/asm-generic/preempt.h > index 51f8f3881523a..26309df2a42f3 100644 > --- a/include/asm-generic/preempt.h > +++ b/include/asm-generic/preempt.h > @@ -82,19 +82,9 @@ static __always_inline bool should_resched(int preempt_offset) > extern asmlinkage void preempt_schedule(void); > extern asmlinkage void preempt_schedule_notrace(void); > > -#if defined(CONFIG_PREEMPT_DYNAMIC) && defined(CONFIG_HAVE_PREEMPT_DYNAMIC_KEY) > - > -void dynamic_preempt_schedule(void); > -void dynamic_preempt_schedule_notrace(void); > -#define __preempt_schedule() dynamic_preempt_schedule() > -#define __preempt_schedule_notrace() dynamic_preempt_schedule_notrace() > - > -#else /* !CONFIG_PREEMPT_DYNAMIC || !CONFIG_HAVE_PREEMPT_DYNAMIC_KEY*/ > - > #define __preempt_schedule() preempt_schedule() > #define __preempt_schedule_notrace() preempt_schedule_notrace() > > -#endif /* CONFIG_PREEMPT_DYNAMIC && CONFIG_HAVE_PREEMPT_DYNAMIC_KEY*/ > #endif /* CONFIG_PREEMPTION */ > > #endif /* __ASM_PREEMPT_H */ > diff --git a/kernel/sched/core.c b/kernel/sched/core.c > index 84ec93694d718..f88b9ef70a0dd 100644 > --- a/kernel/sched/core.c > +++ b/kernel/sched/core.c > @@ -7439,27 +7439,6 @@ asmlinkage __visible void __sched notrace preempt_schedule(void) > NOKPROBE_SYMBOL(preempt_schedule); > EXPORT_SYMBOL(preempt_schedule); > > -#ifdef CONFIG_PREEMPT_DYNAMIC > -# ifdef CONFIG_HAVE_PREEMPT_DYNAMIC_CALL > -# ifndef preempt_schedule_dynamic_enabled > -# define preempt_schedule_dynamic_enabled preempt_schedule > -# define preempt_schedule_dynamic_disabled NULL > -# endif > -DEFINE_STATIC_CALL(preempt_schedule, preempt_schedule_dynamic_enabled); > -EXPORT_STATIC_CALL_TRAMP(preempt_schedule); > -# elif defined(CONFIG_HAVE_PREEMPT_DYNAMIC_KEY) > -static DEFINE_STATIC_KEY_TRUE(sk_dynamic_preempt_schedule); > -void __sched notrace dynamic_preempt_schedule(void) > -{ > - if (!static_branch_unlikely(&sk_dynamic_preempt_schedule)) > - return; > - preempt_schedule(); > -} > -NOKPROBE_SYMBOL(dynamic_preempt_schedule); > -EXPORT_SYMBOL(dynamic_preempt_schedule); > -# endif > -#endif /* CONFIG_PREEMPT_DYNAMIC */ > - > /** > * preempt_schedule_notrace - preempt_schedule called by tracing > * > @@ -7512,27 +7491,6 @@ asmlinkage __visible void __sched notrace preempt_schedule_notrace(void) > } > EXPORT_SYMBOL_GPL(preempt_schedule_notrace); > > -#ifdef CONFIG_PREEMPT_DYNAMIC > -# if defined(CONFIG_HAVE_PREEMPT_DYNAMIC_CALL) > -# ifndef preempt_schedule_notrace_dynamic_enabled > -# define preempt_schedule_notrace_dynamic_enabled preempt_schedule_notrace > -# define preempt_schedule_notrace_dynamic_disabled NULL > -# endif > -DEFINE_STATIC_CALL(preempt_schedule_notrace, preempt_schedule_notrace_dynamic_enabled); > -EXPORT_STATIC_CALL_TRAMP(preempt_schedule_notrace); > -# elif defined(CONFIG_HAVE_PREEMPT_DYNAMIC_KEY) > -static DEFINE_STATIC_KEY_TRUE(sk_dynamic_preempt_schedule_notrace); > -void __sched notrace dynamic_preempt_schedule_notrace(void) > -{ > - if (!static_branch_unlikely(&sk_dynamic_preempt_schedule_notrace)) > - return; > - preempt_schedule_notrace(); > -} > -NOKPROBE_SYMBOL(dynamic_preempt_schedule_notrace); > -EXPORT_SYMBOL(dynamic_preempt_schedule_notrace); > -# endif > -#endif > - > #endif /* CONFIG_PREEMPTION */ > > /* > @@ -7830,8 +7788,6 @@ EXPORT_SYMBOL(__cond_resched_rwlock_write); > # endif > > /* > - * SC:preempt_schedule > - * SC:preempt_schedule_notrace > * SC:irqentry_exit_cond_resched > * > * > @@ -7842,14 +7798,10 @@ EXPORT_SYMBOL(__cond_resched_rwlock_write); > * (unselectable) > * > * FULL: > - * preempt_schedule <- preempt_schedule > - * preempt_schedule_notrace <- preempt_schedule_notrace > * irqentry_exit_cond_resched <- irqentry_exit_cond_resched > * dynamic_preempt_lazy <- false > * > * LAZY: > - * preempt_schedule <- preempt_schedule > - * preempt_schedule_notrace <- preempt_schedule_notrace > * irqentry_exit_cond_resched <- irqentry_exit_cond_resched > * dynamic_preempt_lazy <- true > */ > @@ -7894,8 +7846,6 @@ static void __sched_dynamic_update(int mode) > { > switch (mode) { > case preempt_dynamic_full: > - preempt_dynamic_enable(preempt_schedule); > - preempt_dynamic_enable(preempt_schedule_notrace); > preempt_dynamic_enable(irqentry_exit_cond_resched); > preempt_dynamic_key_disable(preempt_lazy); > if (mode != preempt_dynamic_mode) > @@ -7903,8 +7853,6 @@ static void __sched_dynamic_update(int mode) > break; > > case preempt_dynamic_lazy: > - preempt_dynamic_enable(preempt_schedule); > - preempt_dynamic_enable(preempt_schedule_notrace); > preempt_dynamic_enable(irqentry_exit_cond_resched); > preempt_dynamic_key_enable(preempt_lazy); > if (mode != preempt_dynamic_mode)