Skip to content

Commit fbaa6a1

Browse files
eberman-quicIngo Molnar
authored andcommitted
sched/core: Remove ifdeffery for saved_state
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 <[email protected]> Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Signed-off-by: Ingo Molnar <[email protected]>
1 parent 4ff34ad commit fbaa6a1

File tree

2 files changed

+2
-8
lines changed

2 files changed

+2
-8
lines changed

include/linux/sched.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -750,10 +750,8 @@ struct task_struct {
750750
#endif
751751
unsigned int __state;
752752

753-
#ifdef CONFIG_PREEMPT_RT
754753
/* saved state for "spinlock sleepers" */
755754
unsigned int saved_state;
756-
#endif
757755

758756
/*
759757
* This begins the randomizable portion of task_struct. Only

kernel/sched/core.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2232,23 +2232,20 @@ int __task_state_match(struct task_struct *p, unsigned int state)
22322232
if (READ_ONCE(p->__state) & state)
22332233
return 1;
22342234

2235-
#ifdef CONFIG_PREEMPT_RT
22362235
if (READ_ONCE(p->saved_state) & state)
22372236
return -1;
2238-
#endif
2237+
22392238
return 0;
22402239
}
22412240

22422241
static __always_inline
22432242
int task_state_match(struct task_struct *p, unsigned int state)
22442243
{
2245-
#ifdef CONFIG_PREEMPT_RT
22462244
/*
22472245
* Serialize against current_save_and_set_rtlock_wait_state() and
22482246
* current_restore_rtlock_saved_state().
22492247
*/
22502248
guard(raw_spinlock_irq)(&p->pi_lock);
2251-
#endif
22522249
return __task_state_match(p, state);
22532250
}
22542251

@@ -4038,7 +4035,6 @@ bool ttwu_state_match(struct task_struct *p, unsigned int state, int *success)
40384035

40394036
*success = !!(match = __task_state_match(p, state));
40404037

4041-
#ifdef CONFIG_PREEMPT_RT
40424038
/*
40434039
* Saved state preserves the task state across blocking on
40444040
* an RT lock. If the state matches, set p::saved_state to
@@ -4054,7 +4050,7 @@ bool ttwu_state_match(struct task_struct *p, unsigned int state, int *success)
40544050
*/
40554051
if (match < 0)
40564052
p->saved_state = TASK_RUNNING;
4057-
#endif
4053+
40584054
return match > 0;
40594055
}
40604056

0 commit comments

Comments
 (0)