Received: by 10.223.176.5 with SMTP id f5csp2370503wra; Mon, 5 Feb 2018 02:58:52 -0800 (PST) X-Google-Smtp-Source: AH8x224inYBjbZFqIgY94kmtfLEy8Rn6WLEa7xMV9nDp7TISn8OjDBNxosU1Mb17iIvN4wWWpiVF X-Received: by 10.99.114.19 with SMTP id n19mr7270999pgc.143.1517828332284; Mon, 05 Feb 2018 02:58:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517828332; cv=none; d=google.com; s=arc-20160816; b=lLi8c7EV9/aui5VCXBb+BQgQ9O2VYQc7PjBtjywORYe4xToZLWtYkOBthAu03SbBwA WoWu59Jx0KEwTdQeFeyz0knUBlS89/ML41hxeeN8tD+pHgGX0SnynzqbiEzEqMDCClh+ jTdgj9GRJeO9tpp2g+FPBEwI3LkSur4Lr2VDjYJQ4ZsuIeBXciogjvaMV9gJG2Z1kp/d XRSa91B6Y15mneJqCsOttIQmp7zlznc7Y3ORhvbUmvDKavYL63s/gGntY7IXrWdNTqQN uHgr/zlotikp0RtEuRwTBMzl4gxbN6Q90KPZ44kdbbUOHreDwKJwADe33LNJdOsmaCg+ GBrQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=NFOfaEchtcLPrYJbYT5GraclRI5sZ3DrfP09RRy2pRc=; b=wMLOITZW/zUjGW1yYV/n/Sf3dD/5TVU99+RxsW1tUo2ZUO5cPn7ytVxjA96IhiMTud Iia+LWadMl6krnMHseLy1Ib+mOc3bEdP3xMMmEAOTghyMUfqvkGfm5B+vLF77ce5kSzX syZWXZ5Tw9hdQ7jOnmZ3nJIQpNwsSvcUU/hgpIgYBBQLC5TdWm4Y7NE/DX3Av/NvSVEu AZQNDIDMHetuXw6sky7G5iPp1XgyY6nGUBR3RPj/m0NXyZ+aUog+jELVxue/REYQYfF4 hIQqQvTNzOGP98Kau7/LuieLW7AZXeFjjlfkcTccArf82FGPpy1cYij8O9zStF6tMTiy ILuQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=W3aeq6PK; 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 b61-v6si305930plb.709.2018.02.05.02.58.37; Mon, 05 Feb 2018 02:58:52 -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; dkim=fail header.i=@gmail.com header.s=20161025 header.b=W3aeq6PK; 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 S1752673AbeBEK5R (ORCPT + 99 others); Mon, 5 Feb 2018 05:57:17 -0500 Received: from mail-wm0-f65.google.com ([74.125.82.65]:54680 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751705AbeBEK5N (ORCPT ); Mon, 5 Feb 2018 05:57:13 -0500 Received: by mail-wm0-f65.google.com with SMTP id i186so25183992wmi.4 for ; Mon, 05 Feb 2018 02:57:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=NFOfaEchtcLPrYJbYT5GraclRI5sZ3DrfP09RRy2pRc=; b=W3aeq6PKyZOu3XYf0zYkTOxLLQIvcG3Dr9zhStliWmDYK5HF3vS0UEkkPqLtbG1CuV eSkQMSeir4vNqGXyN0UOu1DfrRRih81B+/KONilr7Atp1+IYIpneDhboWFu1J2+u500E oJ6VJKnwXcY0qcL58ZzLrDzI2DmBWYhAbuHuUUs+7ilS3YUYn/f9BSKV4PFJ65P35jBd 8h1/dwEv1uClZXRzeSDn2GC/z0ks5AZ3bRf19dWLWr8JesAOeKA7SBNx1wOuWQvK1Z79 ahuGn2v+1sbr9LOU7GhA1XXL51BWWPfLZwtjIa04Ho7SzaAqbDdxLnTETVrI1wG2a89/ K2xg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to:user-agent; bh=NFOfaEchtcLPrYJbYT5GraclRI5sZ3DrfP09RRy2pRc=; b=aXfkXKXvx9ZDF+6T+hGJaDEkuJLZeSSAaZdbjAfOt5z4nr1zNX9pD7AVw6L1c/JuoH voMJKCpdTvKaPj1QzVFYRV5iBRG26TkUZSlpUnEPNY4lo2AcUy0fOHpC2GXQydoBOOvH 7/mKRaNHGxLPFHme9yFLu91D79OGpoY/IYajNsZwUvqlI2DMKazq8bfOePRvwXf8gWF4 Go0Dum7I0ZUbHqYqfDoc8wDzokzhCH9y/xek+UbCm6QoSSw6NaC53//lXnVUBWluUp7k pTuxunKePwiTKtMWrZqISXU459+RK+ahbTAU1PwfJ9xi2GdHarOjgCldQVhleVINkW0v 11lA== X-Gm-Message-State: AKwxytfYozj2EqPzLOPPGAfFFiz4E/5UUCSp0EWpWcaGj/Z/Uq4PRcFq CV7REg8vNcdjDU7d72W9300= X-Received: by 10.28.169.200 with SMTP id s191mr37023206wme.9.1517828231910; Mon, 05 Feb 2018 02:57:11 -0800 (PST) Received: from gmail.com (2E8B0CD5.catv.pool.telekom.hu. [46.139.12.213]) by smtp.gmail.com with ESMTPSA id w3sm13159928wrc.22.2018.02.05.02.57.10 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 05 Feb 2018 02:57:10 -0800 (PST) Date: Mon, 5 Feb 2018 11:57:08 +0100 From: Ingo Molnar To: Wen Yang Cc: mingo@redhat.com, peterz@infradead.org, linux-kernel@vger.kernel.org, jiang.biao2@zte.com.cn, zhong.weidong@zte.com.cn Subject: Re: [PATCH] sched/rt: Make update_curr_rt() more accurate Message-ID: <20180205105708.upjcsok3zbk5zxlk@gmail.com> References: <1517800721-42092-1-git-send-email-wen.yang99@zte.com.cn> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1517800721-42092-1-git-send-email-wen.yang99@zte.com.cn> User-Agent: NeoMutt/20170609 (1.8.3) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org * Wen Yang wrote: > 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 > Reviewed-by: Jiang Biao > --- > 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 4056c19..d6d2a65 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; Small nit: shouldn't we calculate 'now' after the return? OTOH that 'return' should only be triggered statistically AFAICS, i.e. very rarely. Thanks, Ingo