hc
2023-12-11 6778948f9de86c3cfaf36725a7c87dcff9ba247f
kernel/include/linux/sched.h
....@@ -113,7 +113,11 @@
113113 __TASK_TRACED | EXIT_DEAD | EXIT_ZOMBIE | \
114114 TASK_PARKED)
115115
116
+#define task_is_traced(task) ((task->state & __TASK_TRACED) != 0)
117
+
116118 #define task_is_stopped(task) ((task->state & __TASK_STOPPED) != 0)
119
+
120
+#define task_is_stopped_or_traced(task) ((task->state & (__TASK_STOPPED | __TASK_TRACED)) != 0)
117121
118122 #ifdef CONFIG_DEBUG_ATOMIC_SLEEP
119123
....@@ -137,9 +141,6 @@
137141 current->task_state_change = _THIS_IP_; \
138142 smp_store_mb(current->state, (state_value)); \
139143 } while (0)
140
-
141
-#define __set_current_state_no_track(state_value) \
142
- current->state = (state_value);
143144
144145 #define set_special_state(state_value) \
145146 do { \
....@@ -193,9 +194,6 @@
193194
194195 #define set_current_state(state_value) \
195196 smp_store_mb(current->state, (state_value))
196
-
197
-#define __set_current_state_no_track(state_value) \
198
- __set_current_state(state_value)
199197
200198 /*
201199 * set_special_state() should be used for those states when the blocking task
....@@ -655,13 +653,6 @@
655653 struct wake_q_node *next;
656654 };
657655
658
-struct kmap_ctrl {
659
-#ifdef CONFIG_KMAP_LOCAL
660
- int idx;
661
- pte_t pteval[KM_MAX_IDX];
662
-#endif
663
-};
664
-
665656 struct task_struct {
666657 #ifdef CONFIG_THREAD_INFO_IN_TASK
667658 /*
....@@ -672,8 +663,6 @@
672663 #endif
673664 /* -1 unrunnable, 0 runnable, >0 stopped: */
674665 volatile long state;
675
- /* saved state for "spinlock sleepers" */
676
- volatile long saved_state;
677666
678667 /*
679668 * This begins the randomizable portion of task_struct. Only
....@@ -753,11 +742,6 @@
753742 int nr_cpus_allowed;
754743 const cpumask_t *cpus_ptr;
755744 cpumask_t cpus_mask;
756
- void *migration_pending;
757
-#ifdef CONFIG_SMP
758
- unsigned short migration_disabled;
759
-#endif
760
- unsigned short migration_flags;
761745
762746 #ifdef CONFIG_PREEMPT_RCU
763747 int rcu_read_lock_nesting;
....@@ -862,10 +846,6 @@
862846 #ifdef CONFIG_PSI
863847 /* Stalled due to lack of memory */
864848 unsigned in_memstall:1;
865
-#endif
866
-#ifdef CONFIG_EVENTFD
867
- /* Recursion prevention for eventfd_signal() */
868
- unsigned in_eventfd_signal:1;
869849 #endif
870850
871851 unsigned long atomic_flags; /* Flags requiring atomic access. */
....@@ -1012,16 +992,11 @@
1012992 /* Signal handlers: */
1013993 struct signal_struct *signal;
1014994 struct sighand_struct __rcu *sighand;
1015
- struct sigqueue *sigqueue_cache;
1016995 sigset_t blocked;
1017996 sigset_t real_blocked;
1018997 /* Restored if set_restore_sigmask() was used: */
1019998 sigset_t saved_sigmask;
1020999 struct sigpending pending;
1021
-#ifdef CONFIG_PREEMPT_RT
1022
- /* TODO: move me into ->restart_block ? */
1023
- struct kernel_siginfo forced_info;
1024
-#endif
10251000 unsigned long sas_ss_sp;
10261001 size_t sas_ss_size;
10271002 unsigned int sas_ss_flags;
....@@ -1048,7 +1023,6 @@
10481023 raw_spinlock_t pi_lock;
10491024
10501025 struct wake_q_node wake_q;
1051
- struct wake_q_node wake_q_sleeper;
10521026 int wake_q_count;
10531027
10541028 #ifdef CONFIG_RT_MUTEXES
....@@ -1076,9 +1050,6 @@
10761050 int softirqs_enabled;
10771051 int softirq_context;
10781052 int irq_config;
1079
-#endif
1080
-#ifdef CONFIG_PREEMPT_RT
1081
- int softirq_disable_cnt;
10821053 #endif
10831054
10841055 #ifdef CONFIG_LOCKDEP
....@@ -1365,7 +1336,6 @@
13651336 unsigned int sequential_io;
13661337 unsigned int sequential_io_avg;
13671338 #endif
1368
- struct kmap_ctrl kmap_ctrl;
13691339 #ifdef CONFIG_DEBUG_ATOMIC_SLEEP
13701340 unsigned long task_state_change;
13711341 #endif
....@@ -1834,7 +1804,6 @@
18341804
18351805 extern int wake_up_state(struct task_struct *tsk, unsigned int state);
18361806 extern int wake_up_process(struct task_struct *tsk);
1837
-extern int wake_up_lock_sleeper(struct task_struct *tsk);
18381807 extern void wake_up_new_task(struct task_struct *tsk);
18391808
18401809 #ifdef CONFIG_SMP
....@@ -1923,89 +1892,6 @@
19231892 static inline int test_tsk_need_resched(struct task_struct *tsk)
19241893 {
19251894 return unlikely(test_tsk_thread_flag(tsk,TIF_NEED_RESCHED));
1926
-}
1927
-
1928
-#ifdef CONFIG_PREEMPT_LAZY
1929
-static inline void set_tsk_need_resched_lazy(struct task_struct *tsk)
1930
-{
1931
- set_tsk_thread_flag(tsk,TIF_NEED_RESCHED_LAZY);
1932
-}
1933
-
1934
-static inline void clear_tsk_need_resched_lazy(struct task_struct *tsk)
1935
-{
1936
- clear_tsk_thread_flag(tsk,TIF_NEED_RESCHED_LAZY);
1937
-}
1938
-
1939
-static inline int test_tsk_need_resched_lazy(struct task_struct *tsk)
1940
-{
1941
- return unlikely(test_tsk_thread_flag(tsk,TIF_NEED_RESCHED_LAZY));
1942
-}
1943
-
1944
-static inline int need_resched_lazy(void)
1945
-{
1946
- return test_thread_flag(TIF_NEED_RESCHED_LAZY);
1947
-}
1948
-
1949
-static inline int need_resched_now(void)
1950
-{
1951
- return test_thread_flag(TIF_NEED_RESCHED);
1952
-}
1953
-
1954
-#else
1955
-static inline void clear_tsk_need_resched_lazy(struct task_struct *tsk) { }
1956
-static inline int need_resched_lazy(void) { return 0; }
1957
-
1958
-static inline int need_resched_now(void)
1959
-{
1960
- return test_thread_flag(TIF_NEED_RESCHED);
1961
-}
1962
-
1963
-#endif
1964
-
1965
-
1966
-static inline bool __task_is_stopped_or_traced(struct task_struct *task)
1967
-{
1968
- if (task->state & (__TASK_STOPPED | __TASK_TRACED))
1969
- return true;
1970
-#ifdef CONFIG_PREEMPT_RT
1971
- if (task->saved_state & (__TASK_STOPPED | __TASK_TRACED))
1972
- return true;
1973
-#endif
1974
- return false;
1975
-}
1976
-
1977
-static inline bool task_is_stopped_or_traced(struct task_struct *task)
1978
-{
1979
- bool traced_stopped;
1980
-
1981
-#ifdef CONFIG_PREEMPT_RT
1982
- unsigned long flags;
1983
-
1984
- raw_spin_lock_irqsave(&task->pi_lock, flags);
1985
- traced_stopped = __task_is_stopped_or_traced(task);
1986
- raw_spin_unlock_irqrestore(&task->pi_lock, flags);
1987
-#else
1988
- traced_stopped = __task_is_stopped_or_traced(task);
1989
-#endif
1990
- return traced_stopped;
1991
-}
1992
-
1993
-static inline bool task_is_traced(struct task_struct *task)
1994
-{
1995
- bool traced = false;
1996
-
1997
- if (task->state & __TASK_TRACED)
1998
- return true;
1999
-#ifdef CONFIG_PREEMPT_RT
2000
- /* in case the task is sleeping on tasklist_lock */
2001
- raw_spin_lock_irq(&task->pi_lock);
2002
- if (task->state & __TASK_TRACED)
2003
- traced = true;
2004
- else if (task->saved_state & __TASK_TRACED)
2005
- traced = true;
2006
- raw_spin_unlock_irq(&task->pi_lock);
2007
-#endif
2008
- return traced;
20091895 }
20101896
20111897 /*