* [PATCH] sched/preempt: Bypass setting same mode for sched_dynamic_update()
@ 2024-06-20 12:10 Jinjie Ruan
2024-06-20 12:33 ` Peter Zijlstra
0 siblings, 1 reply; 2+ messages in thread
From: Jinjie Ruan @ 2024-06-20 12:10 UTC (permalink / raw)
To: mingo, peterz, juri.lelli, vincent.guittot, dietmar.eggemann,
rostedt, bsegall, mgorman, bristot, vschneid, linux-kernel
Cc: ruanjinjie
If the preempt mode to set is same with current preempt mode, there is no
need to update all the `cond_resched`, `might_resched`, `preempt_schedule`,
`preempt_schedule_notrace` and `irqentry_exit_cond_resched` state.
Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>
---
kernel/sched/core.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index bcf2c4cc0522..eb409901c64c 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -8777,6 +8777,9 @@ static bool klp_override;
static void __sched_dynamic_update(int mode)
{
+ if (mode == preempt_dynamic_mode)
+ return;
+
/*
* Avoid {NONE,VOLUNTARY} -> FULL transitions from ever ending up in
* the ZERO state, which is invalid.
--
2.34.1
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] sched/preempt: Bypass setting same mode for sched_dynamic_update()
2024-06-20 12:10 [PATCH] sched/preempt: Bypass setting same mode for sched_dynamic_update() Jinjie Ruan
@ 2024-06-20 12:33 ` Peter Zijlstra
0 siblings, 0 replies; 2+ messages in thread
From: Peter Zijlstra @ 2024-06-20 12:33 UTC (permalink / raw)
To: Jinjie Ruan
Cc: mingo, juri.lelli, vincent.guittot, dietmar.eggemann, rostedt,
bsegall, mgorman, bristot, vschneid, linux-kernel
On Thu, Jun 20, 2024 at 08:10:20PM +0800, Jinjie Ruan wrote:
> If the preempt mode to set is same with current preempt mode, there is no
> need to update all the `cond_resched`, `might_resched`, `preempt_schedule`,
> `preempt_schedule_notrace` and `irqentry_exit_cond_resched` state.
IIRC this actively breaks things, also this is a super slow path, nobody
should care.
> Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>
> ---
> kernel/sched/core.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/kernel/sched/core.c b/kernel/sched/core.c
> index bcf2c4cc0522..eb409901c64c 100644
> --- a/kernel/sched/core.c
> +++ b/kernel/sched/core.c
> @@ -8777,6 +8777,9 @@ static bool klp_override;
>
> static void __sched_dynamic_update(int mode)
> {
> + if (mode == preempt_dynamic_mode)
> + return;
> +
> /*
> * Avoid {NONE,VOLUNTARY} -> FULL transitions from ever ending up in
> * the ZERO state, which is invalid.
> --
> 2.34.1
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-06-20 12:33 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-06-20 12:10 [PATCH] sched/preempt: Bypass setting same mode for sched_dynamic_update() Jinjie Ruan
2024-06-20 12:33 ` Peter Zijlstra
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome