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 5C8AD423E6; Sun, 15 Jan 2023 21:12:14 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6533242D23; Sun, 15 Jan 2023 21:11:45 +0100 (CET) Received: from DM4PR02CU001-vft-obe.outbound.protection.outlook.com (mail-centralusazon11012011.outbound.protection.outlook.com [52.101.63.11]) by mails.dpdk.org (Postfix) with ESMTP id 34E6840E03 for ; Fri, 13 Jan 2023 14:14:45 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Ed84qUSCaugGJileo5FgICHT9vD79GB3UtA8wqAiPbmO8RhEM4Uf21E15i3CS+9bVLkffqRX7FocUl5xXEBKAdopjHfOfhR6AUU8Y1vHuC94NmIgmoH3dSuafnidOpLBNrSDUGKpNw2jUt8QcG0kuAFCHCsvGcG65ciN9XAV1C2x47yNOI8laaeWW098xEYu/z1HDoHmaNlNQINvc4csyetjf40YmraBG6WrbG8cLIxKWcDF6ZrG8jyTx7ke8a6a9NLKSiDOPOegBUoKCmc7k8+w7OXNbSxzG7jMbKrnRcflSskNWPVynLPXVN+nhVU/tLRxDW3xBAfyYa1EcWo0ig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=RtCpfI6gGNxbCo2tRUsjIYnw/tdPJQ6K0pKL7Gkykto=; b=kih7KH1F7akZwbx9rcFkk2q8ZN48XTBSJAqRTeFkNZRPnCN73ro7EpDogwynO3LyxUuAlbqPD8BLFOt1/O6R49b0uTvTr/kOke/VJW0vRd+byCuB5pig2Hf9DoHqyXTbFk9vqfwi9lsXpGYKmy9uhz9NI5QeK4oyV6LIgXbtUgBYr9EeQQkLK4QGCkRX9Kz6YWFLPLlou0Om3v+gDmkM6S2rQ7VgfG8ikq2pueYgWzKWVkfZvUaCMjKkfQkf+aT169Kx42ok0XfDbhcl0GAYNJlUxtk0vV16SQ0Dx6D6Wh4lxzxqwTsdi0gN7GItIHGEvVEUfhRNHN5S9L/Acu8Zug== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=vmware.com; dmarc=pass action=none header.from=vmware.com; dkim=pass header.d=vmware.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vmware.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=RtCpfI6gGNxbCo2tRUsjIYnw/tdPJQ6K0pKL7Gkykto=; b=do/JNEMvuNu5EtZkIaD73BIRIVU2VerIkomvk0P+UDZgD4zqTdam6PqhPneHtTPfAKagEwJUfyVmqgt5X34NYPrSKSFVnn0QUHiNdKkLsTa5KWgBcuFs/4E5td1NAR/td60Ff5ZZhFPPMEru6ErTrbyZVLwCVxS7YrJnHeGp+wE= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=vmware.com; Received: from DM6PR05MB5577.namprd05.prod.outlook.com (2603:10b6:5:c::16) by CY4PR05MB3431.namprd05.prod.outlook.com (2603:10b6:910:59::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6002.13; Fri, 13 Jan 2023 13:14:43 +0000 Received: from DM6PR05MB5577.namprd05.prod.outlook.com ([fe80::4cbc:cca6:3a16:5023]) by DM6PR05MB5577.namprd05.prod.outlook.com ([fe80::4cbc:cca6:3a16:5023%4]) with mapi id 15.20.5986.018; Fri, 13 Jan 2023 13:14:43 +0000 From: Vipin P R To: anatoly.burakov@intel.com Cc: dev@dpdk.org, Vipin P R Subject: [PATCH 0/2] *** Memory Allocation: Fixes ignore_msk during find_next_n() in fb_array library*** Date: Fri, 13 Jan 2023 13:14:27 +0000 Message-Id: <1673615669-21011-1-git-send-email-vipinp@vmware.com> X-Mailer: git-send-email 2.7.4 Content-Type: text/plain X-ClientProxiedBy: BY5PR13CA0009.namprd13.prod.outlook.com (2603:10b6:a03:180::22) To DM6PR05MB5577.namprd05.prod.outlook.com (2603:10b6:5:c::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6PR05MB5577:EE_|CY4PR05MB3431:EE_ X-MS-Office365-Filtering-Correlation-Id: 2286feae-455d-4e29-34b2-08daf5682273 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: TvREHCz4oytCnueN1rwBmkqAAwysxz4UWyjWKUzttnympDBU+fA3Bn7G03hGEC1kXUjR6KUmdZVhLX8TGd0b4Vhkds8AL4XqPDkdp+HHUtpDmYSioxUxBqOKVX+wkOPCFojRr1u7THcvfTdrMioe+YPP+TSisVeDyKzg55LvHYZkFjbRaROW9iA4qCdT+58p+23NLORGtJX5LA5WNB3nstd3uTQTdW+IZf0Xmr13ZrWXvkkpACO4Cxvi6ZhpVg0BJgxk11L7bBreoTCYiUQFkxnyzsHfoVX9sWzxpDihkfgHxK8gDiZS6DOFYZRXyIw8WlYLRkYRPzWseHppeEIZwbRc/VxsqPyyeimptPq4xYJaOaZQtpSj6k5s7gBGX64WDWD864IDTUr6ozGmlztDUqcYAGfoYUfYKVAxVJP0KrIWKYi9QMvJASZQaiFwhexTORTYzEFcM4zn90fAz8zdAwkddcEgOC+XO5hcQuUgakhkBH6KxQBNfWYMSKMat8CUoVPhKWwFk11HGxhvbGWJvjzRRLC9RUrQnBrLMpM/eNkIIe1LPGQFSFIPEBUI6ez26fDi9T88fNTjBMfnJ4NWjBb+ANv1Jqn4/iGZYohGa0TTdII48V/e+G8YBzQaTA0xCMwWF7DusrzT9YGWQIdAV7YLNN7+e2YYkzSiRkKJLl/7qxFifarlWo5SzERkCl+O X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM6PR05MB5577.namprd05.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(4636009)(396003)(136003)(346002)(366004)(376002)(39860400002)(451199015)(6506007)(107886003)(36756003)(6666004)(2906002)(5660300002)(83380400001)(4326008)(6916009)(8936002)(8676002)(38350700002)(6512007)(38100700002)(478600001)(41300700001)(966005)(6486002)(26005)(66946007)(52116002)(186003)(66476007)(66556008)(2616005)(86362001)(316002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?b7t8w4sYhM2ZGy6BtSyfUlI27E7xMWocFdv7NR9XDfEN2eTBoF/d55WPvsuq?= =?us-ascii?Q?NVZShKwE2zMSd0TQv4V0aiB7g5j1ghqJOf9tlRR+tqYFGTzBeaidTgz6vH5K?= =?us-ascii?Q?VSLPTrnOWDVNERshnpuNNlxqy+0O5tSlWIx9JidYsPkkrcYLGQnMuZMBVnMJ?= =?us-ascii?Q?vl/fI+Fuw3Fyd6WrSaRdee3/b/jKUPX9+7buKesB0blHEQlpXIwv2Ruiig/E?= =?us-ascii?Q?amshW0s6R6rYHp4a4wNHzFeyJl26NT2PBgCInCxryzTEflXO1RmFlCiOMskN?= =?us-ascii?Q?jD5J4PW79I0q5ks4VLjAwU9pNGvqtOii/JgV0KYP+uKOIUgwGc4HK4MBbS3/?= =?us-ascii?Q?RFLTPDCccciQq/vAKkz2gvOcAzD+7JLg7SH9zTKjtXk6nccjKHuEKcpug4p4?= =?us-ascii?Q?ZT2hLp47CJ9Zd/Dq0r3VVptp1vpv+SRNfBXCvvxV+mkmVFFeW14R8i0245/Z?= =?us-ascii?Q?wND6ZBoQeCl+3K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Or?= =?us-ascii?Q?w9zzit+Sdn5VtCRgNVdeH+Bb+bGSHGBvBZoLHa0V7mZ9LR+OGmi92WE/d3eG?= =?us-ascii?Q?iviOt+BnhLgPYV2ScSXBw2MSl0hF3TdaiYoaIqMJN3OuMb9sTX5Sbped3Tcn?= =?us-ascii?Q?3C51UplQKWN9Ipv3+Gmr2i4EWCBMmpm8TBUxGngXDXCrmol5zaI0DorO25f+?= =?us-ascii?Q?yopfBcSRtIMobSNAMqmNWiIuBqkt++GJigfU46b8?= X-OriginatorOrg: vmware.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2286feae-455d-4e29-34b2-08daf5682273 X-MS-Exchange-CrossTenant-AuthSource: DM6PR05MB5577.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Jan 2023 13:14:43.0974 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: b39138ca-3cee-4b4a-a4d6-cd83d9dd62f0 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: vuhtl6y6M9GyrrXJFGHTxMpx0dHspjpyWa/7425OP4u1kc952L89/sliJRBQnrv01SOy5dkhIfvGu1afmp11Bw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR05MB3431 X-Mailman-Approved-At: Sun, 15 Jan 2023 21:11:39 +0100 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 *** 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(-) -- 2.7.4