From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id D1C702946 for ; Wed, 31 Aug 2016 03:28:00 +0200 (CEST) Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga103.fm.intel.com with ESMTP; 30 Aug 2016 18:28:00 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.30,259,1470726000"; d="scan'208";a="2929007" Received: from irsmsx104.ger.corp.intel.com ([163.33.3.159]) by fmsmga006.fm.intel.com with ESMTP; 30 Aug 2016 18:27:59 -0700 Received: from irsmsx105.ger.corp.intel.com ([169.254.7.102]) by IRSMSX104.ger.corp.intel.com ([163.33.3.159]) with mapi id 14.03.0248.002; Wed, 31 Aug 2016 02:27:58 +0100 From: "Ananyev, Konstantin" To: Vladyslav Buslov CC: "dev@dpdk.org" Thread-Topic: [PATCH] acl: use rte_calloc for temporary memory allocation Thread-Index: AQHR98bMloFFvwZovkmV/gPzRtdsvaBiVocg Date: Wed, 31 Aug 2016 01:27:57 +0000 Message-ID: <2601191342CEEE43887BDE71AB97725836B94E0C@irsmsx105.ger.corp.intel.com> References: <20160816140128.10149-1-vladyslav.buslov@harmonicinc.com> <20160816140128.10149-2-vladyslav.buslov@harmonicinc.com> In-Reply-To: <20160816140128.10149-2-vladyslav.buslov@harmonicinc.com> Accept-Language: en-IE, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [163.33.239.181] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH] acl: use rte_calloc for temporary memory allocation X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 31 Aug 2016 01:28:01 -0000 Hi Vladyslav, > -----Original Message----- > From: Vladyslav Buslov [mailto:vladyslav.buslov@harmonicinc.com] > Sent: Tuesday, August 16, 2016 3:01 PM > To: Ananyev, Konstantin > Cc: dev@dpdk.org > Subject: [PATCH] acl: use rte_calloc for temporary memory allocation >=20 > Acl build process uses significant amount of memory which degrades perfor= mance by causing page walks when memory is allocated on > regular heap using libc calloc. >=20 > This commit changes tb_mem to allocate temporary memory on huge pages wit= h rte_calloc. We deliberately used standard system memory allocation routines (calloc/fre= e) here. With current design build phase was never considered to be an 'RT' phase op= eration. It is pretty cpu and memory expensive. So if we'll use RTE memory for build phase it could easily consume all (or = most) of it, and might cause DPDK process failure or degradation. If you really feel that you (and other users) would benefit from using rte_calloc here (I personally still in doubt), then at least it should be a= new field inside rte_acl_config, that would allow user to control that behavior= . Though, as I said above, librte_acl was never designed to ' to allocate ten= s of thousands of ACLs at runtime'. To add ability to add/delete rules at runtime while keeping lookup time rea= sonably low some new approach need to be introduced. =20 Konstantin >=20 > Signed-off-by: Vladyslav Buslov > --- > lib/librte_acl/tb_mem.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) >=20 > diff --git a/lib/librte_acl/tb_mem.c b/lib/librte_acl/tb_mem.c index 157e= 608..c373673 100644 > --- a/lib/librte_acl/tb_mem.c > +++ b/lib/librte_acl/tb_mem.c > @@ -52,7 +52,7 @@ tb_pool(struct tb_mem_pool *pool, size_t sz) > size_t size; >=20 > size =3D sz + pool->alignment - 1; > - block =3D calloc(1, size + sizeof(*pool->block)); > + block =3D rte_calloc("ACL_TBMEM_BLOCK", 1, size + sizeof(*pool->block), > +0); > if (block =3D=3D NULL) { > RTE_LOG(ERR, MALLOC, "%s(%zu)\n failed, currently allocated " > "by pool: %zu bytes\n", __func__, sz, pool->alloc); > -- > 2.8.3