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 99D33A00C4; Sun, 6 Nov 2022 12:59:43 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2E1EC40156; Sun, 6 Nov 2022 12:59:43 +0100 (CET) Received: from shelob.oktetlabs.ru (shelob.oktetlabs.ru [91.220.146.113]) by mails.dpdk.org (Postfix) with ESMTP id EB4E84003C for ; Sun, 6 Nov 2022 12:59:41 +0100 (CET) Received: from [192.168.38.17] (aros.oktetlabs.ru [192.168.38.17]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by shelob.oktetlabs.ru (Postfix) with ESMTPSA id 3EBB459; Sun, 6 Nov 2022 14:59:41 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 shelob.oktetlabs.ru 3EBB459 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=oktetlabs.ru; s=default; t=1667735981; bh=dPcsjlMlGJgjZyl8ibeQL7glCTYNVuVqt43iUsWcgzU=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=BAF5JkPcsBB3mrRBhaAysGdQ5Rgynkk4av2iWDIt6oeLqsBlGhaA7Y38lUVgGAVDI +bcmmS2zI9N2Cb2N+TnMc0h+0PVreqB/dSu6eZEEwyZRwREzvmAh9ZCEN7DnEQbAD8 M2vkb3qMDfk2774Qmk+wI+49+cj4BqBBNkVg4VvE= Message-ID: Date: Sun, 6 Nov 2022 14:59:41 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.0 Subject: Re: [PATCH v4 3/3] mempool: use cache for frequently updated stats Content-Language: en-US To: =?UTF-8?Q?Morten_Br=c3=b8rup?= , olivier.matz@6wind.com, mattias.ronnblom@ericsson.com, stephen@networkplumber.org, jerinj@marvell.com, bruce.richardson@intel.com Cc: hofors@lysator.liu.se, thomas@monjalon.net, dev@dpdk.org References: <20221104111740.330-1-mb@smartsharesystems.com> <20221104120329.1219-1-mb@smartsharesystems.com> <20221104120329.1219-3-mb@smartsharesystems.com> <4fe4589f-dbb0-9b97-f45f-91e7a9760322@oktetlabs.ru> <98CBD80474FA8B44BF855DF32C47DC35D8748C@smartserver.smartshare.dk> From: Andrew Rybchenko Organization: OKTET Labs In-Reply-To: <98CBD80474FA8B44BF855DF32C47DC35D8748C@smartserver.smartshare.dk> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit 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 On 11/6/22 14:50, Morten Brørup wrote: >> From: Andrew Rybchenko [mailto:andrew.rybchenko@oktetlabs.ru] >> Sent: Sunday, 6 November 2022 12.41 >> >> On 11/4/22 15:03, Morten Brørup wrote: > > [...] > >>> +/** >>> + * @internal When stats is enabled, store some statistics. >>> + * >>> + * @param cache >>> + * Pointer to the memory pool cache. >>> + * @param name >>> + * Name of the statistics field to increment in the memory pool >> cache. >>> + * @param n >>> + * Number to add to the statistics. >>> + */ >>> +#ifdef RTE_LIBRTE_MEMPOOL_STATS >>> +#define RTE_MEMPOOL_CACHE_STAT_ADD(cache, name, n) (cache)- >>> stats.name += n >> >> I'd enclose it in parenthesis. > > Me too! I had it surrounded by "do {...} while (0)" in v3, but checkpatch complained about it [1], so I changed it to the above. Which checkpatch also complains about. :-( I mean #define RTE_MEMPOOL_CACHE_STAT_ADD(cache, name, n) \ ((cache)->stats.name += (n)) > > [1]: http://mails.dpdk.org/archives/test-report/2022-November/321316.html Yes, I've seen it. > > Feel free to modify this macro at your preference when merging! > >> >>> +#else >>> +#define RTE_MEMPOOL_CACHE_STAT_ADD(cache, name, n) do {} while (0) >>> +#endif >>> + >