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 7510A41CE5; Mon, 20 Feb 2023 12:03:50 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0E85F4301F; Mon, 20 Feb 2023 12:03:50 +0100 (CET) Received: from wout4-smtp.messagingengine.com (wout4-smtp.messagingengine.com [64.147.123.20]) by mails.dpdk.org (Postfix) with ESMTP id 408DA40395 for ; Mon, 20 Feb 2023 12:03:48 +0100 (CET) Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id CF60832004AE; Mon, 20 Feb 2023 06:03:46 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Mon, 20 Feb 2023 06:03:47 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= cc:cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm1; t=1676891026; x= 1676977426; bh=u18OQJSJTKjbK7sKGwmiABAfKEuxfU5Z9xZYJJaX16k=; b=E bRMsrXIDhFSB76NOoU12CdpFug4NbvvVteK+EjsRF14ahVS7IHxG51XHebTGnqJu YttgeFQTL/rwPW2sfgCsCrsZoOEFw0Wdgd5nu4KU1wwjcPoa7OK7qI5aclMAvnRO GSv8cUVxec+P3ujVAAMBrF9iHudXXuq2frCqB2ys66YiZ4nXDOFtcpCP6ZqfUo5v kPCwvyUZ3HLYqz6xuPJjdYOuoBUPlz13USl9ZmAX9tZE0LgdxocIdx6w8fr08xMF uj6Dsc5z/CJXyP3Z0VWoVeaNyjJ5E+HMTjrB1UevFjrDCBSbOTh0BY4SuWkQQzML NW4SiJ46vEbkQglbk+6OQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1676891026; x= 1676977426; bh=u18OQJSJTKjbK7sKGwmiABAfKEuxfU5Z9xZYJJaX16k=; b=D rfUHa9wWG3SGYhfz6118jNxb7XcTJtVERWzR+PlC8SblYJuzJbg+ZjtMpjHMB+mk JO5sUnyv2YdIIHrCB1GCMIk34k+HG1VQZVsdBUr68kSUWOuEt/SHrnBekevkAiOo KK/kUVK6aem5sQBsK7LCiSrX5V2t/D4Xga2goh63M620/04vYsgawV+OStVPmYOz AZwSs8cjmvNVqI9Wbk23yECh3u15yL2dn+ImOLH+pmArddL4LPfFvnRFfmdQvunr hIP8/0yjX2agNcD5zf1ioPrfj4Mseebl8bfnvNsiXdTjlN2CVtglfqwbN7fIcpCS exWZFg/+dlo0FEYyzvTGg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrudejhedgvdduucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvvefufffkjghfggfgtgesthfuredttddtvdenucfhrhhomhepvfhhohhm rghsucfoohhnjhgrlhhonhcuoehthhhomhgrshesmhhonhhjrghlohhnrdhnvghtqeenuc ggtffrrghtthgvrhhnpeejjefffffgffekfefflefgkeelteejffelledugefhheelffet heevudffudfgvdenucffohhmrghinhepughpughkrdhorhhgnecuvehluhhsthgvrhfuih iivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepthhhohhmrghssehmohhnjhgrlhho nhdrnhgvth X-ME-Proxy: Feedback-ID: i47234305:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 20 Feb 2023 06:03:45 -0500 (EST) From: Thomas Monjalon To: anatoly.burakov@intel.com Cc: dev@dpdk.org, Vipin P R , david.marchand@redhat.com, bruce.richardson@intel.com Subject: Re: [PATCH 0/2] *** Memory Allocation: Fixes ignore_msk during find_next_n() in fb_array library*** Date: Mon, 20 Feb 2023 12:03:44 +0100 Message-ID: <11332268.F0gNSz5aLb@thomas> In-Reply-To: <1673615669-21011-1-git-send-email-vipinp@vmware.com> References: <1673615669-21011-1-git-send-email-vipinp@vmware.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" 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 Anatoly, please could you look at this? 13/01/2023 14:14, Vipin P R: > *** > In the lookahead logic, let's say after the Right-Shift-And operation to check for contiguity, we hit case http://code.dpdk.org/dpdk/latest/source/lib/eal/common/eal_common_fbarray.c#L235 > > /* if first bit is not set, we've lost the run */ > if ((lookahead_msk & 1) == 0) { > /* > * we've scanned this far, so we know there are > * no runs in the space we've lookahead-scanned > * as well, so skip that on next iteration. > */ > ignore_msk = ~((1ULL << need) - 1); > msk_idx = lookahead_idx; > break; > } > lets say for mask size of 64 bits : in msk_idx 4 we need 4 consecutive bits. > let need = 4. > lets say some of the bits starting from LSB are xx11011. > Operating on the inverted mask for better clarity. RSA - RightShiftAnd, xx -- don't-care bits before > > This condition could hit if there aren't "need" number of contiguous bits starting from LSB. > But, that doesn't necessarily mean there aren't "need" number of such bits elsewhere in the same lookahead_idx. > We seem to be ignoring "need" number of bits starting from the LSB for the next iteration. > > Due to ignore_mask we might end losing some bits. > /* if we have an ignore mask, ignore once */ > if (ignore_msk) { > cur_msk &= ignore_msk; > ignore_msk = 0; > } > e.g. > lookahead_msk before RSA logic : xx11100 , need = 4, 2 bits lost > lookahead_msk before RSA logic : xx11011, need = 4, 1 bit lost > lookahead_msk before RSA logic : xx11110, need = 4, 3 bits lost > > NB : To understand the number of bits lost, look at need; that's the number of bits (starting from LSB) that's cleared to zero before the next iteration. > *** > > Vipin P R (2): > Memory Allocation: Fixes ignore_msk during find_next_n() in fb_array > library > Memory Allocation: Alternative fix for ignore_msk during find_next_n() > in fb_array library > > lib/eal/common/eal_common_fbarray.c | 26 +++++++++++++++++++++++--- > 1 file changed, 23 insertions(+), 3 deletions(-) > >