From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id B4359A0546; Fri, 17 Jul 2020 00:24:05 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 0677B2C58; Fri, 17 Jul 2020 00:24:05 +0200 (CEST) Received: from mailout1.w1.samsung.com (mailout1.w1.samsung.com [210.118.77.11]) by dpdk.org (Postfix) with ESMTP id 37AD32C36 for ; Fri, 17 Jul 2020 00:24:03 +0200 (CEST) Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20200716222402euoutp014e25882057a1c1e964ae6e1274ead338~iW_GiAN1a2502725027euoutp01c for ; Thu, 16 Jul 2020 22:24:02 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20200716222402euoutp014e25882057a1c1e964ae6e1274ead338~iW_GiAN1a2502725027euoutp01c DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1594938242; bh=rur42MmB3kgqjt4UhEAuV4PZfc79DDgbVHKVE5tN+ls=; h=Subject:To:Cc:From:Date:In-Reply-To:References:From; b=C6JUUolbiZwqqp0cDMQfcIAxDWAMtwGXZS+S3scsJqt/gP21QziH5Dm7obQv9k20u 8eGsxtzS0KUPoBQ2WYUxAO/IhThye7RiWsneyiKKwUbA0k7TC/FB1+Ze07EF1ba618 QeZf7L59Fn8gFLbHe8ub+GqI4uHWTwyWcD2EuFUk= Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20200716222402eucas1p12d081752fe1c9ea4044e8f7bf6f0b525~iW_GGVLeD1464314643eucas1p1X; Thu, 16 Jul 2020 22:24:02 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges1new.samsung.com (EUCPMTA) with SMTP id DB.E7.06456.283D01F5; Thu, 16 Jul 2020 23:24:02 +0100 (BST) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20200716222401eucas1p283ce85fec0165c64392f0c96052fe35a~iW_FYhcNO2328223282eucas1p2x; Thu, 16 Jul 2020 22:24:01 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20200716222401eusmtrp13ab53738c0501952b2fe6389f4fd4c14~iW_FX_2oE1141411414eusmtrp1D; Thu, 16 Jul 2020 22:24:01 +0000 (GMT) X-AuditID: cbfec7f2-809ff70000001938-de-5f10d382fd5f Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id A6.41.06017.183D01F5; Thu, 16 Jul 2020 23:24:01 +0100 (BST) Received: from [106.210.88.70] (unknown [106.210.88.70]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20200716222400eusmtip2892087dd532afc49125c05ffe5a951c0~iW_E5zj-w1438714387eusmtip2Q; Thu, 16 Jul 2020 22:24:00 +0000 (GMT) To: Sarosh Arif , anatoly.burakov@intel.com Cc: dev@dpdk.org From: Lukasz Wojciechowski Message-ID: Date: Fri, 17 Jul 2020 00:23:59 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <20200715133136.31986-1-sarosh.arif@emumba.com> Content-Transfer-Encoding: 8bit Content-Language: en-US X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFuplleLIzCtJLcpLzFFi42LZduznOd2mywLxBmcucls8ureY2eLdp+1M FqfWfWd3YPb4tWApq8fpn0+YPRbveckUwBzFZZOSmpNZllqkb5fAlTF591PWgj18FbOnTmJr YLzM3cXIySEhYCLx+c00li5GLg4hgRWMEltbO6CcL4wSm7rmsYBUCQl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JvE+Wsf2UFsFgFViTOPT4DF RQXiJJZvmc8OUSMocXLmE7BlnAI2EnOnfGCHWGAmMW/zQ2YIW16ieetsKFtc4taT+UwTGIVm IWmfhaRlFpKWWUhaFjCyrGIUSS0tzk3PLTbSK07MLS7NS9dLzs/dxAiMnW3Hfm7Zwdj1LvgQ owAHoxIP7wIvgXgh1sSy4srcQ4wSHMxKIrxOZ0/HCfGmJFZWpRblxxeV5qQWH2I0BXpuIrOU aHI+MK7zSuINTQ3NLSwNzY3Njc0slMR5OwQOxggJpCeWpGanphakFsH0MXFwSjUw5h70XOP/ J03PnJ1v2cWMoPSGl1XBYkJlZv8Mjkc9sizfc5kv11T6nFJisOGdW/ui9txzWGQvejS3g9mu ijVit33pvccCi8/4OgeLPp2y+N7DWTY633yfpK0xyi/dePPOr9Ccicv8b15Ic5WInGA4+cln J/3iZxfFl93+tryNfbPXVFOeD4tTlViKMxINtZiLihMBYxKTGbMCAAA= X-CMS-MailID: 20200716222401eucas1p283ce85fec0165c64392f0c96052fe35a X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-RootMTR: 20200715133236eucas1p177311544d71d3806b436cf69734ffe08 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20200715133236eucas1p177311544d71d3806b436cf69734ffe08 References: <20200715133136.31986-1-sarosh.arif@emumba.com> Subject: Re: [dpdk-dev] [PATCH] lib/librte_eal/common/rte_malloc: remove redundant check for size and alignment X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" W dniu 15.07.2020 o 15:31, Sarosh Arif pisze: > Since mallock_socket() always calls malloc_heap_alloc() and > this check is present inside malloc_heap_alloc() so there is > no need to place it in mallock_socket(). > > Signed-off-by: Sarosh Arif > --- > lib/librte_eal/common/rte_malloc.c | 4 ---- > 1 file changed, 4 deletions(-) > > diff --git a/lib/librte_eal/common/rte_malloc.c b/lib/librte_eal/common/rte_malloc.c > index 9d39e58c0..51256117b 100644 > --- a/lib/librte_eal/common/rte_malloc.c > +++ b/lib/librte_eal/common/rte_malloc.c > @@ -61,10 +61,6 @@ malloc_socket(const char *type, size_t size, unsigned int align, > { > void *ptr; > > - /* return NULL if size is 0 or alignment is not power-of-2 */ > - if (size == 0 || (align && !rte_is_power_of_2(align))) > - return NULL; > - > /* if there are no hugepages and if we are not allocating from an > * external heap, use memory from any socket available. checking for > * socket being external may return -1 in case of invalid socket, but Yes the check is duplicated. However it allows to avoid many unnecessary operations that can cost a lot, e.g. locking memory inside rte_malloc_heap_socket_is_external(). I would keep it. Please also note, that the checks are not quite the same as the malloc_heap_alloc is called with changed align value (align == 0 ? 1 : align):         ptr = malloc_heap_alloc(type, size, socket_arg, 0, align == 0 ? 1 : align, 0, false); Although there should be no change in check behavior as for both align ==0 and align == 1 the check will fail and won't be the cause of returning NULL. -- Lukasz Wojciechowski Principal Software Engineer Samsung R&D Institute Poland Samsung Electronics Office +48 22 377 88 25 l.wojciechow@partner.samsung.com