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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E00E0C433EF for ; Mon, 13 Dec 2021 09:07:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Content-Type: Content-Transfer-Encoding:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Date:Message-ID:From: References:CC:To:Subject:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=Fy9h6ROfLwBOBg5zqE0lth7IpFZ0av7E4siuMKznvFA=; b=gxfO3OCwDhjVhOW36VGwW6zEKd n8pVjf8H4eI9ichxHg+TUDK5UqaDWCd4E4JakRz9yUjpMBaxsp8T+0WTapvCiTnpJIW4utCpmLK66 R90ikNzgYvLNjKDKTHAXC81M7GhqeEuj+ImnugIRjuVB4g7RWPbq1Ieps91wq6X3M1nUhS48u52Oc aWhgeWdyRIzga/3dF2SOE00vQ/oj6VUXG0DHJPJhdnicIVqFrGIoxqE2u2djCldi29kQ2Or2NqOcm ln/rh72yBghpG1rqOiKMEWBTIRzl3kgHJvpCGBYOtbwAPkhI5v3HvRFmAXWDQBAJWwPu1m659WLry g/uzH9cg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mwhHT-008VJg-Bu; Mon, 13 Dec 2021 09:06:00 +0000 Received: from frasgout.his.huawei.com ([185.176.79.56]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mwh8T-008RNy-8W for linux-arm-kernel@lists.infradead.org; Mon, 13 Dec 2021 08:56:42 +0000 Received: from fraeml710-chm.china.huawei.com (unknown [172.18.147.206]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4JCFgc3hB3z67Zt3; Mon, 13 Dec 2021 16:54:36 +0800 (CST) Received: from lhreml724-chm.china.huawei.com (10.201.108.75) by fraeml710-chm.china.huawei.com (10.206.15.59) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.20; Mon, 13 Dec 2021 09:56:38 +0100 Received: from [10.47.80.231] (10.47.80.231) by lhreml724-chm.china.huawei.com (10.201.108.75) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.20; Mon, 13 Dec 2021 08:56:36 +0000 Subject: Re: [PATCH 01/22] libperf: Add comments to perf_cpu_map. To: Arnaldo Carvalho de Melo , Ian Rogers CC: Andi Kleen , Jiri Olsa , "Namhyung Kim" , Kajol Jain , "Paul A . Clarke" , Riccardo Mancini , Kan Liang , Peter Zijlstra , "Ingo Molnar" , Mark Rutland , "Alexander Shishkin" , , , "Vineet Singh" , James Clark , "Mathieu Poirier" , Suzuki K Poulose , Mike Leach , Leo Yan , , , References: <20211208024607.1784932-1-irogers@google.com> <20211208024607.1784932-2-irogers@google.com> From: John Garry Message-ID: <02b330aa-ebce-11b2-9d3f-9b2497ae7133@huawei.com> Date: Mon, 13 Dec 2021 08:56:17 +0000 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.12.1 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US X-Originating-IP: [10.47.80.231] X-ClientProxiedBy: lhreml728-chm.china.huawei.com (10.201.108.79) To lhreml724-chm.china.huawei.com (10.201.108.75) X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211213_005641_476357_D6599ABE X-CRM114-Status: GOOD ( 13.79 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 10/12/2021 19:08, Arnaldo Carvalho de Melo wrote: >>>> +/** >>>> + * A sized, reference counted, sorted array of integers representing CPU >>>> + * numbers. This is commonly used to capture which CPUs a PMU is associated >>>> + * with. >>>> + */ >>>> struct perf_cpu_map { >>>> refcount_t refcnt; >>>> + /** Length of the map array. */ >>>> int nr; I'd have /s/nr/len/, as it means the map length, as opposed to confusing nr meaning with number of cpus in the host or something else. And the new comment uses "Length" also. >>>> + /** The CPU values. */ >>>> int map[]; >>> would simply more distinct names for the variables help instead of or in >>> addition to comments? > Well, in this case the typical usage doesn't help, as 'struct > perf_cpu_map' are being used simply as "map" There are a lot of instances to change ... but I am all up for using consistent and well-meaning variable / argument names per type. > where it should be cpu_map, > so we would have: > > cpu_map->nr > > And all should be obvious, no? Otherwise we would have redundant 'cpu', > like: > > cpu_map->nr_cpus > > And 'map' should really be entries, so: > > cpu_map->entries[index]; > > Would be clear enough, o? > >> Thanks John! I agree. The phrase that is often used is intention >> revealing names. The kernel style for naming is to be brief: _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel