From patchwork Tue May 24 13:08:55 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vincent Guittot X-Patchwork-Id: 68498 Delivered-To: patch@linaro.org Received: by 10.140.92.199 with SMTP id b65csp621422qge; Tue, 24 May 2016 06:09:31 -0700 (PDT) X-Received: by 10.98.54.194 with SMTP id d185mr6777249pfa.34.1464095370925; Tue, 24 May 2016 06:09:30 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b5si4682299pfc.179.2016.05.24.06.09.30; Tue, 24 May 2016 06:09:30 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932808AbcEXNJW (ORCPT + 30 others); Tue, 24 May 2016 09:09:22 -0400 Received: from mail-wm0-f54.google.com ([74.125.82.54]:36511 "EHLO mail-wm0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751627AbcEXNJT (ORCPT ); Tue, 24 May 2016 09:09:19 -0400 Received: by mail-wm0-f54.google.com with SMTP id n129so129310307wmn.1 for ; Tue, 24 May 2016 06:09:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=1dIDGjtOLWFdZeZIEuryHNoStGKeudoep4GCJr4agcY=; b=FFnS2OfbwY9sRp0chct+9loAe0dxF8XvrQoIGvqHb25E3O5RHp1vddE/zw1CjTCgFi WQWgmw1ie8+4mg11FmLwckKqEPy+tdak2qHzph36CNQWkzTkm5GQrwbRTlNMbEelPmB0 Mksn3apK/AP+qFtefoVAJgaDx0bd0CFna/p3c= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=1dIDGjtOLWFdZeZIEuryHNoStGKeudoep4GCJr4agcY=; b=aeniQFpSYDDfBrVFo/UbiJwObCBWzq18m3GkdvyskKqYH04SFnq440IcYhW6BTxSrO r01ZP6gBsr+Fba6DGjA4jxmarO/hJKm4+DfJiWtUA3XmXCmsbSAAaRYLO5Pal+gX5Tkl JxHdoT+AZFzbX7TyRkg2kFCiwUtmL2031Pkb4ZtA813pjwOw/3sWa1Clw9bq2FkAN9KF 9rDRnlYg7ZBR4yccTwkmITDNyzK2NZYXXR+/GBA47QPN1xrKvbRZdz0rjt76cmmRXnQt nwV9obPYNzQxPM7K882H40HFoGwKsRusOoUtm5IUtJ0keaJ6F2L6BzENl17wp919S1+0 gLBw== X-Gm-Message-State: ALyK8tJmAGQB12l3Vr6z0K2SKRhIVG/aA9lxkY4VSe7kjqdmLFPFTaoxLrsD9tw3kaxb3fuf X-Received: by 10.194.104.40 with SMTP id gb8mr4010100wjb.84.1464095357667; Tue, 24 May 2016 06:09:17 -0700 (PDT) Received: from localhost.localdomain (pas72-3-88-189-71-117.fbx.proxad.net. [88.189.71.117]) by smtp.gmail.com with ESMTPSA id hm7sm3145006wjb.41.2016.05.24.06.09.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 24 May 2016 06:09:16 -0700 (PDT) From: Vincent Guittot To: peterz@infradead.org, mingo@kernel.org, linux-kernel@vger.kernel.org Cc: yuyang.du@intel.com, dietmar.eggemann@arm.com, Vincent Guittot Subject: [PATCH] sched: fix first task of a task group is attached twice Date: Tue, 24 May 2016 15:08:55 +0200 Message-Id: <1464095335-27730-1-git-send-email-vincent.guittot@linaro.org> X-Mailer: git-send-email 1.9.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The cfs_rq->avg.last_update_time is initialize to 0 with the main effect that the 1st sched_entity that will be attached, will keep its last_update_time set to 0 and will attached once again during the enqueue. Initialize cfs_rq->avg.last_update_time to current rq's clock Signed-off-by: Vincent Guittot --- kernel/sched/fair.c | 8 ++++++++ 1 file changed, 8 insertions(+) -- 1.9.1 diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 218f8e8..a4e2c10 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -8586,6 +8586,14 @@ void init_tg_cfs_entry(struct task_group *tg, struct cfs_rq *cfs_rq, se->depth = parent->depth + 1; } + /* + * Set last_update_time to something different from 0 to make + * sure the 1st sched_entity will not be attached twice: once + * when attaching the task to the group and one more time when + * enqueueing the task. + */ + tg->cfs_rq[cpu]->avg.last_update_time = rq_clock_task(rq_of(cfs_rq)); + se->my_q = cfs_rq; /* guarantee group entities always have weight */ update_load_set(&se->load, NICE_0_LOAD);