Received: by 10.223.185.116 with SMTP id b49csp3506508wrg; Tue, 13 Feb 2018 03:29:41 -0800 (PST) X-Google-Smtp-Source: AH8x2249PUVTk5AyEAZflKZVOWs3g2Rol7CSDzLjG38zfr5J+BpZUwVroncEeSPm931Dk0JudC+6 X-Received: by 10.98.161.7 with SMTP id b7mr957854pff.68.1518521381295; Tue, 13 Feb 2018 03:29:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518521381; cv=none; d=google.com; s=arc-20160816; b=dXHQVLYEmR5lhiyhthtjdge012J/P/75udkWzJiFBEOaNfVMf+T54gqQyxY+ptV1hf rZi72TwfOZZxODDY5kX45/zNkamG6HB5QkNODluqsKeODgFP5T+FpXB91oHNuC5tCJYC Q1phrgMpt3VFCKgKmCFXfhgXGvMwlBaj2o+vM6R4VnzNHcCEjiciDsw8UUOsoEyJ6xBL raK9Yph4J6jvLtKFQwDFJvXruttBI3sEhEaMSOBandBrraFDDCJeZQUmUpBBAxVueKir Drd4MtA7s7BTZ+uEBMool1aH9Cf6PrnWIDilD58XO2e/m51WVsVCmrH0aqC9xb2XP4vM wiCw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-disposition :content-transfer-encoding:mime-version:robot-unsubscribe:robot-id :git-commit-id:subject:to:references:in-reply-to:reply-to:cc :message-id:from:date:arc-authentication-results; bh=MWxk3fsQBKuCq9EsGdipfguLs5KhuVTCmlez0SLWRVs=; b=vuw5h3ZafifIDO+EgoSDTLQThgs7B6SgkA9DvOKPIczbosm+Y+wjZhkrfUt0Hc8PrH HWjqpjYmrk1f0STX0m3Jf+4aDMP7HNp8xkKwdOnh6dhXWp7mTx8W+P5xtx0/7To9cXre t+5ImZAi6bjQMSl6gyGFVhkeTEZUAk9IIDHtT8/QY9WwUlSLODyBlmzSUOWr7B81rnTn sNiSM8GHtwnEnbVOBP2LkSRc/uXSk+QcklnPwo08kirGMnb/S46+rPPpXxX60CpLfh1i EdttbgYKmeo/JwPtVpaAfsOqa2dRZiFCPFAFnDhliRcm92sSnrQg7ab8eJVvrKGKZMgC yJgA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o125si4694739pga.697.2018.02.13.03.29.26; Tue, 13 Feb 2018 03:29:41 -0800 (PST) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934211AbeBML2k (ORCPT + 99 others); Tue, 13 Feb 2018 06:28:40 -0500 Received: from terminus.zytor.com ([198.137.202.136]:52519 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933926AbeBML2i (ORCPT ); Tue, 13 Feb 2018 06:28:38 -0500 Received: from terminus.zytor.com (localhost [127.0.0.1]) by terminus.zytor.com (8.15.2/8.15.2) with ESMTP id w1DBSETu014284; Tue, 13 Feb 2018 03:28:14 -0800 Received: (from tipbot@localhost) by terminus.zytor.com (8.15.2/8.15.2/Submit) id w1DBSDAV014281; Tue, 13 Feb 2018 03:28:13 -0800 Date: Tue, 13 Feb 2018 03:28:13 -0800 X-Authentication-Warning: terminus.zytor.com: tipbot set sender to tipbot@zytor.com using -f From: tip-bot for Wen Yang Message-ID: Cc: mingo@kernel.org, hpa@zytor.com, peterz@infradead.org, tglx@linutronix.de, jiang.biao2@zte.com.cn, linux-kernel@vger.kernel.org, torvalds@linux-foundation.org, wen.yang99@zte.com.cn Reply-To: peterz@infradead.org, tglx@linutronix.de, hpa@zytor.com, mingo@kernel.org, wen.yang99@zte.com.cn, torvalds@linux-foundation.org, linux-kernel@vger.kernel.org, jiang.biao2@zte.com.cn In-Reply-To: <1517882148-44599-1-git-send-email-wen.yang99@zte.com.cn> References: <1517882148-44599-1-git-send-email-wen.yang99@zte.com.cn> To: linux-tip-commits@vger.kernel.org Subject: [tip:sched/urgent] sched/deadline: Make update_curr_dl() more accurate Git-Commit-ID: 6fe0ce1eb04f99a1eb1eb6e7f775666966cf6c80 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00 autolearn=ham autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on terminus.zytor.com Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 6fe0ce1eb04f99a1eb1eb6e7f775666966cf6c80 Gitweb: https://git.kernel.org/tip/6fe0ce1eb04f99a1eb1eb6e7f775666966cf6c80 Author: Wen Yang AuthorDate: Tue, 6 Feb 2018 09:55:48 +0800 Committer: Ingo Molnar CommitDate: Tue, 13 Feb 2018 11:44:40 +0100 sched/deadline: Make update_curr_dl() more accurate rq->clock_task may be updated between the two calls of rq_clock_task() in update_curr_dl(). Calling rq_clock_task() only once makes it more accurate and efficient, taking update_curr() as reference. Suggested-by: Peter Zijlstra Signed-off-by: Wen Yang Signed-off-by: Peter Zijlstra (Intel) Reviewed-by: Jiang Biao Cc: Linus Torvalds Cc: Thomas Gleixner Cc: zhong.weidong@zte.com.cn Link: http://lkml.kernel.org/r/1517882148-44599-1-git-send-email-wen.yang99@zte.com.cn Signed-off-by: Ingo Molnar --- kernel/sched/deadline.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c index 9bb0e0c..9df0978 100644 --- a/kernel/sched/deadline.c +++ b/kernel/sched/deadline.c @@ -1153,6 +1153,7 @@ static void update_curr_dl(struct rq *rq) struct sched_dl_entity *dl_se = &curr->dl; u64 delta_exec, scaled_delta_exec; int cpu = cpu_of(rq); + u64 now; if (!dl_task(curr) || !on_dl_rq(dl_se)) return; @@ -1165,7 +1166,8 @@ static void update_curr_dl(struct rq *rq) * natural solution, but the full ramifications of this * approach need further study. */ - delta_exec = rq_clock_task(rq) - curr->se.exec_start; + now = rq_clock_task(rq); + delta_exec = now - curr->se.exec_start; if (unlikely((s64)delta_exec <= 0)) { if (unlikely(dl_se->dl_yielded)) goto throttle; @@ -1178,7 +1180,7 @@ static void update_curr_dl(struct rq *rq) curr->se.sum_exec_runtime += delta_exec; account_group_exec_runtime(curr, delta_exec); - curr->se.exec_start = rq_clock_task(rq); + curr->se.exec_start = now; cgroup_account_cputime(curr, delta_exec); sched_rt_avg_update(rq, delta_exec);