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 056D041E38; Thu, 9 Mar 2023 10:39:08 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D5C7340ED7; Thu, 9 Mar 2023 10:39:07 +0100 (CET) Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) by mails.dpdk.org (Postfix) with ESMTP id 2A632400D7 for ; Thu, 9 Mar 2023 10:39:05 +0100 (CET) Received: from frapeml500007.china.huawei.com (unknown [172.18.147.201]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4PXPJ64MD9z689yQ; Thu, 9 Mar 2023 17:38:30 +0800 (CST) Received: from frapeml500007.china.huawei.com (7.182.85.172) by frapeml500007.china.huawei.com (7.182.85.172) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.21; Thu, 9 Mar 2023 10:39:04 +0100 Received: from frapeml500007.china.huawei.com ([7.182.85.172]) by frapeml500007.china.huawei.com ([7.182.85.172]) with mapi id 15.01.2507.021; Thu, 9 Mar 2023 10:39:04 +0100 From: Konstantin Ananyev To: Honnappa Nagarahalli , "mb@smartsharesystems.com" , "olivier.matz@6wind.com" , "konstantin.v.ananyev@yandex.ru" CC: "dev@dpdk.org" , "ruifeng.wang@arm.com" , "kamalakshitha.aligeri@arm.com" , "wathsala.vithanage@arm.com" , "nd@arm.com" Subject: RE: [PATCH 4/4] mempool: use lcore API to check if lcore ID is valid Thread-Topic: [PATCH 4/4] mempool: use lcore API to check if lcore ID is valid Thread-Index: AQHZUkPdMQ5VovBe6ku0RkzWFw9njK7yL+Wg Date: Thu, 9 Mar 2023 09:39:04 +0000 Message-ID: <871c50be83964a08b7c2122d1694c80d@huawei.com> References: <20230309045738.1261000-1-honnappa.nagarahalli@arm.com> <20230309045738.1261000-5-honnappa.nagarahalli@arm.com> In-Reply-To: <20230309045738.1261000-5-honnappa.nagarahalli@arm.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.126.171.169] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-CFilter-Loop: Reflected 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 >=20 > Use lcore API to check if the lcore ID is valid. The runtime > check does not add much value. >From my perspective it adds a perfect value: Only threads with valid lcore id have their own default mempool cache. > Hence use assert to validate > the lcore ID. Wonder why? What's wrong for the thread to try to get default mempool cache? That would change existing behavior and in general seems wrong to me. =20 So I am strongly opposed. =20 > Signed-off-by: Honnappa Nagarahalli > Reviewed-by: Wathsala Vithanage > Reviewed-by: Ruifeng Wang > --- > lib/mempool/rte_mempool.h | 5 ++--- > 1 file changed, 2 insertions(+), 3 deletions(-) >=20 > diff --git a/lib/mempool/rte_mempool.h b/lib/mempool/rte_mempool.h > index 009bd10215..00c5aa961b 100644 > --- a/lib/mempool/rte_mempool.h > +++ b/lib/mempool/rte_mempool.h > @@ -1314,10 +1314,9 @@ rte_mempool_cache_free(struct rte_mempool_cache *c= ache); > static __rte_always_inline struct rte_mempool_cache * > rte_mempool_default_cache(struct rte_mempool *mp, unsigned lcore_id) > { > - if (mp->cache_size =3D=3D 0) > - return NULL; > + RTE_ASSERT(rte_lcore_id_is_valid(lcore_id)); >=20 > - if (lcore_id >=3D RTE_MAX_LCORE) > + if (mp->cache_size =3D=3D 0) > return NULL; >=20 > rte_mempool_trace_default_cache(mp, lcore_id, > -- > 2.25.1 >=20