Merge branch 'sched/warnings' into sched/core, to pick up WARN_ON_ONCE() conversion...
[linux-2.6-block.git] / kernel / sched / sched.h
index a6f071b2acacf586f2322bf9f7f9a514d171f5ea..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);
@@ -481,9 +466,6 @@ extern void __refill_cfs_bandwidth_runtime(struct cfs_bandwidth *cfs_b);
 extern void start_cfs_bandwidth(struct cfs_bandwidth *cfs_b);
 extern void unthrottle_cfs_rq(struct cfs_rq *cfs_rq);
 
-extern void unregister_rt_sched_group(struct task_group *tg);
-extern void free_rt_sched_group(struct task_group *tg);
-extern int alloc_rt_sched_group(struct task_group *tg, struct task_group *parent);
 extern void init_tg_rt_entry(struct task_group *tg, struct rt_rq *rt_rq,
                struct sched_rt_entity *rt_se, int cpu,
                struct sched_rt_entity *parent);
@@ -521,6 +503,10 @@ struct cfs_bandwidth { };
 
 #endif /* CONFIG_CGROUP_SCHED */
 
+extern void unregister_rt_sched_group(struct task_group *tg);
+extern void free_rt_sched_group(struct task_group *tg);
+extern int alloc_rt_sched_group(struct task_group *tg, struct task_group *parent);
+
 /*
  * u64_u32_load/u64_u32_store
  *
@@ -1814,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;
        /*
@@ -1941,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
@@ -2203,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
 };
 
@@ -2708,8 +2697,8 @@ static inline void double_rq_lock(struct rq *rq1, struct rq *rq2)
        __acquires(rq1->lock)
        __acquires(rq2->lock)
 {
-       BUG_ON(!irqs_disabled());
-       BUG_ON(rq1 != rq2);
+       WARN_ON_ONCE(!irqs_disabled());
+       WARN_ON_ONCE(rq1 != rq2);
        raw_spin_rq_lock(rq1);
        __acquire(rq2->lock);   /* Fake it out ;) */
        double_rq_clock_clear_update(rq1, rq2);
@@ -2725,7 +2714,7 @@ static inline void double_rq_unlock(struct rq *rq1, struct rq *rq2)
        __releases(rq1->lock)
        __releases(rq2->lock)
 {
-       BUG_ON(rq1 != rq2);
+       WARN_ON_ONCE(rq1 != rq2);
        raw_spin_rq_unlock(rq1);
        __release(rq2->lock);
 }
@@ -2895,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;
@@ -3156,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 */