[PATCH 1/2] sched/preempt: Remove preceding unnecessary enables in __sched_dynamic_update

From: Song Shuai
Date: Fri Jan 12 2024 - 04:26:22 EST


The preempt mode transitions are based on SC's static_call_update()
and SK's static_key_enable/disable() APIs.

Once these static calls and static keys are initialized, APIs can
work well regardless of the states of them (detailly speaking, the
instructions in SC's call site/trampoline or SK's jump_entry::code).

There is no need to enable these points all at the beginning,
updating them directly is enough.

Signed-off-by: Song Shuai <songshuaishuai@xxxxxxxxxxx>
---
kernel/sched/core.c | 11 -----------
1 file changed, 11 deletions(-)

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index a708d225c28e..6931da32f6a6 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -8732,17 +8732,6 @@ static bool klp_override;

static void __sched_dynamic_update(int mode)
{
- /*
- * Avoid {NONE,VOLUNTARY} -> FULL transitions from ever ending up in
- * the ZERO state, which is invalid.
- */
- if (!klp_override)
- preempt_dynamic_enable(cond_resched);
- preempt_dynamic_enable(might_resched);
- preempt_dynamic_enable(preempt_schedule);
- preempt_dynamic_enable(preempt_schedule_notrace);
- preempt_dynamic_enable(irqentry_exit_cond_resched);
-
switch (mode) {
case preempt_dynamic_none:
if (!klp_override)
--
2.39.2