Received: by 2002:a05:6a10:c7c6:0:0:0:0 with SMTP id h6csp2603672pxy; Tue, 3 Aug 2021 10:13:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJysqxRytxi7jVU7ij7/oeK4hIfc9GAzITrB2M7fnZkt0q2vwAo+tkP3y7oIbBLPB/bojdhA X-Received: by 2002:a05:6402:1a4c:: with SMTP id bf12mr27218596edb.137.1628010816749; Tue, 03 Aug 2021 10:13:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628010816; cv=none; d=google.com; s=arc-20160816; b=ep61KoOVO1vJtGSYFeMu/rQrR7bgDkSroHgllWP+O+8DXeMecRdYEhQWBnRNtA8nyZ MOpkQYOSmoL79eMJ3DcTDzOsoxVMd8xnHmHQ/scNvOuJHiz+OlJ2Qt3wUPFnhlMSTRGZ jZNx51ZbeLhW8GzJ2SYl36wYTVAglHxuWpPn+NaLfg5AdDQ3bn9MInYSPbVRGUrYEGey 7vUliJ3VY2hQ5og4zUoewDHdTGqbqcmfMskGk+BXOnCbEVpfYONDHiNEeq8ywNevkUuB oWIsp31kMfGCgKp3FGeF2UZFME/IA2AKh9eJYvUM4wUJj54XnLNorRZAcv4oFY6INIF6 YX8w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:reply-to:message-id :subject:cc:to:from:date:dkim-signature; bh=SPuGbP8axC4odoWZx495YcyDpYFq2YTpH5XoIcNsdbQ=; b=abJxWVC9yedowyxk0WAhOH02BaG1PkAMefFDYvy0ElYYddHzzN/X4sq/VXCry5aWJE H/zkrMpQT6LDZUQDF1o9cVkqYtg1lT5wK54lTJLJrjmpaFOxWxjQDbfYm5O6Rq/fGCjw dkhuqaa/YARNxIdqcio05SP62X5o54AKvfR7RwcuJmE+ClMDGwUGp19vfTO1YBKC5z05 0okw5kkENu9NCaIrivkIj3grXdkDk/p4i6yazJhxtGBV7/9sV++X1b0+y5fB3OV3WE0y tQrxxeOCoZ7gIeVeg7UBaWHg68Bx36YhWgskHNoUAwZVCrEYNuYY/OhN7sC2Ecl/Iiew NZzA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="l+/rSNSw"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id rh13si1490560ejb.715.2021.08.03.10.13.13; Tue, 03 Aug 2021 10:13:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="l+/rSNSw"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237812AbhHCRKu (ORCPT + 99 others); Tue, 3 Aug 2021 13:10:50 -0400 Received: from mail.kernel.org ([198.145.29.99]:41096 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237778AbhHCRKq (ORCPT ); Tue, 3 Aug 2021 13:10:46 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id B084060FA0; Tue, 3 Aug 2021 17:10:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1628010635; bh=65H+ei0xpb7hD93+xQLQh+UXg0XMzVOm0QSLXIuPCOQ=; h=Date:From:To:Cc:Subject:Reply-To:References:In-Reply-To:From; b=l+/rSNSwMY9Uy/snzLVdv4wXRBdoP9L1d9JVnCFqda1sSJ3vQWqPyyDKoZ6ftmcir S+3jGYRb34qgQvd7Mngo2YwsOH6e/scU7bu0+z/gumfXu9d7D/M2XwM+tT+Fgf42KO +Qs2EquDdPWrgMMVm61StasHCsi127X/IJ70w/p+LMdfos2pdbRugPS4jA9RB5JOjT n/MeJP9IE0kjMoVw+GUv95kbaBu0RB9+Z1Bt35PDKYQwiyoh3A1c//Gt0MIwgwyB7+ HlPXsJb0Jr5hEB1Q1FV1ScTD5+CbYWgta+cC1v+2WYr8s7wk6bNl7MaN9AUda6uGwZ WgJTIv9YfKlkw== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id 7B82E5C04D4; Tue, 3 Aug 2021 10:10:35 -0700 (PDT) Date: Tue, 3 Aug 2021 10:10:35 -0700 From: "Paul E. McKenney" To: Joe Perches Cc: rcu@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-team@fb.com, mingo@kernel.org, jiangshanlai@gmail.com, akpm@linux-foundation.org, mathieu.desnoyers@efficios.com, josh@joshtriplett.org, tglx@linutronix.de, peterz@infradead.org, rostedt@goodmis.org, dhowells@redhat.com, edumazet@google.com, fweisbec@gmail.com, oleg@redhat.com, joel@joelfernandes.org, Liu Song Subject: Re: [PATCH rcu 15/18] rcu: Remove useless "ret" update in rcu_gp_fqs_loop() Message-ID: <20210803171035.GU4397@paulmck-ThinkPad-P17-Gen-1> Reply-To: paulmck@kernel.org References: <20210721202042.GA1472052@paulmck-ThinkPad-P17-Gen-1> <20210721202127.2129660-15-paulmck@kernel.org> <5a494dd8d0e04030204f61067cb1010ef0c78f27.camel@perches.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <5a494dd8d0e04030204f61067cb1010ef0c78f27.camel@perches.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Aug 03, 2021 at 09:48:23AM -0700, Joe Perches wrote: > On Wed, 2021-07-21 at 13:21 -0700, Paul E. McKenney wrote: > > From: Liu Song > > > > Within rcu_gp_fqs_loop(), the "ret" local variable is set to the > > return value from swait_event_idle_timeout_exclusive(), but "ret" is > > unconditionally overwritten later in the code. This commit therefore > > removes this useless assignment. > [] > > diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c > [] > > @@ -1960,8 +1960,8 @@ static noinline_for_stack void rcu_gp_fqs_loop(void) > > ? trace_rcu_grace_period(rcu_state.name, rcu_state.gp_seq, > > ? TPS("fqswait")); > > ? WRITE_ONCE(rcu_state.gp_state, RCU_GP_WAIT_FQS); > > - ret = swait_event_idle_timeout_exclusive( > > - rcu_state.gp_wq, rcu_gp_fqs_check_wake(&gf), j); > > + (void)swait_event_idle_timeout_exclusive(rcu_state.gp_wq, > > + rcu_gp_fqs_check_wake(&gf), j); > > It doesn't seem this is a __must_check routine so why > bother to cast to void ? As a hint to the reader that discarding the return value is intentional rather than an oversight. Thanx, Paul > > ? rcu_gp_torture_wait(); > > ? WRITE_ONCE(rcu_state.gp_state, RCU_GP_DOING_FQS); > > ? /* Locking provides needed memory barriers. */ > >