From: Byungchul Park <byungchul.p...@lge.com>

manipulating rq->cfs_tasks and numa-accounting are not meaningless on !SMP.
separate the operations from account_entity_en(de)queue.

Signed-off-by: Byungchul Park <byungchul.p...@lge.com>
---
 kernel/sched/fair.c |   40 +++++++++++++++++++++++++++-------------
 1 file changed, 27 insertions(+), 13 deletions(-)

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 09456fc..a22f255 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -2314,20 +2314,36 @@ static inline void account_numa_dequeue(struct rq *rq, 
struct task_struct *p)
 }
 #endif /* CONFIG_NUMA_BALANCING */
 
+#ifdef CONFIG_SMP
+static void account_task_enqueue(struct rq *rq, struct sched_entity *se)
+{
+       account_numa_enqueue(rq, task_of(se));
+       list_add(&se->group_node, &rq->cfs_tasks);
+}
+
+static void account_task_dequeue(struct rq *rq, struct sched_entity *se)
+{
+       account_numa_dequeue(rq, task_of(se));
+       list_del_init(&se->group_node);
+}
+#else
+static inline void account_task_enqueue(struct rq *rq, struct sched_entity *se)
+{
+}
+
+static inline void account_task_dequeue(struct rq *rq, struct sched_entity *se)
+{
+}
+#endif /* CONFIG_SMP */
+
 static void
 account_entity_enqueue(struct cfs_rq *cfs_rq, struct sched_entity *se)
 {
        update_load_add(&cfs_rq->load, se->load.weight);
        if (!parent_entity(se))
                update_load_add(&rq_of(cfs_rq)->load, se->load.weight);
-#ifdef CONFIG_SMP
-       if (entity_is_task(se)) {
-               struct rq *rq = rq_of(cfs_rq);
-
-               account_numa_enqueue(rq, task_of(se));
-               list_add(&se->group_node, &rq->cfs_tasks);
-       }
-#endif
+       if (entity_is_task(se))
+               account_task_enqueue(rq_of(cfs_rq), se);
        cfs_rq->nr_running++;
 }
 
@@ -2337,15 +2353,13 @@ account_entity_dequeue(struct cfs_rq *cfs_rq, struct 
sched_entity *se)
        update_load_sub(&cfs_rq->load, se->load.weight);
        if (!parent_entity(se))
                update_load_sub(&rq_of(cfs_rq)->load, se->load.weight);
-       if (entity_is_task(se)) {
-               account_numa_dequeue(rq_of(cfs_rq), task_of(se));
-               list_del_init(&se->group_node);
-       }
+       if (entity_is_task(se))
+               account_task_dequeue(rq_of(cfs_rq), se);
        cfs_rq->nr_running--;
 }
 
 #ifdef CONFIG_FAIR_GROUP_SCHED
-# ifdef CONFIG_SMP
+#ifdef CONFIG_SMP
 static inline long calc_tg_weight(struct task_group *tg, struct cfs_rq *cfs_rq)
 {
        long tg_weight;
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to