From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 2271B45717; Fri, 2 Aug 2024 05:17:28 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E5E594029A; Fri, 2 Aug 2024 05:17:27 +0200 (CEST) Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by mails.dpdk.org (Postfix) with ESMTP id 9CAD5400D6 for ; Fri, 2 Aug 2024 05:17:26 +0200 (CEST) Received: from mail.maildlp.com (unknown [172.19.163.48]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4WZrYw6Wp9zfZ4J; Fri, 2 Aug 2024 11:15:32 +0800 (CST) Received: from kwepemm600004.china.huawei.com (unknown [7.193.23.242]) by mail.maildlp.com (Postfix) with ESMTPS id 38F2818007C; Fri, 2 Aug 2024 11:17:24 +0800 (CST) Received: from [10.67.121.59] (10.67.121.59) by kwepemm600004.china.huawei.com (7.193.23.242) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Fri, 2 Aug 2024 11:17:21 +0800 Message-ID: <3fa7050f-71a5-934f-30a7-a1c3afb3c333@huawei.com> Date: Fri, 2 Aug 2024 11:17:20 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.2.0 Subject: Re: [PATCH v5] virtio: optimize stats counters performance To: Stephen Hemminger CC: =?UTF-8?Q?Morten_Br=c3=b8rup?= , , , References: <20240731131744.36448-1-mb@smartsharesystems.com> <20240801160312.205281-1-mb@smartsharesystems.com> <677a47da-c6ba-57a9-92c7-a98df739d216@huawei.com> <20240801194256.0cd2c400@hermes.local> From: "lihuisong (C)" In-Reply-To: <20240801194256.0cd2c400@hermes.local> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [10.67.121.59] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To kwepemm600004.china.huawei.com (7.193.23.242) X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org 在 2024/8/2 10:42, Stephen Hemminger 写道: > On Fri, 2 Aug 2024 10:23:12 +0800 > "lihuisong (C)" wrote: > >>> void >>> -virtio_update_packet_stats(struct virtnet_stats *stats, struct rte_mbuf *mbuf) >>> +virtio_update_packet_stats(struct virtnet_stats *const stats, >>> + const struct rte_mbuf *const mbuf) >> The two const is also for performace?  Is there gain? > If you look at resulting code (ie godbolt.org) the resulting code never > changes when const is added. The compiler already > knows what is modified. Const is only a programmer and correctness thing. I know this. Thanks for your clarifying and recommending the site that is good to use.😁 This patch is just for optimizing stats counters performance. And the new added const has nothing to do with this optimization. But it's ok for me. > .