Merge tag 'sched-fifo-2020-08-04' of git://git.kernel.org/pub/scm/linux/kernel/git...
[sfrench/cifs-2.6.git] / include / linux / sched.h
index ae7664492af2d7a5fc941b011d251f3bb0597a88..52bcc9f48e176e46c15d1a840d2feaf3ea13d78a 100644 (file)
@@ -18,6 +18,7 @@
 #include <linux/mutex.h>
 #include <linux/plist.h>
 #include <linux/hrtimer.h>
+#include <linux/irqflags.h>
 #include <linux/seccomp.h>
 #include <linux/nodemask.h>
 #include <linux/rcupdate.h>
@@ -114,10 +115,6 @@ struct task_group;
 
 #define task_is_stopped_or_traced(task)        ((task->state & (__TASK_STOPPED | __TASK_TRACED)) != 0)
 
-#define task_contributes_to_load(task) ((task->state & TASK_UNINTERRUPTIBLE) != 0 && \
-                                        (task->flags & PF_FROZEN) == 0 && \
-                                        (task->state & TASK_NOLOAD) == 0)
-
 #ifdef CONFIG_DEBUG_ATOMIC_SLEEP
 
 /*
@@ -158,24 +155,24 @@ struct task_group;
  *
  *   for (;;) {
  *     set_current_state(TASK_UNINTERRUPTIBLE);
- *     if (!need_sleep)
- *             break;
+ *     if (CONDITION)
+ *        break;
  *
  *     schedule();
  *   }
  *   __set_current_state(TASK_RUNNING);
  *
  * If the caller does not need such serialisation (because, for instance, the
- * condition test and condition change and wakeup are under the same lock) then
+ * CONDITION test and condition change and wakeup are under the same lock) then
  * use __set_current_state().
  *
  * The above is typically ordered against the wakeup, which does:
  *
- *   need_sleep = false;
+ *   CONDITION = 1;
  *   wake_up_state(p, TASK_UNINTERRUPTIBLE);
  *
- * where wake_up_state() executes a full memory barrier before accessing the
- * task state.
+ * where wake_up_state()/try_to_wake_up() executes a full memory barrier before
+ * accessing p->state.
  *
  * Wakeup will do: if (@state & p->state) p->state = TASK_RUNNING, that is,
  * once it observes the TASK_UNINTERRUPTIBLE store the waking CPU can issue a
@@ -378,7 +375,7 @@ struct util_est {
  * For cfs_rq, they are the aggregated values of all runnable and blocked
  * sched_entities.
  *
- * The load/runnable/util_avg doesn't direcly factor frequency scaling and CPU
+ * The load/runnable/util_avg doesn't directly factor frequency scaling and CPU
  * capacity scaling. The scaling is done through the rq_clock_pelt that is used
  * for computing those signals (see update_rq_clock_pelt())
  *
@@ -654,9 +651,8 @@ struct task_struct {
        unsigned int                    ptrace;
 
 #ifdef CONFIG_SMP
-       struct llist_node               wake_entry;
-       unsigned int                    wake_entry_type;
        int                             on_cpu;
+       struct __call_single_node       wake_entry;
 #ifdef CONFIG_THREAD_INFO_IN_TASK
        /* Current CPU: */
        unsigned int                    cpu;
@@ -691,9 +687,15 @@ struct task_struct {
        struct sched_dl_entity          dl;
 
 #ifdef CONFIG_UCLAMP_TASK
-       /* Clamp values requested for a scheduling entity */
+       /*
+        * Clamp values requested for a scheduling entity.
+        * Must be updated with task_rq_lock() held.
+        */
        struct uclamp_se                uclamp_req[UCLAMP_CNT];
-       /* Effective clamp values used for a scheduling entity */
+       /*
+        * Effective clamp values used for a scheduling entity.
+        * Must be updated with task_rq_lock() held.
+        */
        struct uclamp_se                uclamp[UCLAMP_CNT];
 #endif
 
@@ -985,19 +987,9 @@ struct task_struct {
 #endif
 
 #ifdef CONFIG_TRACE_IRQFLAGS
-       unsigned int                    irq_events;
+       struct irqtrace_events          irqtrace;
        unsigned int                    hardirq_threaded;
-       unsigned long                   hardirq_enable_ip;
-       unsigned long                   hardirq_disable_ip;
-       unsigned int                    hardirq_enable_event;
-       unsigned int                    hardirq_disable_event;
-       int                             hardirqs_enabled;
-       int                             hardirq_context;
        u64                             hardirq_chain_key;
-       unsigned long                   softirq_disable_ip;
-       unsigned long                   softirq_enable_ip;
-       unsigned int                    softirq_disable_event;
-       unsigned int                    softirq_enable_event;
        int                             softirqs_enabled;
        int                             softirq_context;
        int                             irq_config;
@@ -1198,8 +1190,12 @@ struct task_struct {
 #ifdef CONFIG_KASAN
        unsigned int                    kasan_depth;
 #endif
+
 #ifdef CONFIG_KCSAN
        struct kcsan_ctx                kcsan_ctx;
+#ifdef CONFIG_TRACE_IRQFLAGS
+       struct irqtrace_events          kcsan_save_irqtrace;
+#endif
 #endif
 
 #ifdef CONFIG_FUNCTION_GRAPH_TRACER
@@ -1511,7 +1507,6 @@ extern struct pid *cad_pid;
 #define PF_KTHREAD             0x00200000      /* I am a kernel thread */
 #define PF_RANDOMIZE           0x00400000      /* Randomize virtual address space */
 #define PF_SWAPWRITE           0x00800000      /* Allowed to write to swap */
-#define PF_UMH                 0x02000000      /* I'm an Usermodehelper process */
 #define PF_NO_SETAFFINITY      0x04000000      /* Userland is not allowed to meddle with cpus_mask */
 #define PF_MCE_EARLY           0x08000000      /* Early kill for mce process policy */
 #define PF_MEMALLOC_NOCMA      0x10000000      /* All allocation request will have _GFP_MOVABLE cleared */
@@ -2023,14 +2018,6 @@ static inline void rseq_execve(struct task_struct *t)
 
 #endif
 
-void __exit_umh(struct task_struct *tsk);
-
-static inline void exit_umh(struct task_struct *tsk)
-{
-       if (unlikely(tsk->flags & PF_UMH))
-               __exit_umh(tsk);
-}
-
 #ifdef CONFIG_DEBUG_RSEQ
 
 void rseq_syscall(struct pt_regs *regs);
@@ -2052,6 +2039,7 @@ const struct sched_avg *sched_trace_rq_avg_dl(struct rq *rq);
 const struct sched_avg *sched_trace_rq_avg_irq(struct rq *rq);
 
 int sched_trace_rq_cpu(struct rq *rq);
+int sched_trace_rq_nr_running(struct rq *rq);
 
 const struct cpumask *sched_trace_rd_span(struct root_domain *rd);