Merge branch 'sched/warnings' into sched/core, to pick up WARN_ON_ONCE() conversion...
[linux-2.6-block.git] / kernel / sched / sched.h
index 7a44dceeb50a106b066843a15e98bb53b1e0e56e..b75ac74986fb4b9b290bbd82dd44a9d8bb944b7e 100644 (file)
@@ -321,21 +321,6 @@ struct dl_bw {
        u64                     total_bw;
 };
 
-/*
- * Verify the fitness of task @p to run on @cpu taking into account the
- * CPU original capacity and the runtime/deadline ratio of the task.
- *
- * The function will return true if the CPU original capacity of the
- * @cpu scaled by SCHED_CAPACITY_SCALE >= runtime/deadline ratio of the
- * task and false otherwise.
- */
-static inline bool dl_task_fits_capacity(struct task_struct *p, int cpu)
-{
-       unsigned long cap = arch_scale_cpu_capacity(cpu);
-
-       return cap_scale(p->dl.dl_deadline, cap) >= p->dl.dl_runtime;
-}
-
 extern void init_dl_bw(struct dl_bw *dl_b);
 extern int  sched_dl_global_validate(void);
 extern void sched_dl_do_global(void);
@@ -1815,6 +1800,11 @@ DECLARE_PER_CPU(struct sched_domain __rcu *, sd_asym_packing);
 DECLARE_PER_CPU(struct sched_domain __rcu *, sd_asym_cpucapacity);
 extern struct static_key_false sched_asym_cpucapacity;
 
+static __always_inline bool sched_asym_cpucap_active(void)
+{
+       return static_branch_unlikely(&sched_asym_cpucapacity);
+}
+
 struct sched_group_capacity {
        atomic_t                ref;
        /*
@@ -1942,6 +1932,7 @@ static inline void set_task_rq(struct task_struct *p, unsigned int cpu)
        set_task_rq_fair(&p->se, p->se.cfs_rq, tg->cfs_rq[cpu]);
        p->se.cfs_rq = tg->cfs_rq[cpu];
        p->se.parent = tg->se[cpu];
+       p->se.depth = tg->se[cpu] ? tg->se[cpu]->depth + 1 : 0;
 #endif
 
 #ifdef CONFIG_RT_GROUP_SCHED
@@ -2204,11 +2195,8 @@ struct sched_class {
 
        void (*update_curr)(struct rq *rq);
 
-#define TASK_SET_GROUP         0
-#define TASK_MOVE_GROUP                1
-
 #ifdef CONFIG_FAIR_GROUP_SCHED
-       void (*task_change_group)(struct task_struct *p, int type);
+       void (*task_change_group)(struct task_struct *p);
 #endif
 };
 
@@ -2896,6 +2884,21 @@ unsigned long effective_cpu_util(int cpu, unsigned long util_cfs,
                                 enum cpu_util_type type,
                                 struct task_struct *p);
 
+/*
+ * Verify the fitness of task @p to run on @cpu taking into account the
+ * CPU original capacity and the runtime/deadline ratio of the task.
+ *
+ * The function will return true if the original capacity of @cpu is
+ * greater than or equal to task's deadline density right shifted by
+ * (BW_SHIFT - SCHED_CAPACITY_SHIFT) and false otherwise.
+ */
+static inline bool dl_task_fits_capacity(struct task_struct *p, int cpu)
+{
+       unsigned long cap = arch_scale_cpu_capacity(cpu);
+
+       return cap >= p->dl.dl_density >> (BW_SHIFT - SCHED_CAPACITY_SHIFT);
+}
+
 static inline unsigned long cpu_bw_dl(struct rq *rq)
 {
        return (rq->dl.running_bw * SCHED_CAPACITY_SCALE) >> BW_SHIFT;
@@ -3157,4 +3160,14 @@ extern int sched_dynamic_mode(const char *str);
 extern void sched_dynamic_update(int mode);
 #endif
 
+static inline void update_current_exec_runtime(struct task_struct *curr,
+                                               u64 now, u64 delta_exec)
+{
+       curr->se.sum_exec_runtime += delta_exec;
+       account_group_exec_runtime(curr, delta_exec);
+
+       curr->se.exec_start = now;
+       cgroup_account_cputime(curr, delta_exec);
+}
+
 #endif /* _KERNEL_SCHED_SCHED_H */