From patchwork Tue Jan 21 16:12:18 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vincent Guittot X-Patchwork-Id: 23444 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-oa0-f70.google.com (mail-oa0-f70.google.com [209.85.219.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 70D9A202DA for ; Tue, 21 Jan 2014 16:13:03 +0000 (UTC) Received: by mail-oa0-f70.google.com with SMTP id m1sf29878117oag.5 for ; Tue, 21 Jan 2014 08:13:02 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=ymNPEPR1BrX7vHwgd8gfSG6am4AyGXZTlRK0LoxjoSU=; b=YqBATMeeG6y78JSHlgbGT/t/loYJVq7E11UWHdPQzZE7I6EsbVUxTGBj9qah1f0gcL XkGx5pmmEbKrhDA7rrtVmrzctK1BKp4uqZlvTC/ICIKwQqJwjvUCKho+nmsJpSJ2IC9K ZWWb0JoVO3/Epu3m6cvuAVrC9WxesFXTo39q489VI/rEAlaI5bGM+PDcwJbv51JsvuJ1 1JhS3lWRWSYWsQkAy1G2/YCzW6tO0x3RGL8b+qLGgEcWUxIPVUoIT2q14zh8axGSegm1 vLmHgo2MCzaZzYFfxLsBWg1MQgV8DljrepmhJuaof1W2cDRzwymrtBvUMxo0ar0bgYC6 vKIw== X-Gm-Message-State: ALoCoQmgG+0MzBITY7v+Ch/a0y0k10ZWMb3ELOl9ygMrojKqlW/PipRQ/yJlVJL5jwVGOEJNOJGx X-Received: by 10.182.87.225 with SMTP id bb1mr9344921obb.16.1390320782576; Tue, 21 Jan 2014 08:13:02 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.46.35 with SMTP id j32ls1307942qga.40.gmail; Tue, 21 Jan 2014 08:13:02 -0800 (PST) X-Received: by 10.58.235.129 with SMTP id um1mr15274698vec.17.1390320782355; Tue, 21 Jan 2014 08:13:02 -0800 (PST) Received: from mail-vc0-f173.google.com (mail-vc0-f173.google.com [209.85.220.173]) by mx.google.com with ESMTPS id gq1si2318126vec.137.2014.01.21.08.13.02 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 21 Jan 2014 08:13:02 -0800 (PST) Received-SPF: neutral (google.com: 209.85.220.173 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.173; Received: by mail-vc0-f173.google.com with SMTP id ld13so3584848vcb.4 for ; Tue, 21 Jan 2014 08:13:02 -0800 (PST) X-Received: by 10.58.202.8 with SMTP id ke8mr10420vec.80.1390320782275; Tue, 21 Jan 2014 08:13:02 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.174.196 with SMTP id u4csp126588vcz; Tue, 21 Jan 2014 08:13:01 -0800 (PST) X-Received: by 10.194.82.105 with SMTP id h9mr2942972wjy.52.1390320780982; Tue, 21 Jan 2014 08:13:00 -0800 (PST) Received: from mail-we0-f172.google.com (mail-we0-f172.google.com [74.125.82.172]) by mx.google.com with ESMTPS id gg4si3698640wjc.150.2014.01.21.08.13.00 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 21 Jan 2014 08:13:00 -0800 (PST) Received-SPF: neutral (google.com: 74.125.82.172 is neither permitted nor denied by best guess record for domain of vincent.guittot@linaro.org) client-ip=74.125.82.172; Received: by mail-we0-f172.google.com with SMTP id q58so8356459wes.3 for ; Tue, 21 Jan 2014 08:13:00 -0800 (PST) X-Received: by 10.180.99.39 with SMTP id en7mr15498937wib.10.1390320780443; Tue, 21 Jan 2014 08:13:00 -0800 (PST) Received: from lmenx30s.lme.st.com (LPuteaux-156-14-44-212.w82-127.abo.wanadoo.fr. [82.127.83.212]) by mx.google.com with ESMTPSA id ev4sm11436632wib.1.2014.01.21.08.12.58 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 21 Jan 2014 08:12:59 -0800 (PST) From: Vincent Guittot To: peterz@infradead.org, linux-kernel@vger.kernel.org Cc: mingo@kernel.org, pjt@google.com, bsegall@google.com, linaro-kernel@lists.linaro.org, Vincent Guittot Subject: [PATCH] sched: fix sched_entity avg statistics update Date: Tue, 21 Jan 2014 17:12:18 +0100 Message-Id: <1390320738-4555-1-git-send-email-vincent.guittot@linaro.org> X-Mailer: git-send-email 1.7.9.5 X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: vincent.guittot@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.173 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , With the current implementation, the load average statistics of a sched entity change according to other activity on the CPU even if this activity is done between the running window of the sched entity and have no influence on the running duration of the task. When a task wakes up on the same CPU, we currently update last_runnable_update with the return of __synchronize_entity_decay without updating the runnable_avg_sum and runnable_avg_period accordingly. In fact, we have to sync the load_contrib of the se with the rq's blocked_load_contrib before removing it from the latter (with __synchronize_entity_decay) but we must keep last_runnable_update unchanged for updating runnable_avg_sum/period during the next update_entity_load_avg. Signed-off-by: Vincent Guittot --- kernel/sched/fair.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index e64b079..5b0ef90 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -2370,8 +2370,7 @@ static inline void enqueue_entity_load_avg(struct cfs_rq *cfs_rq, * would have made count negative); we must be careful to avoid * double-accounting blocked time after synchronizing decays. */ - se->avg.last_runnable_update += __synchronize_entity_decay(se) - << 20; + __synchronize_entity_decay(se); } /* migrated tasks did not contribute to our blocked load */