[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241206101744.4161990-6-ruanjinjie@huawei.com>
Date: Fri, 6 Dec 2024 18:17:27 +0800
From: Jinjie Ruan <ruanjinjie@...wei.com>
To: <catalin.marinas@....com>, <will@...nel.org>, <oleg@...hat.com>,
<sstabellini@...nel.org>, <tglx@...utronix.de>, <peterz@...radead.org>,
<luto@...nel.org>, <mingo@...hat.com>, <juri.lelli@...hat.com>,
<vincent.guittot@...aro.org>, <dietmar.eggemann@....com>,
<rostedt@...dmis.org>, <bsegall@...gle.com>, <mgorman@...e.de>,
<vschneid@...hat.com>, <kees@...nel.org>, <wad@...omium.org>,
<akpm@...ux-foundation.org>, <samitolvanen@...gle.com>,
<masahiroy@...nel.org>, <hca@...ux.ibm.com>, <aliceryhl@...gle.com>,
<rppt@...nel.org>, <xur@...gle.com>, <paulmck@...nel.org>, <arnd@...db.de>,
<mbenes@...e.cz>, <puranjay@...nel.org>, <mark.rutland@....com>,
<ruanjinjie@...wei.com>, <pcc@...gle.com>, <ardb@...nel.org>,
<sudeep.holla@....com>, <guohanjun@...wei.com>, <rafael@...nel.org>,
<liuwei09@...tc.cn>, <dwmw@...zon.co.uk>, <Jonathan.Cameron@...wei.com>,
<liaochang1@...wei.com>, <kristina.martsenko@....com>, <ptosi@...gle.com>,
<broonie@...nel.org>, <thiago.bauermann@...aro.org>, <kevin.brodsky@....com>,
<joey.gouly@....com>, <liuyuntao12@...wei.com>, <leobras@...hat.com>,
<linux-kernel@...r.kernel.org>, <linux-arm-kernel@...ts.infradead.org>,
<xen-devel@...ts.xenproject.org>
Subject: [PATCH -next v5 05/22] arm64: entry: Use preempt_count() and need_resched() helper
The generic entry code uses preempt_count() and need_resched() helpers to
check if it is time to resched. Currently, arm64 use its own check logic,
that is "READ_ONCE(current_thread_info()->preempt_count == 0", which is
equivalent to "preempt_count() == 0 && need_resched()".
In preparation for moving arm64 over to the generic entry code, use
these helpers to replace arm64's own code and move it ahead.
No functional changes.
Signed-off-by: Jinjie Ruan <ruanjinjie@...wei.com>
---
arch/arm64/kernel/entry-common.c | 14 ++++----------
1 file changed, 4 insertions(+), 10 deletions(-)
diff --git a/arch/arm64/kernel/entry-common.c b/arch/arm64/kernel/entry-common.c
index da68c089b74b..efd1a990d138 100644
--- a/arch/arm64/kernel/entry-common.c
+++ b/arch/arm64/kernel/entry-common.c
@@ -88,14 +88,6 @@ static inline bool arm64_need_resched(void)
if (!need_irq_preemption())
return false;
- /*
- * Note: thread_info::preempt_count includes both thread_info::count
- * and thread_info::need_resched, and is not equivalent to
- * preempt_count().
- */
- if (READ_ONCE(current_thread_info()->preempt_count) != 0)
- return false;
-
/*
* DAIF.DA are cleared at the start of IRQ/FIQ handling, and when GIC
* priority masking is used the GIC irqchip driver will clear DAIF.IF
@@ -141,8 +133,10 @@ static __always_inline void __exit_to_kernel_mode(struct pt_regs *regs,
return;
}
- if (arm64_need_resched())
- preempt_schedule_irq();
+ if (!preempt_count() && need_resched()) {
+ if (arm64_need_resched())
+ preempt_schedule_irq();
+ }
trace_hardirqs_on();
} else {
--
2.34.1
Powered by blists - more mailing lists