[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250728024121.33864-2-chenridong@huaweicloud.com>
Date: Mon, 28 Jul 2025 02:41:17 +0000
From: Chen Ridong <chenridong@...weicloud.com>
To: mingo@...hat.com,
peterz@...radead.org,
juri.lelli@...hat.com,
vincent.guittot@...aro.org,
dietmar.eggemann@....com,
rostedt@...dmis.org,
bsegall@...gle.com,
mgorman@...e.de,
bristot@...hat.com,
vschneid@...hat.com,
rafael@...nel.org,
pavel@....cz
Cc: linux-kernel@...r.kernel.org,
linux-pm@...r.kernel.org,
lujialin4@...wei.com,
chenridong@...wei.com
Subject: [PATCH 6.6 1/5] sched/core: Remove ifdeffery for saved_state
From: Elliot Berman <quic_eberman@...cinc.com>
[ Upstream commit fbaa6a181a4b1886cbf4214abdf9a2df68471510 ]
In preparation for freezer to also use saved_state, remove the
CONFIG_PREEMPT_RT compilation guard around saved_state.
On the arm64 platform I tested which did not have CONFIG_PREEMPT_RT,
there was no statistically significant deviation by applying this patch.
Test methodology:
perf bench sched message -g 40 -l 40
Signed-off-by: Elliot Berman <quic_eberman@...cinc.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@...radead.org>
Signed-off-by: Ingo Molnar <mingo@...nel.org>
Signed-off-by: Chen Ridong <chenridong@...wei.com>
---
include/linux/sched.h | 2 --
kernel/sched/core.c | 10 ++--------
2 files changed, 2 insertions(+), 10 deletions(-)
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 393c300347de..cb38eee732fd 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -753,10 +753,8 @@ struct task_struct {
#endif
unsigned int __state;
-#ifdef CONFIG_PREEMPT_RT
/* saved state for "spinlock sleepers" */
unsigned int saved_state;
-#endif
/*
* This begins the randomizable portion of task_struct. Only
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 760a6c3781cb..ab6550fadecd 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -2238,17 +2238,15 @@ int __task_state_match(struct task_struct *p, unsigned int state)
if (READ_ONCE(p->__state) & state)
return 1;
-#ifdef CONFIG_PREEMPT_RT
if (READ_ONCE(p->saved_state) & state)
return -1;
-#endif
+
return 0;
}
static __always_inline
int task_state_match(struct task_struct *p, unsigned int state)
{
-#ifdef CONFIG_PREEMPT_RT
int match;
/*
@@ -2260,9 +2258,6 @@ int task_state_match(struct task_struct *p, unsigned int state)
raw_spin_unlock_irq(&p->pi_lock);
return match;
-#else
- return __task_state_match(p, state);
-#endif
}
/*
@@ -4059,7 +4054,6 @@ bool ttwu_state_match(struct task_struct *p, unsigned int state, int *success)
*success = !!(match = __task_state_match(p, state));
-#ifdef CONFIG_PREEMPT_RT
/*
* Saved state preserves the task state across blocking on
* an RT lock. If the state matches, set p::saved_state to
@@ -4075,7 +4069,7 @@ bool ttwu_state_match(struct task_struct *p, unsigned int state, int *success)
*/
if (match < 0)
p->saved_state = TASK_RUNNING;
-#endif
+
return match > 0;
}
--
2.34.1
Powered by blists - more mailing lists