[PATCH 1/2] Memory Allocation: Fixes ignore_msk during find_next_n() in fb_array library

Vipin P R vipinp at vmware.com
Fri Jan 13 14:14:28 CET 2023


Ignore mask ignores essential bits WHICH could have been contiguous.
This commit aims to rectify that

Cc: stable at dpdk.org

Signed-off-by: Vipin P R <vipinp at vmware.com>
Acked-by: Kumara Parameshwaran <kparameshwar at vmware.com>
---
Depends-on: 0001-Memory-Allocation-Fixes-ms_idx-jump-lookahead-during.patch
Depends-on: 0002-Memory-Allocation-Fixes-ms_idx-jump-lookbehind-durin.patch
---
 lib/eal/common/eal_common_fbarray.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/lib/eal/common/eal_common_fbarray.c b/lib/eal/common/eal_common_fbarray.c
index 90240e8..313681a 100644
--- a/lib/eal/common/eal_common_fbarray.c
+++ b/lib/eal/common/eal_common_fbarray.c
@@ -235,7 +235,12 @@ find_next_n(const struct rte_fbarray *arr, unsigned int start, unsigned int n,
 				 * no runs in the space we've lookahead-scanned
 				 * as well, so skip that on next iteration.
 				 */
-				ignore_msk = ~((1ULL << need) - 1);
+				if (!lookahead_msk) {
+					/* There aren't "need" number of contiguous bits anywhere in the mask. 
+					 * Ignore these many number of bits from LSB for the next iteration. 
+					 */
+					ignore_msk = ~((1ULL << need) - 1);
+				}
 				msk_idx = lookahead_idx - 1;
 				break;
 			}
-- 
2.7.4



More information about the dev mailing list