From patchwork Wed May 25 15:01:11 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vincent Guittot X-Patchwork-Id: 68610 Delivered-To: patch@linaro.org Received: by 10.140.92.199 with SMTP id b65csp1264248qge; Wed, 25 May 2016 08:01:39 -0700 (PDT) X-Received: by 10.98.66.142 with SMTP id h14mr6461090pfd.11.1464188499870; Wed, 25 May 2016 08:01:39 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n8si13108284paw.216.2016.05.25.08.01.39; Wed, 25 May 2016 08:01:39 -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 S1755595AbcEYPBc (ORCPT + 30 others); Wed, 25 May 2016 11:01:32 -0400 Received: from mail-wm0-f46.google.com ([74.125.82.46]:37965 "EHLO mail-wm0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754394AbcEYPB3 (ORCPT ); Wed, 25 May 2016 11:01:29 -0400 Received: by mail-wm0-f46.google.com with SMTP id n129so66497059wmn.1 for ; Wed, 25 May 2016 08:01:29 -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:in-reply-to:references; bh=47QdvOPDdYJiZZowAGShvgpoYkr73UKRnpEK/lT92mE=; b=kG55VD/zzTe6QnUyp9LevMeU5xcZ1OKHdPOLFPXddr5pC+A0X0Zu37SZ+nubIQ/G/R b4Sbo2EO8qMLzllnPs7BT3W5jYtud28sn+7ufWy1Hws0s5vskDW/0eWoIQT5YCV+lH29 2n/Z5SbmHx2LHMyzmj5ch+TL9kQEmQKvoLfis= 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:in-reply-to :references; bh=47QdvOPDdYJiZZowAGShvgpoYkr73UKRnpEK/lT92mE=; b=H+YquxcfOYVWGy33NX2LyKLocj7YSWqQ1Z027OqG37YEcM/Pl7ZoL+zdJvJVzCjsfW P4Lb5I++4KWtCuR5fmOLl0GvFBwXuk0vNgoeW5D1JP5hFNbYdGDtAUxzEz773ljhSHR4 n32U/XcD2q/1IlSIIheEGmbKuCOeSH7Zksv98JUusbHV+DDj2L72A5s1iNutM3hrylNM DjSyS+vI8INGvXkD8QWJ58k6/6EhmBK9tTlU6+PYtnTc9XSO+EiLW0otK8yjLfSenfvT 306zQeGTeupeCyNcMx93zNchGy9/qYdDvrixRIAi9esYQuFStCROcReiyGv77CJCkvoE ILwA== X-Gm-Message-State: ALyK8tJJU9LIvjD/iOcSLBG1rUqhUpdcvzfD5AWgVbYhQj3vABx7STtPETwet99FZx7XQ2C4 X-Received: by 10.28.217.79 with SMTP id q76mr3994332wmg.83.1464188473892; Wed, 25 May 2016 08:01:13 -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 t3sm25197774wmf.20.2016.05.25.08.01.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 25 May 2016 08:01:12 -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 v2] sched: fix first task of a task group is attached twice Date: Wed, 25 May 2016 17:01:11 +0200 Message-Id: <1464188472-30086-1-git-send-email-vincent.guittot@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1464095335-27730-1-git-send-email-vincent.guittot@linaro.org> References: <1464095335-27730-1-git-send-email-vincent.guittot@linaro.org> 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 1 instead. Signed-off-by: Vincent Guittot --- v2: - rq_clock_task(rq_of(cfs_rq)) can't be used because lock is not held 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..3724656 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 = 1; + se->my_q = cfs_rq; /* guarantee group entities always have weight */ update_load_set(&se->load, NICE_0_LOAD);