Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753092AbbHSGsE (ORCPT ); Wed, 19 Aug 2015 02:48:04 -0400 Received: from LGEMRELSE7Q.lge.com ([156.147.1.151]:60251 "EHLO lgemrelse7q.lge.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752839AbbHSGrz (ORCPT ); Wed, 19 Aug 2015 02:47:55 -0400 X-Original-SENDERIP: 10.177.222.33 X-Original-MAILFROM: byungchul.park@lge.com From: byungchul.park@lge.com To: mingo@kernel.org, peterz@infradead.org Cc: linux-kernel@vger.kernel.org, yuyang.du@intel.com, Byungchul Park Subject: [PATCH v3 3/5] sched: sync a se with prev cfs_rq when changing cgroup Date: Wed, 19 Aug 2015 15:47:14 +0900 Message-Id: <1439966836-11266-4-git-send-email-byungchul.park@lge.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1439966836-11266-1-git-send-email-byungchul.park@lge.com> References: <1439966836-11266-1-git-send-email-byungchul.park@lge.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1463 Lines: 41 From: Byungchul Park current code is wrong with cfs_rq's average load when changing a task's cfs_rq to another. i tested with "echo pid > cgroup" and found that e.g. cfs_rq->avg.load_avg became larger and larger whenever changing cgroup to another again and again. we have to sync se's average load with both *prev* cfs_rq and next cfs_rq when changing its cgroup. Signed-off-by: Byungchul Park --- kernel/sched/fair.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 191d9be..1be042a 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -8040,8 +8040,14 @@ static void task_move_group_fair(struct task_struct *p, int queued) if (!queued && (!se->sum_exec_runtime || p->state == TASK_WAKING)) queued = 1; + cfs_rq = cfs_rq_of(se); if (!queued) - se->vruntime -= cfs_rq_of(se)->min_vruntime; + se->vruntime -= cfs_rq->min_vruntime; + +#ifdef CONFIG_SMP + /* synchronize task with its prev cfs_rq */ + detach_entity_load_avg(cfs_rq, se); +#endif set_task_rq(p, task_cpu(p)); se->depth = se->parent ? se->parent->depth + 1 : 0; cfs_rq = cfs_rq_of(se); -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/