]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
sched/core: Remove ifdeffery for saved_state
authorElliot Berman <quic_eberman@quicinc.com>
Fri, 8 Sep 2023 22:49:15 +0000 (15:49 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 15 Aug 2025 10:09:07 +0000 (12:09 +0200)
commit fbaa6a181a4b1886cbf4214abdf9a2df68471510 upstream.

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@quicinc.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Chen Ridong <chenridong@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
include/linux/sched.h
kernel/sched/core.c

index 393c300347dee4a2c669cbba1b5eb9fe238d1f8d..cb38eee732fd028e6a8494a87e1a065a99b913b1 100644 (file)
@@ -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
index 760a6c3781cbfc770467d27bad7bef56033031e5..ab6550fadecd13b9edc8247f7852e2ce6298444e 100644 (file)
@@ -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;
 }