From patchwork Mon May 30 15:52:20 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vincent Guittot X-Patchwork-Id: 68848 Delivered-To: patch@linaro.org Received: by 10.140.92.199 with SMTP id b65csp1475270qge; Mon, 30 May 2016 08:52:36 -0700 (PDT) X-Received: by 10.66.185.68 with SMTP id fa4mr47724870pac.41.1464623556867; Mon, 30 May 2016 08:52:36 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w63si37154921pfb.135.2016.05.30.08.52.35; Mon, 30 May 2016 08:52:36 -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 S933421AbcE3Pwd (ORCPT + 30 others); Mon, 30 May 2016 11:52:33 -0400 Received: from mail-wm0-f51.google.com ([74.125.82.51]:33774 "EHLO mail-wm0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932930AbcE3Pwc (ORCPT ); Mon, 30 May 2016 11:52:32 -0400 Received: by mail-wm0-f51.google.com with SMTP id s131so16891789wme.0 for ; Mon, 30 May 2016 08:52:32 -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=/l6w1ianiXZxK6kMVkm0T2HmzzD00sPm8UInO1Zdz70=; b=RSLmOgLBeuT9U4wzjX/rTtEpGjXyuPPRe9yU7MvG7QD/aZgZdfllHDrtZDGs32oXWG H8BRAA7s1zNcmZFDMt8Hd92dIiCwShc/8LoTTgvSDrWZXBtWUu9ididBWqkw4T4JW6tJ HFmaD9Ht1mqISWDd0AxHL1PHw+EOEggoFXEwc= 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=/l6w1ianiXZxK6kMVkm0T2HmzzD00sPm8UInO1Zdz70=; b=kpFTXgjklurNkxoVvhQtRbvUHUnGLURmiOKuaBH3iVDk7QS8Lw85jAqplGo9kBgKac G20fg9r64bw9Sr3Ah4WRRZgizsTbtNrKCycbSyfAhaw0dj70tgJbiRNBtHSnudsd0L/y AyiksnSHEXZqkNz0M91EznoM9uWIWRmoZeSPn0DLQ1+09YvHgZzJbqGzFNHKDlnZIPjE FJ1TXtgoCQLLa0sch5MKRbn5a/TDep+ukDxjw4Xrx4rx7y/E0JMSFgT8z+J/Owv5YiPS /plr0rCyTPRTHalBEXzSYV8JFRY6PIovD3BYOFVzz2my8zXpXfWCthF7xklm/MnW/GHu IJFQ== X-Gm-Message-State: ALyK8tLxgbl+KX1JuWDhZhUO2aqaelRixex9txi8JxLZk26rX7hAqnbJmwgHLXPCJQRIq6Qf X-Received: by 10.28.185.202 with SMTP id j193mr750136wmf.83.1464623551064; Mon, 30 May 2016 08:52:31 -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 m8sm29698978wjd.34.2016.05.30.08.52.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 30 May 2016 08:52:29 -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 v3] sched: fix first task of a task group is attached twice Date: Mon, 30 May 2016 17:52:20 +0200 Message-Id: <1464623541-25429-1-git-send-email-vincent.guittot@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: References: 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 --- v3: - add initialization of load_last_update_time_copy for not 64bits system - move init into init_cfs_rq v2: - rq_clock_task(rq_of(cfs_rq)) can't be used because lock is not held kernel/sched/fair.c | 10 ++++++++++ 1 file changed, 10 insertions(+) -- 1.9.1 Tested-by: Dietmar Eggemann diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 218f8e8..86be9c1 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -8459,6 +8459,16 @@ void init_cfs_rq(struct cfs_rq *cfs_rq) cfs_rq->min_vruntime_copy = cfs_rq->min_vruntime; #endif #ifdef CONFIG_SMP + /* + * 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. + */ + cfs_rq->avg.last_update_time = 1; +#ifndef CONFIG_64BIT + cfs_rq->load_last_update_time_copy = 1; +#endif atomic_long_set(&cfs_rq->removed_load_avg, 0); atomic_long_set(&cfs_rq->removed_util_avg, 0); #endif