Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp11754279rwr; Sat, 13 May 2023 09:05:40 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6juTqh5a0lxH8en5aGxHI8WYwU7JubhmoJDvutbrcFvt/hGUbUCm0eXI+c/4LoNwGcyw4H X-Received: by 2002:a05:6870:c384:b0:195:f311:46ad with SMTP id g4-20020a056870c38400b00195f31146admr15878636oao.15.1683993940356; Sat, 13 May 2023 09:05:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683993940; cv=none; d=google.com; s=arc-20160816; b=XKawZCZleNgvcvP9wv7N36Esj6Q+l/Bykksv8qhcUd4xwRz4Z6HBQURF/XAi5bpe+P TSwmu8ngm/GvNcr+ivD9e96FMfRMyP3s0zCEKUQZM8GTqNMud2Yw25ZvoqrO6Cvj1xuN TZvsrIjX65RPuG7YiGB+ijd5XCK+HRocNcP/sPC0Mow4qsWdDydM5D3gZ+uHDdOimu9O X7Vy0+6HLXzfAbGQV2vpPn1SK6C6QnhQZWOn9wxqqVgxbVdxmnV0Hqn5Np6JtAiCTB8o cKzdMl43DGsDcOg6IzLDG/XZzR7yPWolHQuerCj9qfJ/Du8Fgtx3LcwAekfVekrIVFQ8 3pfQ== 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-disposition:mime-version :references:reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=S2hRyilK30HKRSIczUtrlbemH7w2mdZ3itsOF6wtJ18=; b=AJ3g8FNqCU3kHId8dPDEOyEciiIC7Rp+snOexW5W4N9yOmIxmUi9N5gEKWH7KfvqSH NXLykU+GgJwSKdzc9lj+5Hoh4ow3P0WNstHrhzZCMB6r3yjH/unzpo++uLCtIpzmwlCG kfNRB8Sba4QZMSTp16hq4pt2zMMKZ9/bQwOHZQpOZq1IGtnl/Z/3X/37feiwh3wAN3cb cQ7+Kk+HWFBrSwKJVxuFriBvO/EHP3bxO77IzP3JNonTU1OC7GJZzHTXJALOOV00n5lm 0Ayx5akez2UEGtB0hwoK0M80OdAN4ZI8gebZPtSOQZLRW6Q4sNRAYdVhMOjaJYl9WOkM 87fA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=M6XJKNmg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w8-20020a056870a2c800b00187d38a926esi14920077oak.247.2023.05.13.09.05.26; Sat, 13 May 2023 09:05:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=M6XJKNmg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S238982AbjEMPFZ (ORCPT + 99 others); Sat, 13 May 2023 11:05:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55058 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230133AbjEMPFY (ORCPT ); Sat, 13 May 2023 11:05:24 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7139C2684; Sat, 13 May 2023 08:05:23 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 0A01E60F53; Sat, 13 May 2023 15:05:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 68332C433EF; Sat, 13 May 2023 15:05:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1683990322; bh=c85IViv6QwewReUtlp/L4CrdzRU/fQhVYnG5tMWoEmM=; h=Date:From:To:Cc:Subject:Reply-To:References:In-Reply-To:From; b=M6XJKNmg3f02SB3GbQ37ctu+aHA9Vwpl0Ke4BLPEo6qBRa6CjNb6OWDOx84nr7U9d KRQ19fK1vGUodzb6Ju3mj3IGb8aSKnMAoJHZ62D6voi5fAs+XZiRDCjPDtDyrvKQr0 Vo1KPjtWyh0Kj4hXbVKtP+ArxCtXxFoLYIXAclJRnyln5MdlahknuuCt/p23dCMrOZ iGV7IcwDnJU/B4DKWpDlQuAgIZ7NrSSqC6pCFVQbjrskeD55MhgXcjPOP/P/4zcoha M3NV3UsmcnUfQoxbeAHzEZu4UIeTA6S5LUe5QoPocSEXCc1IGXiy/rfrZN8z9kdcgs 06GHIwxOCgCCg== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id EEBA5CE001B; Sat, 13 May 2023 08:05:21 -0700 (PDT) Date: Sat, 13 May 2023 08:05:21 -0700 From: "Paul E. McKenney" To: "Zhuo, Qiuxu" Cc: Joel Fernandes , "rcu@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "kernel-team@meta.com" , "rostedt@goodmis.org" Subject: Re: [PATCH rcu 3/6] rcu/rcuscale: Move rcu_scale_*() after kfree_scale_cleanup() Message-ID: <527de9fa-1ec6-4ba7-8bce-b0447e751c07@paulmck-laptop> Reply-To: paulmck@kernel.org References: <30F06C03-6950-4E2B-B3CE-3939B3CDD295@joelfernandes.org> <4d508096-300c-4d16-9c39-18598d00b500@paulmck-laptop> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, May 13, 2023 at 09:52:46AM +0000, Zhuo, Qiuxu wrote: > > From: Paul E. McKenney > > ... > > > >>>> I wish diff was better at showing what really changed. The meld > > > >>>> tool can help but its gui... > > > >>>> > > > >>>> Should I run meld later (I'm out at a conference so no access to > > > >>>> meld-capable > > > >>>> machines) or are we sufficiently confident that the lines were > > > >>>> moved as-is ? :) > > > >>>> > > > >>> > > > >>> Thank you, Joel for this concern. Good to know the meld diff GUI tool. > > > >>> I just run the command below and confirmed that the lines were > > > >>> moved > > > >>> as-is: rcu_scale_{cleanup,shutdown}() follows kfree_scale_cleanup(). > > > >>> You may double check it ;-). > > > >>> > > > >>> meld --diff ./rcuscale.c.before ./rcuscale.c.after > > > >> > > > >> Nice, thank you both! > > > >> > > > >> Another option is to check out the commit corresponding to this > > > >> patch, then do "git blame -M kernel/rcu/rcuscale.c". Given a > > > >> move-only commit, there should be no line tagged with this commit's > > SHA-1. > > > > > > > > Just had a good experiment with the "git blame -M" option: > > > > - Used this option to prove a move-only commit quickly (no line tagged > > with that commit) (the fastest method to me). > > > > - Then just only needed to quickly check the positions of the moved code > > chunk by myself (easy). > > > > > > > > Thank you, Paul for sharing this. It's very useful to me. > > > > > > Looks good to me as well and thank you both for sharing the tips. > > > > Here is one way to script this, where "SHA" identifies the commit to be > > checked and PATHS the affected pathnames: > > > > git checkout SHA^ > > git show SHA | git apply - > > git blame -M PATHS | grep '^0* ' > > Cool ~. Thank you, Paul. > I took them and made them into a script below for future use ;-) Nice!!! > #!/bin/bash > > SHA=$1 > > if [ -z "$SHA" ]; then > echo "Usage: $0 " > exit 1 > fi > > if ! git cat-file -t "$SHA" &> /dev/null; then > echo "$SHA does not exist in the repository" > exit 1 > fi You might want to record the current position so that you can return to it automatically. One approach is to parse the output of "git status". > git checkout ${SHA}^ &> /dev/null > git show ${SHA} | git apply - &> /dev/null > > PATHS=`git status| grep "modified:" | cut -d: -f2 | xargs` The '--porcelain' argument makes 'git status' is a bit easier to parse robustly. > for P in ${PATHS}; do > R=`git blame -M $P | grep '^0* '` You can avoid any bash-variable length limitations by using 'grep -q' and capturing the exit status using "$?". Thanx, Paul > if test -n "$R"; then > echo "$SHA is NOT a move-only commit" > exit 1 > fi > done > > echo "$SHA is a move-only commit" > > > If there is no output, there were no non-move changes. > > > > Or just do the "git blame -M PATHS | grep '^0* '" before doing the checking. > > > > And yes, you can derive PATHS using "git status" if you want. ;-) > > Thanx, Paul