From: Byungchul Park <byungchul.p...@lge.com> change from v1 to v2 * separate the SMP operations as a function instead of embedding
change from v2 to v3 * use (cfs_rq, se) instead of (rq, se) as function parameters * add additional commit message ----->8----- >From 435029844f86905a67e69f7835878c728336557b Mon Sep 17 00:00:00 2001 From: Byungchul Park <byungchul.p...@lge.com> Date: Fri, 7 Aug 2015 15:16:49 +0900 Subject: [PATCH v3] sched: separate operations only for SMP from account_entity_en(de)queue manipulating a list(rq->cfs_tasks) and numa-accounting are not measningless on !SMP. this patch separates it from account_entity_en(de)queue. even though account_entity_dequeue() does refer the list node, not header which is defined only in SMP case, it also manipulates the list which is for SMP. therefore all minipulating the list should be separated together. Signed-off-by: Byungchul Park <byungchul.p...@lge.com> --- kernel/sched/fair.c | 44 +++++++++++++++++++++++++++++++------------- 1 file changed, 31 insertions(+), 13 deletions(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index ffa70dc..e4281c9 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -2314,20 +2314,40 @@ 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 cfs_rq *cfs_rq, struct sched_entity *se) +{ + struct rq *rq = rq_of(cfs_rq); + + account_numa_enqueue(rq, task_of(se)); + list_add(&se->group_node, &rq->cfs_tasks); +} + +static void account_task_dequeue(struct cfs_rq *cfs_rq, struct sched_entity *se) +{ + struct rq *rq = rq_of(cfs_rq); + + account_numa_dequeue(rq, task_of(se)); + list_del_init(&se->group_node); +} +#else +static inline void account_task_enqueue(struct cfs_rq *cfs_rq, struct sched_entity *se) +{ +} + +static inline void account_task_dequeue(struct cfs_rq *cfs_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(cfs_rq, se); cfs_rq->nr_running++; } @@ -2337,15 +2357,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(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/