From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4E99DC433EF for ; Tue, 7 Dec 2021 22:44:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242178AbhLGWrh (ORCPT ); Tue, 7 Dec 2021 17:47:37 -0500 Received: from mga12.intel.com ([192.55.52.136]:4185 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237728AbhLGWre (ORCPT ); Tue, 7 Dec 2021 17:47:34 -0500 X-IronPort-AV: E=McAfee;i="6200,9189,10191"; a="217726744" X-IronPort-AV: E=Sophos;i="5.87,295,1631602800"; d="scan'208";a="217726744" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Dec 2021 14:44:03 -0800 X-IronPort-AV: E=Sophos;i="5.87,295,1631602800"; d="scan'208";a="462510396" Received: from otcwcpicx3.sc.intel.com ([172.25.55.73]) by orsmga006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Dec 2021 14:44:03 -0800 Date: Tue, 7 Dec 2021 22:43:50 +0000 From: Fenghua Yu To: Colin Ian King Cc: Reinette Chatre , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H . Peter Anvin" , kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] x86/resctrl: remove redundant assignment to variable chunks Message-ID: References: <20211207223735.35173-1-colin.i.king@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20211207223735.35173-1-colin.i.king@gmail.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Dec 07, 2021 at 10:37:35PM +0000, Colin Ian King wrote: > The variable chunks is being shifted right and re-assinged the shifted > value which is then returned. Since chunks is not being read afterwards > the assignment is redundant and the >>= operator can be replaced with a > shift >> operator instead. > > Signed-off-by: Colin Ian King > --- > arch/x86/kernel/cpu/resctrl/monitor.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/arch/x86/kernel/cpu/resctrl/monitor.c b/arch/x86/kernel/cpu/resctrl/monitor.c > index c9f0f3d63f75..eaf25a234ff5 100644 > --- a/arch/x86/kernel/cpu/resctrl/monitor.c > +++ b/arch/x86/kernel/cpu/resctrl/monitor.c > @@ -282,7 +282,7 @@ static u64 mbm_overflow_count(u64 prev_msr, u64 cur_msr, unsigned int width) > u64 shift = 64 - width, chunks; > > chunks = (cur_msr << shift) - (prev_msr << shift); > - return chunks >>= shift; > + return chunks >> shift; > } > > static u64 __mon_event_count(u32 rmid, struct rmid_read *rr) Reviewed-by: Fenghua Yu Thanks. -Fenghua