Received: by 10.223.176.5 with SMTP id f5csp572963wra; Tue, 6 Feb 2018 04:00:35 -0800 (PST) X-Google-Smtp-Source: AH8x226q8K93LsgyhrV2tFUTeqNG3ngiygoLnk9kHxBH+j2PWsVzM5TbHYX5PZwt4euAZ4c0E0uk X-Received: by 10.101.90.8 with SMTP id y8mr1776542pgs.34.1517918435142; Tue, 06 Feb 2018 04:00:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517918435; cv=none; d=google.com; s=arc-20160816; b=i0X7lEEDKdT7izahfGwjuYlXzXmYYFWF4qcIFXLA4F2n/vi8xMv+HZgL0BuxBB/Xnl /Grda1ahCWghTDeFrWj2eHzkS5cGNXGi73AoF4TPBOE0yFWgEjVrNQUKzxB6rp+prfD7 lgR3q62LOm9ntPSZWSY6NBe1EuF33+nf/TZ3HQZVeZ7muWFhJ8jQ9gM1+7XjuPsl5h5X dfGaeQ7ZkMJJTq1zKoSZkcBUcB6cvxIu8PAg7BSGfFUNNxyW5TjYZP4jl9ASF5o2W/oN rezxojD5uKt6UR9JUoGAcT5hXx46dwsnPQ7V2XhGcXh1vnu98feklwV5EbLyF2h+o/qy TuXA== 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=z9kTpTGRA/0YpVv3OE5DcfFK3kGN+IeR5S+Rja0GLcU=; b=qd/oF/X01ITR3oLjYXy+CSpnCOZRR0aVOzFxmM93Btk8C5IHlfaLSMl14WnYvyocJ9 jHx8fDvybvM2Y9Ucu7ehsenKx4G7Iwbcr5CGkQd1cKRYD8po+uxxrQsx37eBWa45NPlv wfl8FFoYMiOd5aqD73yA3J5Y2WwAb/7fDJnDImJrda3T0vlet+hraXqmTNoUEvWvzziH jYezE3jo53JmdKKGglWa+lhYu+825XxgUuMGozOom7jxIMNihWR4Fvcz4Yw30zms/8PH AEdjIqsSYla75AqXjWMePpI5EoC9GYaCtK3HISTK5VQ84UUkYLUMYnPu/nVepmKde7MQ o9aQ== 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 t62si6603158pfa.49.2018.02.06.04.00.20; Tue, 06 Feb 2018 04:00:35 -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 S1752978AbeBFL6m (ORCPT + 99 others); Tue, 6 Feb 2018 06:58:42 -0500 Received: from terminus.zytor.com ([65.50.211.136]:53713 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752879AbeBFL6f (ORCPT ); Tue, 6 Feb 2018 06:58:35 -0500 Received: from terminus.zytor.com (localhost [127.0.0.1]) by terminus.zytor.com (8.15.2/8.15.2) with ESMTP id w16BtAjX026281; Tue, 6 Feb 2018 03:55:10 -0800 Received: (from tipbot@localhost) by terminus.zytor.com (8.15.2/8.15.2/Submit) id w16Bt7CV026271; Tue, 6 Feb 2018 03:55:07 -0800 Date: Tue, 6 Feb 2018 03:55:07 -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: peterz@infradead.org, efault@gmx.de, tglx@linutronix.de, mingo@kernel.org, linux-kernel@vger.kernel.org, jiang.biao2@zte.com.cn, hpa@zytor.com, torvalds@linux-foundation.org, wen.yang99@zte.com.cn Reply-To: tglx@linutronix.de, efault@gmx.de, peterz@infradead.org, jiang.biao2@zte.com.cn, linux-kernel@vger.kernel.org, hpa@zytor.com, torvalds@linux-foundation.org, wen.yang99@zte.com.cn, mingo@kernel.org In-Reply-To: <1517800721-42092-1-git-send-email-wen.yang99@zte.com.cn> References: <1517800721-42092-1-git-send-email-wen.yang99@zte.com.cn> To: linux-tip-commits@vger.kernel.org Subject: [tip:sched/urgent] sched/rt: Make update_curr_rt() more accurate Git-Commit-ID: e7ad203166fff89b1d8253faf68fbe6966bf7181 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: e7ad203166fff89b1d8253faf68fbe6966bf7181 Gitweb: https://git.kernel.org/tip/e7ad203166fff89b1d8253faf68fbe6966bf7181 Author: Wen Yang AuthorDate: Mon, 5 Feb 2018 11:18:41 +0800 Committer: Ingo Molnar CommitDate: Tue, 6 Feb 2018 10:20:34 +0100 sched/rt: Make update_curr_rt() more accurate rq->clock_task may be updated between the two calls of rq_clock_task() in update_curr_rt(). Calling rq_clock_task() only once makes it more accurate and efficient, taking update_curr() as reference. Signed-off-by: Wen Yang Signed-off-by: Peter Zijlstra (Intel) Reviewed-by: Jiang Biao Cc: Linus Torvalds Cc: Mike Galbraith Cc: Peter Zijlstra Cc: Thomas Gleixner Cc: zhong.weidong@zte.com.cn Link: http://lkml.kernel.org/r/1517800721-42092-1-git-send-email-wen.yang99@zte.com.cn Signed-off-by: Ingo Molnar --- kernel/sched/rt.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c index 89a086e..663b235 100644 --- a/kernel/sched/rt.c +++ b/kernel/sched/rt.c @@ -950,12 +950,13 @@ static void update_curr_rt(struct rq *rq) { struct task_struct *curr = rq->curr; struct sched_rt_entity *rt_se = &curr->rt; + u64 now = rq_clock_task(rq); u64 delta_exec; if (curr->sched_class != &rt_sched_class) return; - delta_exec = rq_clock_task(rq) - curr->se.exec_start; + delta_exec = now - curr->se.exec_start; if (unlikely((s64)delta_exec <= 0)) return; @@ -968,7 +969,7 @@ static void update_curr_rt(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);