Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp2048936ybe; Tue, 3 Sep 2019 07:17:12 -0700 (PDT) X-Google-Smtp-Source: APXvYqwcBo0I34v4IxH5mssZ+tNkyXEKml8u0fq9G1mosbuZL0TmJiPOYPWoltycRmAwYNowd4ZT X-Received: by 2002:a63:2004:: with SMTP id g4mr29229932pgg.97.1567520232590; Tue, 03 Sep 2019 07:17:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567520232; cv=none; d=google.com; s=arc-20160816; b=OFLUjeh3Qw0YDm57H8kS2XxshYaLN4kAbw/UYNi9m0mPnaLaIh9MzkZmp/9UoEmNGn dT74t006g7cEPQEoILxK6HemNwqpk4QJfl40x7TFgC4ebM5SJF1naQ6GVsB10Lw5+v1E 3fGmBw21msLAUD5MM+eehVRt7CbMjnQZapA75b/FBcl0hrlV3oWrsQ0jgDA1YxpwqNfX IZcGAMi5vgQJuiHA/kKV81szi4gaDrVXwuTtpr9gx0gfveI8ZEuZMbk2ZSryq/XH4O6F lEFERii0/w/x6pcOw8vIbNCsmrP6hGZM+9I45X6rgvv8ciQipANmQznvP3KVZPGrRBFy wL2g== 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; bh=bZzsxHgBhfruo8NfOXSLVXf4HiHbSYZxKvfXaibsApY=; b=SQehBfhpl4seA9aeQ6kVsbONGNBlWZWhewQv1MeyH/0JcrqG27hLU885W/jqlw6zAC D3iQrucHR3AoBA6zHXEnA1Shb7+NrgcKOAXcUnyYIlhJ9CyAtS4BQ1GaTaNy4819nUBx ITKkmF0wq/HH85t//ctxAxeKPVYEAuxwRxnlIRn1Vc81HCPpYNCJFn1PJn6bu04MyRGI gdZwCQYmpJ+0yg6w5ns3nfET4ndS7+dKIwUGA/jgMRewxx/PVRJJRhMiQ2vq4kV4PCXJ bSrE3f136nsQzdPg2r5teDdK2VQyaFBa03GGllrnDuaE2a68PjLIFgm8c7QK1z1vnzYR 4kAg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=R15SjI+P; 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 x7si14719701pjo.64.2019.09.03.07.16.57; Tue, 03 Sep 2019 07:17:12 -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=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=R15SjI+P; 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 S1729313AbfICOQA (ORCPT + 99 others); Tue, 3 Sep 2019 10:16:00 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:37010 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727941AbfICOQA (ORCPT ); Tue, 3 Sep 2019 10:16:00 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=bZzsxHgBhfruo8NfOXSLVXf4HiHbSYZxKvfXaibsApY=; b=R15SjI+PFpJK2EUbvANcNuRtZ rnBJMG8lvaI9Thjaf95zfAgTxVjx7qLSW8XGrs9b2NP4lkiYsl6oG6FF3c56docyVkvyBCG7aFRxl KX+EDWVpEW1n8l+TvqMNnzNDSVYP03HWmyM9BujnX8WmehbpBiMC/krzMk3H4+gAXpGjzm0UxPAeC QNLZncyyj26Ap8jkVJTqvHlznaWoVbXNmrALiS1nw4CVVXp/EzTThK0mZIkV2ISnT+gDznJ+hgE/d j74LSA0URczYHGeW8mf+kLoxAzDLMX2SKmmPSH6jlwbEXOUc7+MA7ZP3djZdWoHERdYZmnZPu7Vjj aRi63ktJw==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by bombadil.infradead.org with esmtpsa (Exim 4.92 #3 (Red Hat Linux)) id 1i59bA-0008Kk-BL; Tue, 03 Sep 2019 14:15:56 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 0A47730116F; Tue, 3 Sep 2019 16:15:18 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 2D7342097776B; Tue, 3 Sep 2019 16:15:54 +0200 (CEST) Date: Tue, 3 Sep 2019 16:15:54 +0200 From: Peter Zijlstra To: Qian Cai Cc: mingo@redhat.com, bsegall@google.com, chiluk+linux@indeed.com, pauld@redhat.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH -next v2] sched/fair: fix -Wunused-but-set-variable warnings Message-ID: <20190903141554.GS2349@hirez.programming.kicks-ass.net> References: <1566326455-8038-1-git-send-email-cai@lca.pw> <1567515806.5576.41.camel@lca.pw> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1567515806.5576.41.camel@lca.pw> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Sep 03, 2019 at 09:03:26AM -0400, Qian Cai wrote: > Ingo or Peter, please take a look at this trivial patch. Still see the warning > in linux-next every day. > > On Tue, 2019-08-20 at 14:40 -0400, Qian Cai wrote: > > The linux-next commit "sched/fair: Fix low cpu usage with high > > throttling by removing expiration of cpu-local slices" [1] introduced a > > few compilation warnings, > > > > kernel/sched/fair.c: In function '__refill_cfs_bandwidth_runtime': > > kernel/sched/fair.c:4365:6: warning: variable 'now' set but not used > > [-Wunused-but-set-variable] > > kernel/sched/fair.c: In function 'start_cfs_bandwidth': > > kernel/sched/fair.c:4992:6: warning: variable 'overrun' set but not used > > [-Wunused-but-set-variable] > > > > Also, __refill_cfs_bandwidth_runtime() does no longer update the > > expiration time, so fix the comments accordingly. > > > > [1] https://lore.kernel.org/lkml/1558121424-2914-1-git-send-email-chiluk+linux > > @indeed.com/ > > > > Signed-off-by: Qian Cai Rewrote the Changelog like so: --- Subject: sched/fair: Fix -Wunused-but-set-variable warnings From: Qian Cai Date: Tue, 20 Aug 2019 14:40:55 -0400 Commit de53fd7aedb1 ("sched/fair: Fix low cpu usage with high throttling by removing expiration of cpu-local slices") introduced a few compilation warnings: kernel/sched/fair.c: In function '__refill_cfs_bandwidth_runtime': kernel/sched/fair.c:4365:6: warning: variable 'now' set but not used [-Wunused-but-set-variable] kernel/sched/fair.c: In function 'start_cfs_bandwidth': kernel/sched/fair.c:4992:6: warning: variable 'overrun' set but not used [-Wunused-but-set-variable] Also, __refill_cfs_bandwidth_runtime() does no longer update the expiration time, so fix the comments accordingly. Fixes: de53fd7aedb1 ("sched/fair: Fix low cpu usage with high throttling by removing expiration of cpu-local slices") Signed-off-by: Qian Cai Signed-off-by: Peter Zijlstra (Intel) Reviewed-by: Ben Segall Reviewed-by: Dave Chiluk Cc: mingo@redhat.com Cc: pauld@redhat.com Link: https://lkml.kernel.org/r/1566326455-8038-1-git-send-email-cai@lca.pw --- kernel/sched/fair.c | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -4386,21 +4386,16 @@ static inline u64 sched_cfs_bandwidth_sl } /* - * Replenish runtime according to assigned quota and update expiration time. - * We use sched_clock_cpu directly instead of rq->clock to avoid adding - * additional synchronization around rq->lock. + * Replenish runtime according to assigned quota. We use sched_clock_cpu + * directly instead of rq->clock to avoid adding additional synchronization + * around rq->lock. * * requires cfs_b->lock */ void __refill_cfs_bandwidth_runtime(struct cfs_bandwidth *cfs_b) { - u64 now; - - if (cfs_b->quota == RUNTIME_INF) - return; - - now = sched_clock_cpu(smp_processor_id()); - cfs_b->runtime = cfs_b->quota; + if (cfs_b->quota != RUNTIME_INF) + cfs_b->runtime = cfs_b->quota; } static inline struct cfs_bandwidth *tg_cfs_bandwidth(struct task_group *tg) @@ -5021,15 +5016,13 @@ static void init_cfs_rq_runtime(struct c void start_cfs_bandwidth(struct cfs_bandwidth *cfs_b) { - u64 overrun; - lockdep_assert_held(&cfs_b->lock); if (cfs_b->period_active) return; cfs_b->period_active = 1; - overrun = hrtimer_forward_now(&cfs_b->period_timer, cfs_b->period); + hrtimer_forward_now(&cfs_b->period_timer, cfs_b->period); hrtimer_start_expires(&cfs_b->period_timer, HRTIMER_MODE_ABS_PINNED); }