Merge tag 'sched-core-2022-03-22' of git://git.kernel.org/pub/scm/linux/kernel/git...
[linux-2.6-microblaze.git] / include / linux / sched.h
index 75ba8aa..fee34a8 100644 (file)
@@ -938,6 +938,9 @@ struct task_struct {
        /* Recursion prevention for eventfd_signal() */
        unsigned                        in_eventfd_signal:1;
 #endif
+#ifdef CONFIG_IOMMU_SVA
+       unsigned                        pasid_activated:1;
+#endif
 
        unsigned long                   atomic_flags; /* Flags requiring atomic access. */
 
@@ -1087,6 +1090,9 @@ struct task_struct {
        /* Restored if set_restore_sigmask() was used: */
        sigset_t                        saved_sigmask;
        struct sigpending               pending;
+#ifdef CONFIG_RT_DELAYED_SIGNALS
+       struct kernel_siginfo           forced_info;
+#endif
        unsigned long                   sas_ss_sp;
        size_t                          sas_ss_size;
        unsigned int                    sas_ss_flags;
@@ -1620,19 +1626,32 @@ static inline pid_t task_pgrp_nr(struct task_struct *tsk)
 #define TASK_REPORT_IDLE       (TASK_REPORT + 1)
 #define TASK_REPORT_MAX                (TASK_REPORT_IDLE << 1)
 
-static inline unsigned int task_state_index(struct task_struct *tsk)
+static inline unsigned int __task_state_index(unsigned int tsk_state,
+                                             unsigned int tsk_exit_state)
 {
-       unsigned int tsk_state = READ_ONCE(tsk->__state);
-       unsigned int state = (tsk_state | tsk->exit_state) & TASK_REPORT;
+       unsigned int state = (tsk_state | tsk_exit_state) & TASK_REPORT;
 
        BUILD_BUG_ON_NOT_POWER_OF_2(TASK_REPORT_MAX);
 
        if (tsk_state == TASK_IDLE)
                state = TASK_REPORT_IDLE;
 
+       /*
+        * We're lying here, but rather than expose a completely new task state
+        * to userspace, we can make this appear as if the task has gone through
+        * a regular rt_mutex_lock() call.
+        */
+       if (tsk_state == TASK_RTLOCK_WAIT)
+               state = TASK_UNINTERRUPTIBLE;
+
        return fls(state);
 }
 
+static inline unsigned int task_state_index(struct task_struct *tsk)
+{
+       return __task_state_index(READ_ONCE(tsk->__state), tsk->exit_state);
+}
+
 static inline char task_index_to_char(unsigned int state)
 {
        static const char state_char[] = "RSDTtXZPI";
@@ -2015,7 +2034,7 @@ static inline int test_tsk_need_resched(struct task_struct *tsk)
 #if !defined(CONFIG_PREEMPTION) || defined(CONFIG_PREEMPT_DYNAMIC)
 extern int __cond_resched(void);
 
-#ifdef CONFIG_PREEMPT_DYNAMIC
+#if defined(CONFIG_PREEMPT_DYNAMIC) && defined(CONFIG_HAVE_PREEMPT_DYNAMIC_CALL)
 
 DECLARE_STATIC_CALL(cond_resched, __cond_resched);
 
@@ -2024,6 +2043,14 @@ static __always_inline int _cond_resched(void)
        return static_call_mod(cond_resched)();
 }
 
+#elif defined(CONFIG_PREEMPT_DYNAMIC) && defined(CONFIG_HAVE_PREEMPT_DYNAMIC_KEY)
+extern int dynamic_cond_resched(void);
+
+static __always_inline int _cond_resched(void)
+{
+       return dynamic_cond_resched();
+}
+
 #else
 
 static inline int _cond_resched(void)