From patchwork Fri May 5 17:41:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Liam R. Howlett" X-Patchwork-Id: 13232890 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id AD656C77B7C for ; Fri, 5 May 2023 17:44:10 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3D7D16B0083; Fri, 5 May 2023 13:44:08 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 2C1456B0085; Fri, 5 May 2023 13:44:08 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0C4546B0087; Fri, 5 May 2023 13:44:08 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by kanga.kvack.org (Postfix) with ESMTP id E0FC26B0083 for ; Fri, 5 May 2023 13:44:07 -0400 (EDT) Received: from pps.filterd (m0246632.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 345HhMIR003021; Fri, 5 May 2023 17:43:47 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=PO0W61VFFcUaz53IVxUaRxBQyFx/sbKsCEqLpzGF0n4=; b=LqEgasWrIA95Hxyv76IReGM536nr5WfgCJM6tUZkmg9tXemBCINBeh+EidHQPwyMpi8I jTkUywFWQfUhXWgWGl/Hdysr0Y8Xt4HVQGnbW7A+ZhH2xEDPCujPYQYc6KBD24vVxQVq y9Ub9N7I/ifI794KlHHeiA4wkHLsUJytZdms5fsIQ+5u8OKFCf7FDBPcoey53Qotmull J7q29TZ6du3h/u08h4aTTaTciuplRa9go2Ah68WTUkR9yJrCNOV7bVB5p2Y2WeLaekZN l8BKV/447qw1ScsXVal7mLNzFtH8K+SXFu4QHca7PSJ9FO8/UGdUuzWW7F+xK9RBGkju fQ== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3qburgdkc3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 05 May 2023 17:43:46 +0000 Received: from pps.filterd (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 345GctAA020798; Fri, 5 May 2023 17:43:46 GMT Received: from nam12-dm6-obe.outbound.protection.outlook.com (mail-dm6nam12lp2175.outbound.protection.outlook.com [104.47.59.175]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3q8spa5ev6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 05 May 2023 17:43:45 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=huoa2cqSggt1G2osgKmHveOHAQNKB935oGkMhOs1onULOZzhAaQ3sEOmuqSlUJRVJtrJCX30IEKv+31F9spN+9RtGsIUBGfzV0YdN2zdT4oK9JEx2enqqrxU7FTGndjU5na/LACbXn6vV+8jFWYTASQhubGyYjL4WyWUA0lfFCWz92fic8ilWUQVPCV5eaAN/u3Yj665cf2EDM7NA9g3mtSOfK+pGkQWgaoARJ5pklb3VDfIo76yVofXxwjHZAsL1g0n8UmTVs/zvLLG7izEcvQKvtm7/fPq49tVC/GJ641E5B6AsbsDY0kGbhbxhTmvy7zA3gR2/W1vtyHP+rX7hw== 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=PO0W61VFFcUaz53IVxUaRxBQyFx/sbKsCEqLpzGF0n4=; b=CcAmIajLUezrQOWQ0AaGpOw24wYz7CouU+LYZhQru7fTLHOFqyflullcYQIDyw9XsStSiCA3BPaGxU+ndfoAdLZX9mOuRR02Ur6TfH9+DEgrJAuvYldtYvi9M0d9MaX5RPSljEHdqApGvX40FZA9N/evQGSs8AUd5RcJeY0tUa1/Ulf9FX5dWcvX6V3JWL7xl2i/IQOEv8uGoE+tjdCXl4wG+LfMaaNsCWOml9PDBkJe84H+xSQKhigQukXenIeVKzsvDz/y9EnC4o2DSP2ljPDRSYYRkeB7uKyWhWlN8EPSJZtQ/lvWt50NfEbTDnyCaYMrplc6Pg8yub3pmCrwfA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=PO0W61VFFcUaz53IVxUaRxBQyFx/sbKsCEqLpzGF0n4=; b=uxKBO8wSHAr/Nhd1NX9uljPc/YqnMMHwnWUVdSXr02t9adO/mdiKHP47gTeoOue31s9slXroXh3ggoWwuaMRl5WAqFwrxMSiN8WmcFWy16VxSJ4+cnYkNKtI6hLg/dSKwwzf4AOB5NWnS+0o8b2N2C54BFUvhq1OjvOiAJjBW3k= Received: from SN6PR10MB3022.namprd10.prod.outlook.com (2603:10b6:805:d8::25) by BL3PR10MB6089.namprd10.prod.outlook.com (2603:10b6:208:3b5::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6363.27; Fri, 5 May 2023 17:43:43 +0000 Received: from SN6PR10MB3022.namprd10.prod.outlook.com ([fe80::8bb9:2bb7:3930:b5da]) by SN6PR10MB3022.namprd10.prod.outlook.com ([fe80::8bb9:2bb7:3930:b5da%7]) with mapi id 15.20.6363.022; Fri, 5 May 2023 17:43:43 +0000 From: "Liam R. Howlett" To: Andrew Morton Cc: maple-tree@lists.infradead.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, "Liam R. Howlett" , David Binderman , Peng Zhang Subject: [PATCH v2 01/36] maple_tree: Fix static analyser cppcheck issue Date: Fri, 5 May 2023 13:41:29 -0400 Message-Id: <20230505174204.2665599-2-Liam.Howlett@oracle.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230505174204.2665599-1-Liam.Howlett@oracle.com> References: <20230505174204.2665599-1-Liam.Howlett@oracle.com> X-ClientProxiedBy: YT2PR01CA0026.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:38::31) To SN6PR10MB3022.namprd10.prod.outlook.com (2603:10b6:805:d8::25) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN6PR10MB3022:EE_|BL3PR10MB6089:EE_ X-MS-Office365-Filtering-Correlation-Id: 25fdad31-8e33-428c-e0e4-08db4d9044ec X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: QQZijbijfWTGdAINkQODhrZZnAbATtGmdSvOto+x2uZSdEIdwzy6O7Tjb1TT/El2dFvxveXWbwLnSJXP5azk28Q0miPca/1FU+1rQT8iR1hDbnVk10iY/AbKdpv6WEqoAkHSBLpqZWZEX41VFASG7ZoFGiUaUhAvI3sLOi9kH9DwC6+k1PS3FQEc23IdTXzKd30u9oIedsJ3CEEai4nyb89T8Hh8lkrFWJTI+0LcJFOaBzwxDLpGqwcxKeVjgsnD3OEvh5nGDV/P7viLUX5LSyai5Q1Yg791fNbLgwmz7D9soObvZuV9GUOi8pN9rdAd2ZQSD3gMUKS2jsdty3XhKXfJjVOHwhMoEK2TFhSBCZPIilUyiur/s9OOB+qRet+i+u81OmbsxYnlpbZ1M0lC+kXLDhXSq0t7o/sNrWic9AS38g1uKv4AubRxkS2vhDjFksYdzbJ5r2t5y5L953WrA9RhqVQrdYF8PN4y+o8y5I+oPg+AALwfn07NIGMu7qru/d4VpKXSNP+YqK5tyExlUWfURDF4IHhn9bqVBFXmADESmRs8h9fLg3N2EfwHjqcf X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SN6PR10MB3022.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(396003)(346002)(366004)(39860400002)(376002)(136003)(451199021)(66476007)(6916009)(4326008)(66946007)(66556008)(45080400002)(6666004)(478600001)(6486002)(316002)(54906003)(36756003)(86362001)(83380400001)(2616005)(6506007)(1076003)(26005)(6512007)(8936002)(5660300002)(8676002)(2906002)(41300700001)(186003)(38100700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: M5wW2raEKgyPH9xhWQAyAjzLQL+fHOwRerCaROBtB1GCcj/A/KeVQQ67yf20eKein7DxP1d3ZVFDTqKFt/MhCsYnad5pLYPh1WkwlhnlpzJEHJoormswvGsVJsYuJa47IZkjukg9JwRT9V5kaa/cq/RXjWfGacQ6MBDr5/IquSawhSmdvBb6EwVYXNZY7bRWuAqZFaQ0rECkF62L+SksKJqeIti91EuMPN1n5LsgJlXvstoC0Z6KY08T7V/90w0BzloqW+owZFElxqyDuuu+SzsdA6XCd+gPX62edtEzfGcurs/xhAbpoOHIqnwP+GNyhLd4TK88/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qj9WWrjdosUDl8aKdA/tlZiPUza/laPs1Eh++FRuyJbmU7Bgr5JePYxO6s5znQFgzJ93AVhBPyJD+q8rgh67mfUKHeSO17rnHGrS9m365tQbaztqeOGupfSLsKcyMSwTzm7Rk/SKWgqQ3g3OHCVC2cdA7boWnYccSD9+szK9yAFg7hodka9BeJoVU+4Z/+O0a7g== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 25fdad31-8e33-428c-e0e4-08db4d9044ec X-MS-Exchange-CrossTenant-AuthSource: SN6PR10MB3022.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 May 2023 17:43:43.1435 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 9kmt97bm4KhIoXfaX+3gDkh0irWBzApfw1CJfP4gLkCMxoBMw2CCz0jQOyoci9cJmCzIT4CoEB4Yw6IOqXxf5A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL3PR10MB6089 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-05-05_24,2023-05-05_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 mlxscore=0 spamscore=0 mlxlogscore=999 phishscore=0 malwarescore=0 adultscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303200000 definitions=main-2305050146 X-Proofpoint-GUID: pMvzGaO3rIQXOkPOgtlMkyif9g1N5z3f X-Proofpoint-ORIG-GUID: pMvzGaO3rIQXOkPOgtlMkyif9g1N5z3f X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Static analyser of the maple tree code noticed that the split variable is being used to dereference into an array prior to checking the variable itself. Fix this issue by changing the order of the statement to check the variable first. Reported-by: David Binderman Signed-off-by: Liam R. Howlett Reviewed-by: Peng Zhang --- lib/maple_tree.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/maple_tree.c b/lib/maple_tree.c index 110a36479dced..9cf4fca42310c 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -1943,8 +1943,9 @@ static inline int mab_calc_split(struct ma_state *mas, * causes one node to be deficient. * NOTE: mt_min_slots is 1 based, b_end and split are zero. */ - while (((bn->pivot[split] - min) < slot_count - 1) && - (split < slot_count - 1) && (b_end - split > slot_min)) + while ((split < slot_count - 1) && + ((bn->pivot[split] - min) < slot_count - 1) && + (b_end - split > slot_min)) split++; } From patchwork Fri May 5 17:41:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Liam R. Howlett" X-Patchwork-Id: 13232883 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id B7CF2C77B7C for ; Fri, 5 May 2023 17:43:50 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 35F4C6B0075; Fri, 5 May 2023 13:43:50 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 30EA96B0078; Fri, 5 May 2023 13:43:50 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 160B96B007D; Fri, 5 May 2023 13:43:50 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by kanga.kvack.org (Postfix) with ESMTP id E8DF16B0075 for ; Fri, 5 May 2023 13:43:49 -0400 (EDT) Received: from pps.filterd (m0246630.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 345HhK1h014772; Fri, 5 May 2023 17:43:49 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=S58ESfS5JJYWB2ZAlQ3vKg+/QpLNdflt2UxDlEU9y5Y=; b=QFNRDu+OHAY3gy7ncgUmKhRMYbfW5Ln4e7TC0gwm+kI/uxv6PEBKdbrhU4Wo+Y1rYjSI mIVKebbYSs3gRJjyAybOUhFrKImu2b3bXYKYzmKRXujJGXoUkFA3VG+v+ikgEupEnOtT yPzE6KkmmzQYBFaU1UJ05OZ/KXLmd4IxXd5B2Cxvog2YVwI8AYRJ5ohEtlzoQ8FL+dX7 VQEbJmzpMJFE7D/+6YjuNoSOWdVdjX3J5AQ15RtsmQNBk3AfGiIRV+Lekl/RM4f06D8W ID68J24K9XeU/GQ5kT/ArxGofxeic+4mEjcUS8iOp1fuKU/Pa/SS6Obs9AoxFZA8I3Fo gA== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3q8sneddxe-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 05 May 2023 17:43:49 +0000 Received: from pps.filterd (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 345GuBT8020742; Fri, 5 May 2023 17:43:48 GMT Received: from nam12-dm6-obe.outbound.protection.outlook.com (mail-dm6nam12lp2168.outbound.protection.outlook.com [104.47.59.168]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3q8spa5ewa-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 05 May 2023 17:43:47 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BWqo98ioCWkhe93YGjOvdaI9ZN96XqZ29VD3OSRVGCBgqgBxCjKnymQavNhfiLhaSnjVip+UbNt64lbxvhNVMlUxFcW7soFAnM+s1hP6nfRec9nug6l+yajBmjN23zRmxKVKvmLHSzgpBrCygE6IN5QZjGEstHcCIQkLTrxI9f7/6OzCed151xT5SnYdJq37fgTnBD1diZeb71jyHNfclx6KWExwy7OB/5q6IuVjOc1Zg0WWKdiTK2m4Td+zYplERQINIlOCa5gSk/K/5wq1aa7WhIClTGOFxYa/HEDh7ChpsQZZjqYLoLFOrP+9I3H3yT6Ae/C0xq5P18tCQVZnnQ== 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=S58ESfS5JJYWB2ZAlQ3vKg+/QpLNdflt2UxDlEU9y5Y=; b=mCP8RDJCNgJin1suoI5wxeHKAwmfyjyYeS9Kl6vnQAl/VPCJI5pwtXC5ldl+vZmjiJio8KSBfOsVg9MZw2mMjmdUP4qyhFJagNYZX8zImBAg52Ypve4jJQYCoe3sCI8VTTFYlqtmEBJnIkmY1IDXuZ5+PEPJS9c+BYvdpp5kb2gM3+EKiBMotsp/TwtkOSsdJiLS+ZUNDjlXyEjFR5eFQkavFrlmjjl7gu8nRvPlFeC40HjUYYDgYyXSEj/M7Z/Cv6F5P6xYOJIWzJn4KNJ5MFyO4UMI7paE34DcDIpNox6AQ2OQGmkHQUnfDIWMoaMAA7QkWvTiFNalzZfzRssapw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=S58ESfS5JJYWB2ZAlQ3vKg+/QpLNdflt2UxDlEU9y5Y=; b=zxs94ji61fv8j9wbDXOAh2dLx429/Cn/hI5AiMXkS+0dPA0FusQtckmYuiZUS+tgekc6yxA7l4CMjt8Crzrj9aQZmq7na9SVpW+Gwg3yejYKL3cxaJ81FzJoT4pXqe+oKHUTXNSkwUIfBU+NDrK4Hkzs9oEB6x+Wow849Vu/l4o= Received: from SN6PR10MB3022.namprd10.prod.outlook.com (2603:10b6:805:d8::25) by BL3PR10MB6089.namprd10.prod.outlook.com (2603:10b6:208:3b5::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6363.27; Fri, 5 May 2023 17:43:45 +0000 Received: from SN6PR10MB3022.namprd10.prod.outlook.com ([fe80::8bb9:2bb7:3930:b5da]) by SN6PR10MB3022.namprd10.prod.outlook.com ([fe80::8bb9:2bb7:3930:b5da%7]) with mapi id 15.20.6363.022; Fri, 5 May 2023 17:43:45 +0000 From: "Liam R. Howlett" To: Andrew Morton Cc: maple-tree@lists.infradead.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, "Liam R. Howlett" , Wei Yang , "Liam R . Howlett" Subject: [PATCH v2 02/36] maple_tree: Clean up mas_parent_enum() and rename to mas_parent_type() Date: Fri, 5 May 2023 13:41:30 -0400 Message-Id: <20230505174204.2665599-3-Liam.Howlett@oracle.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230505174204.2665599-1-Liam.Howlett@oracle.com> References: <20230505174204.2665599-1-Liam.Howlett@oracle.com> X-ClientProxiedBy: YT3PR01CA0007.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:86::19) To SN6PR10MB3022.namprd10.prod.outlook.com (2603:10b6:805:d8::25) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN6PR10MB3022:EE_|BL3PR10MB6089:EE_ X-MS-Office365-Filtering-Correlation-Id: 86eb6d51-477b-42ba-a081-08db4d904678 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: KY/DIrH1NDoZFyXEf7FUyHkksvShYO8YuB+ybsz+kkMEqjuPVr+Y68dXoKsBmPwXBmL+xUP9tvomS8zmF/hcDdUwnau+Zn6gr4IC8MuF/XImSN4QU//Ss4csrr/lKY5DME6+u35OkKgqJciTXRSL+D/iaj0vzArCstAg1RypCdZkViebcMTh1qmc23OWXRJJppASNg7WdJFuSGa+fhKuvS4AIBYVmUFfU5bX+yvhB29o1xL+xU3Ja8YWJfQzDl0eO5ndR39qj5oHcmO1VmimUwR115e4Kn9LXEOYUHR6o1MgJ5MF6LeU/vBQfso024f94+nD1p93jDjKGKFShnFDC7XBqJnaDzD2GEvVUiTjMl73FmTeTJ+yxxYR/R0NuOcCsCqP6/r8zz6HR3fWSim2LEIsZdK9E91G0c+vaR6IorJrz44nqot054EVNO+bE5KJbPhvBFLeSeYgo0Rlv532DS1mOfDLsBFLK+VebzQOdOVThuAxgVGkmevYrBgyycrX6xzNs+auYQB6QYwpSV9orW+Tsp1CFf/gbW9CE25OaT2poddsA2qs245LSLglfMv8 X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SN6PR10MB3022.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(396003)(346002)(366004)(39860400002)(376002)(136003)(451199021)(66476007)(6916009)(4326008)(66946007)(66556008)(6666004)(478600001)(6486002)(316002)(54906003)(36756003)(86362001)(83380400001)(107886003)(2616005)(6506007)(1076003)(26005)(6512007)(8936002)(5660300002)(8676002)(2906002)(41300700001)(186003)(38100700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 2hMB07DAKl+LFD7DXRb/7o0zoxXbTpJ9rzytyRs0o80X1BABG9Kq09hJUC0ceqLQcmXcy2tdiYzReppMYIc48ECpJqqmRUoJuxvnjk4LI7F+5g/QaohR0z5PEqJ5+rX+GhTsCId7xKorB4wihOzOxTWm4LJ/xCPu8imR1quOehdT8FwoNH1KqGc6TeHfr+9DgujkKNm5p6MJryjKDtohgt/PfBHNN85OLYqAsHNulGlE/WqTyjy0dPGRhXbMgCFYGlHL9crA7vuMuh9y7poqbiwcVw8i9C+77frZNDQP5ou8XLKN9cwD0QjamGbuITCo/wRv4KjcUO4xyfJdA9QBZmyM3zJS14vi73J33PFvGh+pwA8Hc6Q4UOzFQaQmm6G8T8vCoTsw9eQHFJFMhE+fa9EiVVdOxDLZnpQR1m4GPfuIg9+uwSuMLqcIARW9CqyUozeV+dcgy4ybz6BOVsvgAee+tjjZr2kuSvzCxH9sJhpvtOAi5bShDh82tx/ESOmgTi/1UjVQQgM6cJNyNP9qTFEj3z7pD+SxkSrN9rxpK95EykR4CdhhBkCnmmyjBdqOlEbs3WEtQ4zfOMZKL+3vJ+rhund9Wv1LtwiOHR07acjPZeoP3fBFiRVpdz56Yr+PfMYyc9UjlnXC8iQo5BUPYarhYgsNQS3Xn+c/osjthf8c2CQq4DjmG071zCxBNBwT4SLTPcXv5mCXV9ZlY+B8mCjJ12Fz1O/cZIJKG8xnQ2o/QGChT7jw/9LPiGRiD/RttG7yzEAg8Cm7vNSLyjA5WNCy7jtjKI3f9yUtML5eIKQfMs+HDS6ICEhMMfBmbr/7nI+pb+4bmk1IdpiC5G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LGRe9iNmBaDA51beJrkfIb4SQKkrOnRCksDiZgRctcbkr9X7cSGrMHJzckuBSxKqX64fyioAV134nNAzrgqp5Pal9otjcjIE7u3pn5u4+lutJ8tdVqB+F8Cd0hsoJjg+LAPDN97LOVfxjatbT6RSDd+r43ulxR0gQANiSyRpEUIas1zfhmnxW6zKgf5h+umTvnBfZYWGN/jO+P+3nTqH0STflMk09KQKghGHBvvTAHlb2cnrTYHshLJ/niVVJrSEg0/m+Rd7ytnuTmYyLi7r/dcpFlUDk9CLiIlQ2rI4lolME7HgdFYGKREJHP+52F3qinePZoI/dCQgIzg9KPsRUg+dX7bjK2chQhGjGkIULv0F8rEiMXwIPF4C05LkL+DiMfayn3rzxC17t2/H+8LaiDDwcuOQiLri+ZKmS8t+QMspSD0B8I7HRlgE5Og/XLU5MIuUBofbYYsN93o7CmQ4MJtKL6jR1v0pRt5cbCxQiY/zeTo/6RTPPuiv2Vg2yRBSZgDUN+cQfXahdmRo5ilRrXNF/An5lyLhKzHoHh9ByIF7pc3BCuhgqTDfNx8SpOmUS96Tb5/LLmq6Ld3J2Eif6sxhDjLs+WqDBo+GeQY7N9pjmTX1OWIEa1x9fX+7K6+saP9k4Eoi0fqk0TDkL6el45iQohEp+1vqg1CS6iMiB2OaElgzxITYdd8n/xe56R/4pyeqRrZ5cM= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 86eb6d51-477b-42ba-a081-08db4d904678 X-MS-Exchange-CrossTenant-AuthSource: SN6PR10MB3022.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 May 2023 17:43:45.6972 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: NzDwOtF1qJOgUP2ODVuQ2+r5388z/wIBGFpuVSodpN2Mkcbrq3fyK6XScIDC0cmXfn+0bl1rVlYr4PRV2IKVrQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL3PR10MB6089 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-05-05_24,2023-05-05_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 mlxscore=0 spamscore=0 mlxlogscore=999 phishscore=0 malwarescore=0 adultscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303200000 definitions=main-2305050146 X-Proofpoint-GUID: ygWba-i0sCKZQreKgD0Yg0IPrstlhNCF X-Proofpoint-ORIG-GUID: ygWba-i0sCKZQreKgD0Yg0IPrstlhNCF X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: From: "Liam R. Howlett" mas_parent_enum() is a simple wrapper for mte_parent_enum() which is only called from that wrapper. Remove the wrapper and inline mte_parent_enum() into mas_parent_enum(). At the same time, clean up the bit masking of the root pointer since it cannot be set by the time the bit masking occurs. Change the check on the root bit to a WARN_ON(), and fix the verification code to not trigger the WARN_ON() before checking if the node is root. Align the name to mas_parent_type() since mas_node_type() exists already. Reported-by: Wei Yang Signed-off-by: Liam R. Howlett Reviewed-by: Wei Yang --- lib/maple_tree.c | 50 +++++++++++++++++++++--------------------------- 1 file changed, 22 insertions(+), 28 deletions(-) diff --git a/lib/maple_tree.c b/lib/maple_tree.c index 9cf4fca42310c..555de3a8343e1 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -425,28 +425,26 @@ static inline unsigned long mte_parent_slot_mask(unsigned long parent) } /* - * mas_parent_enum() - Return the maple_type of the parent from the stored + * mas_parent_type() - Return the maple_type of the parent from the stored * parent type. * @mas: The maple state - * @node: The maple_enode to extract the parent's enum + * @enode: The maple_enode to extract the parent's enum * Return: The node->parent maple_type */ static inline -enum maple_type mte_parent_enum(struct maple_enode *p_enode, - struct maple_tree *mt) +enum maple_type mas_parent_type(struct ma_state *mas, struct maple_enode *enode) { unsigned long p_type; - p_type = (unsigned long)p_enode; - if (p_type & MAPLE_PARENT_ROOT) - return 0; /* Validated in the caller. */ + p_type = (unsigned long)mte_to_node(enode)->parent; + if (WARN_ON(p_type & MAPLE_PARENT_ROOT)) + return 0; p_type &= MAPLE_NODE_MASK; - p_type = p_type & ~(MAPLE_PARENT_ROOT | mte_parent_slot_mask(p_type)); - + p_type &= ~mte_parent_slot_mask(p_type); switch (p_type) { case MAPLE_PARENT_RANGE64: /* or MAPLE_PARENT_ARANGE64 */ - if (mt_is_alloc(mt)) + if (mt_is_alloc(mas->tree)) return maple_arange_64; return maple_range_64; } @@ -454,12 +452,6 @@ enum maple_type mte_parent_enum(struct maple_enode *p_enode, return 0; } -static inline -enum maple_type mas_parent_enum(struct ma_state *mas, struct maple_enode *enode) -{ - return mte_parent_enum(ma_enode_ptr(mte_to_node(enode)->parent), mas->tree); -} - /* * mte_set_parent() - Set the parent node and encode the slot * @enode: The encoded maple node. @@ -1123,7 +1115,7 @@ static int mas_ascend(struct ma_state *mas) p_node = mte_parent(mas->node); if (unlikely(a_node == p_node)) return 1; - a_type = mas_parent_enum(mas, mas->node); + a_type = mas_parent_type(mas, mas->node); offset = mte_parent_slot(mas->node); a_enode = mt_mk_node(p_node, a_type); @@ -1144,7 +1136,7 @@ static int mas_ascend(struct ma_state *mas) max = ULONG_MAX; do { p_enode = a_enode; - a_type = mas_parent_enum(mas, p_enode); + a_type = mas_parent_type(mas, p_enode); a_node = mte_parent(p_enode); a_slot = mte_parent_slot(p_enode); a_enode = mt_mk_node(a_node, a_type); @@ -1659,7 +1651,7 @@ static inline void mas_parent_gap(struct ma_state *mas, unsigned char offset, enum maple_type pmt; pnode = mte_parent(mas->node); - pmt = mas_parent_enum(mas, mas->node); + pmt = mas_parent_type(mas, mas->node); penode = mt_mk_node(pnode, pmt); pgaps = ma_gaps(pnode, pmt); @@ -1691,7 +1683,7 @@ static inline void mas_parent_gap(struct ma_state *mas, unsigned char offset, /* Go to the parent node. */ pnode = mte_parent(penode); - pmt = mas_parent_enum(mas, penode); + pmt = mas_parent_type(mas, penode); pgaps = ma_gaps(pnode, pmt); offset = mte_parent_slot(penode); penode = mt_mk_node(pnode, pmt); @@ -1718,7 +1710,7 @@ static inline void mas_update_gap(struct ma_state *mas) pslot = mte_parent_slot(mas->node); p_gap = ma_gaps(mte_parent(mas->node), - mas_parent_enum(mas, mas->node))[pslot]; + mas_parent_type(mas, mas->node))[pslot]; if (p_gap != max_gap) mas_parent_gap(mas, pslot, max_gap); @@ -1767,7 +1759,7 @@ static inline void mas_replace(struct ma_state *mas, bool advanced) } else { offset = mte_parent_slot(mas->node); slots = ma_slots(mte_parent(mas->node), - mas_parent_enum(mas, mas->node)); + mas_parent_type(mas, mas->node)); old_enode = mas_slot_locked(mas, slots, offset); } @@ -3251,7 +3243,7 @@ static inline void mas_destroy_rebalance(struct ma_state *mas, unsigned char end l_mas.max = l_pivs[split]; mas->min = l_mas.max + 1; eparent = mt_mk_node(mte_parent(l_mas.node), - mas_parent_enum(&l_mas, l_mas.node)); + mas_parent_type(&l_mas, l_mas.node)); tmp += end; if (!in_rcu) { unsigned char max_p = mt_pivots[mt]; @@ -3294,7 +3286,7 @@ static inline void mas_destroy_rebalance(struct ma_state *mas, unsigned char end /* replace parent. */ offset = mte_parent_slot(mas->node); - mt = mas_parent_enum(&l_mas, l_mas.node); + mt = mas_parent_type(&l_mas, l_mas.node); parent = mas_pop_node(mas); slots = ma_slots(parent, mt); pivs = ma_pivots(parent, mt); @@ -6995,27 +6987,29 @@ static void mas_validate_gaps(struct ma_state *mas) p_slot = mte_parent_slot(mas->node); p_mn = mte_parent(mte); MT_BUG_ON(mas->tree, max_gap > mas->max); - if (ma_gaps(p_mn, mas_parent_enum(mas, mte))[p_slot] != max_gap) { + if (ma_gaps(p_mn, mas_parent_type(mas, mte))[p_slot] != max_gap) { pr_err("gap %p[%u] != %lu\n", p_mn, p_slot, max_gap); mt_dump(mas->tree); } MT_BUG_ON(mas->tree, - ma_gaps(p_mn, mas_parent_enum(mas, mte))[p_slot] != max_gap); + ma_gaps(p_mn, mas_parent_type(mas, mte))[p_slot] != max_gap); } static void mas_validate_parent_slot(struct ma_state *mas) { struct maple_node *parent; struct maple_enode *node; - enum maple_type p_type = mas_parent_enum(mas, mas->node); - unsigned char p_slot = mte_parent_slot(mas->node); + enum maple_type p_type; + unsigned char p_slot; void __rcu **slots; int i; if (mte_is_root(mas->node)) return; + p_slot = mte_parent_slot(mas->node); + p_type = mas_parent_type(mas, mas->node); parent = mte_parent(mas->node); slots = ma_slots(parent, p_type); MT_BUG_ON(mas->tree, mas_mn(mas) == parent); From patchwork Fri May 5 17:41:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Liam R. Howlett" X-Patchwork-Id: 13232892 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 18E90C77B7C for ; Fri, 5 May 2023 17:44:14 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D98BC6B0087; Fri, 5 May 2023 13:44:09 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id CF9126B0088; Fri, 5 May 2023 13:44:09 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id AFD646B0089; Fri, 5 May 2023 13:44:09 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by kanga.kvack.org (Postfix) with ESMTP id 8B64D6B0087 for ; Fri, 5 May 2023 13:44:09 -0400 (EDT) Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 345HhJxF028056; Fri, 5 May 2023 17:43:51 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=OrIdgrVzXbrkBEQdhLJQ1jIQQYwRAY8yiv0L2JjFINs=; b=y43tW54L0ZFqjtQxUJOeFbHyShrGs2Hj4bX1PgjK3r18/1bJSqG9RxPqktr6CN/JDaqL JbRFO3r3kBUOesCD6Zkz2LnLFco8odYmFFL1KzeNQNpUgp2K/Vgx7j7aCh6xZSbcw7nh +MmoEnFFf8TgFBx0KCfs728BEwWHGA5cRfJ57IbeAQZYwEIJUvgyeyo/2CMqVCvv3JDI cw/7hxa+TwAFrVOMBqPrURgor5WsTXSwraeAqfXFklm6rFXOQiTVDaBnNr2rHqvQ0JYt c9TQGOLrrMILvUIr/z22WOT+wXreNiFgMmYCTrwt2tlJ1aGrSPBcMXCU3MvBvSdF8Ol6 Cw== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3q8t145jc9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 05 May 2023 17:43:51 +0000 Received: from pps.filterd (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 345Gc4Gg020785; Fri, 5 May 2023 17:43:50 GMT Received: from nam12-dm6-obe.outbound.protection.outlook.com (mail-dm6nam12lp2177.outbound.protection.outlook.com [104.47.59.177]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3q8spa5exr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 05 May 2023 17:43:50 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hkNsTRsn0VrJ8vD2djYdWBQoODjNA74eVemBcPXOYCEzuMQFdLUmi/Q7SZ35pvlGhJX6ak+SdCPQAcQNCUq3NDe7oKOm5JxbqNDXsUGuqLGgaBXGaWEpIbVU8bCaUvdrRyt3PVYj20dry4EhpalaPSxjNZ+ZuGtMRvJjXGDZk3IatqA10ezu/MtnnU2ZnF8qq4K3/mwdV3l1CNBTGmTVJLJX7jwAX0eOR92enD2cdjm9ydTfJSUN7fXBlyr5DB6BbatkbMuZW3JfJFUXVJAsBplSLmJpdAt2r2wiMoLcnsXc+EHtks9kTSxt1zkFZBF3dP9zpIM5LjY8pJ6/iMlxQA== 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=OrIdgrVzXbrkBEQdhLJQ1jIQQYwRAY8yiv0L2JjFINs=; b=hxCaI3azltygi4qQ4PvUPj5sujb5oNqABXIKJu8J0TnWzS32Qr0k/UCulkySWv+EDuVRcC7RKhugpANozZ9lkaB1vyAmgJ8r2tY7lXSq9nyD7BdpPr/LNWWFfUGF/iX31XyO56HpJiPQF7HC5IL2iT/lldN+4WFPcspfJOPGi6E9n2f8EglWjfVP3dVt6xjJrRYyXXlpTzFfvWKxNOjdLKR5teC/+AZQAgBrHEF3gXS+/opBdLoKtTVwyhxOKZXIRKAJOFpOf985qBKMwDPdfKSiOuUIVpPp5WB09vCoaoVX+/CoifdBaC6bgoxneKB3XKpIMn+cleWVFwLKTRyMAA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=OrIdgrVzXbrkBEQdhLJQ1jIQQYwRAY8yiv0L2JjFINs=; b=j6d+1ESRn0w5FG+aGapFL4NW8QhPmg563ASwqS0fcLbvghYQUyzlYZAYpg0hNqM1zPmpSUIlsrb/E61iHGIcM2h57r4oFUOM4y+dsV1XGC/0WNfAvv2PkOdiein9o0vqQ02xFQfB8nrry90p4huNWtSmZiKZQoBPKwAN+ol1CfM= Received: from SN6PR10MB3022.namprd10.prod.outlook.com (2603:10b6:805:d8::25) by BL3PR10MB6089.namprd10.prod.outlook.com (2603:10b6:208:3b5::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6363.27; Fri, 5 May 2023 17:43:48 +0000 Received: from SN6PR10MB3022.namprd10.prod.outlook.com ([fe80::8bb9:2bb7:3930:b5da]) by SN6PR10MB3022.namprd10.prod.outlook.com ([fe80::8bb9:2bb7:3930:b5da%7]) with mapi id 15.20.6363.022; Fri, 5 May 2023 17:43:48 +0000 From: "Liam R. Howlett" To: Andrew Morton Cc: maple-tree@lists.infradead.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, "Liam R. Howlett" , Peng Zhang Subject: [PATCH v2 03/36] maple_tree: Avoid unnecessary ascending Date: Fri, 5 May 2023 13:41:31 -0400 Message-Id: <20230505174204.2665599-4-Liam.Howlett@oracle.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230505174204.2665599-1-Liam.Howlett@oracle.com> References: <20230505174204.2665599-1-Liam.Howlett@oracle.com> X-ClientProxiedBy: YT3PR01CA0001.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:86::27) To SN6PR10MB3022.namprd10.prod.outlook.com (2603:10b6:805:d8::25) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN6PR10MB3022:EE_|BL3PR10MB6089:EE_ X-MS-Office365-Filtering-Correlation-Id: a48b9924-86f7-4e8b-26c1-08db4d9047ea X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: xXbA8+KnrhWjO4zLk0vKPMhy+/iB1irJbm8QVek94K897VdRD6BWLpB5GF4DN1w/TlwZCeqdlkTUUA2xp6UEKHfYkk5vpjkyrmI1Uz6INculkQyP8Fzcah0RUGWyI8j8U0iQztDRUtNGsbOXZI/shklkMhPp8wx4KILvSu+IoH1/nIz3N2enK9xGFLITSk7G5zecVaKLeJitiS8JDVGv71H2cqkFmmlxFvn45L7Mhu1ONtN+8ddZTDzwoU9aeu7LnGyxV6LtaG6AAZoLBitczYcN/8eTphUOAkakYOtOT280L4J+5ZPenmYJS16+3p9hIy2t1NyP7TXuHWJZCwWYT6qPfoLSp0rKjTGqf5P06+AoRXTBNefShiMFi3tMRrdJIfucF1M6UMvurTnVXN0mWbZUceXtBKi+IP2XEvoC8JgwuteSUvOMskeNNH4esgdLDYL5pGkoiCqDouYyko2RlovzTsgUL/Wtb6v0OJc2JFWXp5N4oIOpXXVWj9OilGw0O587Oro8rZKTUT0k/DLyxvIvDQ/7ChEnAlA5OBG3PEs7Xg7tPjwjKv4kYyHUNHCi X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SN6PR10MB3022.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(396003)(346002)(366004)(39860400002)(376002)(136003)(451199021)(66476007)(6916009)(4326008)(66946007)(66556008)(6666004)(478600001)(6486002)(316002)(54906003)(36756003)(86362001)(83380400001)(2616005)(6506007)(1076003)(26005)(6512007)(8936002)(5660300002)(8676002)(2906002)(41300700001)(186003)(38100700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 9NaWmodjH5uXy9D5DX3qYr7BKEOE48IHHEmnl2ME3U6gvXEcZFxjU2Ni1yTWLYD+iYfDn04v/ZlmjREJPrV/WNdUGjDdYjWru/3dR+kUjv1LHaWCfr0JQfqtap9r9cbbfEzg36sRgfZlyF2npXWajJYnYzC/H/EGxPYviavnPHDySXvkGzZN2xRHE7+erOoYlD9jEYxjjTKCGtGs1acsvbCEP0IZbbCbSRzjefuY04GlPbtcuUiyGVjnp4LWJBAWGRTLbhCJS/9yXoUISDPXvGQSyL9aBOIZjNe1hT06EHhhbu/RYLdwBLUUPmzELklLFsOZXqURjoHr6hZdfWxgz39AZ+oHASW76hNj+ou0PWfITJ/TI7Ris1b3qw2Cjl3Z/ON53QhLgGqWosloRKiSNsJUiDfRKZz5JhSIB9Do75PlOYIQa067ogMuGhEhBSRGPZZWLDMWE4WGOr03LcqySXwzsI0/8NV3JcaVvW9ZJpZgUHkBQPEoGrM7ZeSkDb5KnDbhvi+1H5GJNPikoxpunpIPaDfAnzDIH8UbU12qpNnGymQJwGxFlT2i6CX173drD0hiyvlyHdhCLelkmOaYH8RLRpa9obB4vQowClQa2QXOiGwhaUUiNf0DPZuzTHPz1Q2MLrcJyuuFmAbQr5zH7Z0MHEBlS+11WBtLnP5DPFdDlDxx9AxYRS2rjbtqqGKLHF4p+JIVd+HHKNtlWd2qbFv16oQ25PxSzNyyHHmIO/Cyk+hsB/Afeq9xrfT71VQszj0L8KydVGUQ5jFCKfB0wAPbJwNCzEjs3PxSm6OPV9BEpV4QEnl8XbLwYo76fCUSEFfXVr2jUSuynBfXgudWIM5aNk7VCYFHAnKq9EKdIFY/JxISfC3qPpBJMCrhO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RkUif3hc9wtVzG+LKd2TcZEm7rBpwvW0eXwVy/YcE82UKHr/OqApCR7Ulh+pmlJ3AS7vQiwkvpzw3qU++QDkh+4V6HNCwbui6u0MY5SpMPzxoVLCcmuGPb2KTuDhLl2+yR+j/yQqLpp7s9fvxpKLGdxzAk40mth1XqPWMU37zQ/giX3WGDCeeb5QaxTFSHVCCQPtS3AYctwdu/+rtqfWKFNrwL6PYw95MRV0p9hd1EpBbBpacMhsMjqK4t6IFhoT3Zua4Op/f1vzFB3SNCynO/m0HMNWJfwUeDc/FeEbk8MXUqSHT297piKs1XgFXGPUKucs29tjEjR3/w/pKtc4UA/0mQ/g7z8XXMJ1LI0XDMqNw1afDAlzRclL3gVtLKsrAhos/3Peuj9vbv64X/U3ovTSdIABvbrgwpy+mPPk2ykzP97qcyeo8QZMnGJZ8+UdXicY02TfsI6Aed7qXJdjys0BvwazusHzra4P6iGDrN5stHLxQSVZzwqfpdhnDvJB3CVH5ZEnyrkuT1sorA7i9CxxhNtrDzQrIayskX6vDeZ6qqnWYQaPMe8QFG0if4VpcZ3zndHhRbq3QxuxXYSYv1/mGZhoSZgwpFY2ZNtg9SpaBx7rm/sjXXlZihB8BelQeSwF/KLsDId7Nxrz/f8AYJwTURcG0fFtg8B8OblLX/yW X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: a48b9924-86f7-4e8b-26c1-08db4d9047ea X-MS-Exchange-CrossTenant-AuthSource: SN6PR10MB3022.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 May 2023 17:43:48.1355 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: ru2Q0H7+/poI4+jlfCi7XpFv1yVxGMoZPYz+J+dfAh57ubmjfZOuBsL1o36FQ6LRvGVZegJIakeMV3VTu563vQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL3PR10MB6089 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-05-05_24,2023-05-05_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 mlxscore=0 spamscore=0 mlxlogscore=999 phishscore=0 malwarescore=0 adultscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303200000 definitions=main-2305050146 X-Proofpoint-GUID: J0hXzc_hJzr1QCEJs9xYqcCFlyOvRn-j X-Proofpoint-ORIG-GUID: J0hXzc_hJzr1QCEJs9xYqcCFlyOvRn-j X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: The maple tree node limits are implied by the parent. When walking up the tree, the limit may not be known until a slot that does not have implied limits are encountered. However, if the node is the left-most or right-most node, the walking up to find that limit can be skipped. This commit also fixes the debug/testing code that was not setting the limit on walking down the tree as that optimization is not compatible with this change. Signed-off-by: Liam R. Howlett Reviewed-by: Peng Zhang --- lib/maple_tree.c | 11 ++++++++--- tools/testing/radix-tree/maple.c | 4 ++++ 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/lib/maple_tree.c b/lib/maple_tree.c index 555de3a8343e1..5b29d5a916f2c 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -1103,7 +1103,6 @@ static int mas_ascend(struct ma_state *mas) enum maple_type a_type; unsigned long min, max; unsigned long *pivots; - unsigned char offset; bool set_max = false, set_min = false; a_node = mas_mn(mas); @@ -1115,8 +1114,9 @@ static int mas_ascend(struct ma_state *mas) p_node = mte_parent(mas->node); if (unlikely(a_node == p_node)) return 1; + a_type = mas_parent_type(mas, mas->node); - offset = mte_parent_slot(mas->node); + mas->offset = mte_parent_slot(mas->node); a_enode = mt_mk_node(p_node, a_type); /* Check to make sure all parent information is still accurate */ @@ -1124,7 +1124,6 @@ static int mas_ascend(struct ma_state *mas) return 1; mas->node = a_enode; - mas->offset = offset; if (mte_is_root(a_enode)) { mas->max = ULONG_MAX; @@ -1132,6 +1131,12 @@ static int mas_ascend(struct ma_state *mas) return 0; } + if (!mas->min) + set_min = true; + + if (mas->max == ULONG_MAX) + set_max = true; + min = 0; max = ULONG_MAX; do { diff --git a/tools/testing/radix-tree/maple.c b/tools/testing/radix-tree/maple.c index 9286d3baa12d6..75df543e019c9 100644 --- a/tools/testing/radix-tree/maple.c +++ b/tools/testing/radix-tree/maple.c @@ -35259,6 +35259,7 @@ static void mas_dfs_preorder(struct ma_state *mas) struct maple_enode *prev; unsigned char end, slot = 0; + unsigned long *pivots; if (mas->node == MAS_START) { mas_start(mas); @@ -35291,6 +35292,9 @@ static void mas_dfs_preorder(struct ma_state *mas) mas_ascend(mas); goto walk_up; } + pivots = ma_pivots(mte_to_node(prev), mte_node_type(prev)); + mas->max = mas_safe_pivot(mas, pivots, slot, mte_node_type(prev)); + mas->min = mas_safe_min(mas, pivots, slot); return; done: From patchwork Fri May 5 17:41:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Liam R. Howlett" X-Patchwork-Id: 13232884 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7064EC77B7C for ; Fri, 5 May 2023 17:43:54 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D971B6B0078; Fri, 5 May 2023 13:43:53 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D46C16B007D; Fri, 5 May 2023 13:43:53 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BE8366B007E; Fri, 5 May 2023 13:43:53 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by kanga.kvack.org (Postfix) with ESMTP id 9DDFB6B0078 for ; Fri, 5 May 2023 13:43:53 -0400 (EDT) Received: from pps.filterd (m0333520.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 345HhQ8T031799; Fri, 5 May 2023 17:43:53 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=C3AbTxtdfyzVTdgMrkt+8cguGreW/PZzveEPUyUGMKU=; b=VgAceUbpPzWiCwtSQA3dl/l1YD0pUm2LJi/q6R/RFF7PCihmO6oShGHXCo88OW1TgR+5 iXdVVXh4vWFKP6JSn+81zPVx2Z2LbeO4651EfYoDEKtv1m+RTajr92ku7DxzAP/91Ipm 0JHbdMBRq05q2A97glE0AMfxWaW/OLUu2ZP9OIs7zebl4ZYGSMPATtJTMG20y01SjCkw euIwn1X+XJTxuSgnFNr/BjXDr2EIH/BW6OmC2uJ/M7zQFFmadt+xhx6paf7R9Ur2AFqq S4X/4qLsz5noXiKoHRqlwoCf3cc4oKg5yr4KbMkNBxLPfPvX3kKdB1SW4+SdD0bhMlKQ 5w== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3q8u9d5ndw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 05 May 2023 17:43:53 +0000 Received: from pps.filterd (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 345GSEvO009895; Fri, 5 May 2023 17:43:52 GMT Received: from nam12-dm6-obe.outbound.protection.outlook.com (mail-dm6nam12lp2168.outbound.protection.outlook.com [104.47.59.168]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3q8spanjph-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 05 May 2023 17:43:52 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VV/4EhrGzXjfqqrNNbj0jns/nfjKX4G7bigBJF2s5LQngCFC8WWRRZzuWvJgfRGxELoBQh2x8DSMB0k8fgs/iNh3Qgrj6e2Fdh9GgWMdZqWmx9FxH/TY9cnWOvPRaj/sOc+/g29HiYgQk823NksIXXSrp/no2ZSMcak6wuUCnBjfzmAJQjN/hGmtAS068UbW+lePv78rk28jd1onTWxbRYwEiOSc6mCvifVx/F2YQA21Js8XX5FKv16Hu067jSnVz8eiaaOi5LrZVz6uu3wyrmg2PM70Ey0wHbWtgq/VrRT9rYyUt2ij+tt8UcQ3rf6UFjm91TwCP9fMBKFwCSiJ5Q== 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=C3AbTxtdfyzVTdgMrkt+8cguGreW/PZzveEPUyUGMKU=; b=oFSbPscjy5atJTlSRu9ehuNMAYDTuqKQzKDP3iHfONYEsvTIcukcssQS840msI4fLkI3QHpIKbr6lWBS0q5rhyqxDzhneGNnChBoZAr7Qb9igziwnjbXhaQSjpJJZJb5WXJlhW82m+XHeDSDVxKLJKaL4Hkfc2vYGP9BeLXBlEW1yfYp8B9Dx+O7QSNPmx87+YvP1FEiJh+/z09sGYUJ0c0ug7Qai1h2vJfA5F6CecaVPQguJpWhGT9pm8ngG10ZITuJ4h+f3+lDgZ5aDv+zw9R44FmPo97CH4efZWrb42SMtXF/3ttPpDvv8uKBPqPL1papirtSvLHKRWK03xtPxA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=C3AbTxtdfyzVTdgMrkt+8cguGreW/PZzveEPUyUGMKU=; b=MSwXfXqXyCnq+GqarLVUUL64amtBj2QOtye0tDjlQ9mRl8Gd+NgqEG+BdFQRfoD2qcNw9klRFD/GoB74MH5N3flLBi75AlqEr1Z72cap//SwEslmujdWuFTB+lUM+ES6P2X/wmNCzEq9QspMzCZu8Wds0OeRlNKTNcziiE0x0L0= Received: from SN6PR10MB3022.namprd10.prod.outlook.com (2603:10b6:805:d8::25) by BL3PR10MB6089.namprd10.prod.outlook.com (2603:10b6:208:3b5::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6363.27; Fri, 5 May 2023 17:43:50 +0000 Received: from SN6PR10MB3022.namprd10.prod.outlook.com ([fe80::8bb9:2bb7:3930:b5da]) by SN6PR10MB3022.namprd10.prod.outlook.com ([fe80::8bb9:2bb7:3930:b5da%7]) with mapi id 15.20.6363.022; Fri, 5 May 2023 17:43:50 +0000 From: "Liam R. Howlett" To: Andrew Morton Cc: maple-tree@lists.infradead.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, "Liam R. Howlett" Subject: [PATCH v2 04/36] maple_tree: Clean up mas_dfs_postorder() Date: Fri, 5 May 2023 13:41:32 -0400 Message-Id: <20230505174204.2665599-5-Liam.Howlett@oracle.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230505174204.2665599-1-Liam.Howlett@oracle.com> References: <20230505174204.2665599-1-Liam.Howlett@oracle.com> X-ClientProxiedBy: YT4PR01CA0238.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:eb::28) To SN6PR10MB3022.namprd10.prod.outlook.com (2603:10b6:805:d8::25) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN6PR10MB3022:EE_|BL3PR10MB6089:EE_ X-MS-Office365-Filtering-Correlation-Id: 20c6f729-02e4-43bb-3a1e-08db4d904927 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: zdPoYwWgDJ6Uu/XBXX6eA5So8gQlCiCoH/7onaF3MqQ98cIulkfvXf4M+O6KBPQ2E0xSBEj94V8XqxhoBHObPqOJ8/8Re/AbCA78ooqVUN0tm0aZfJMXoFVhiyBurznf62o03lB9rqTHYKzpjNSbX9uuvkCNql4TWGK7Jz8XCfkLGvQCX12osxxTnLZ9/22TvtYWyrSLMVKh112CqV5Z8vMwP87TIkzQro/DY/xNNkqw3L6qoxDjJqXGP9PHPln1WkX5xBak1hnFnB0app6ZMYLt8b1V7quBM27WfvxIEoPZ8YKcv1TLDfyB7SaCI/yQIRkznJrFr/MjuWUWBnuyJvl3U6MhPWJ4SE1I7HUVdtl5lOsa2j3NrC8gAsMWTyXByAzUixdsRjXyZIYh2CCLK+NJbdcwnVfQdcjpJ1CEnd+cddvDvSFQMC3YZ7Y+aagHgdLmLUChASwLsTLaQPcF5sQlw0+2ur05xdRvt3BLftWQwVDOK2B/ckaiVwwhpoh3qG7puSApeF2B0mW7gMRWziJPU83lKt6ZUG75RNlysZmNct8sp/G/qZTYh/dGQdvV X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SN6PR10MB3022.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(396003)(346002)(366004)(39860400002)(376002)(136003)(451199021)(66476007)(6916009)(4326008)(66946007)(66556008)(6666004)(478600001)(6486002)(316002)(36756003)(86362001)(83380400001)(107886003)(2616005)(6506007)(1076003)(26005)(6512007)(8936002)(5660300002)(8676002)(2906002)(41300700001)(4744005)(186003)(38100700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: USJfvFzUb7nREQgORH1BSnYDPMo2Xc1RH8HEieK4BhMy0OkPiNtIpRT4mi4NFw3rqXPaIsl94uql3flwF5AE8gROZV96DIS/xklkeHKI0oSoTID2HzdoI4xTnQrqMwM/bS/lTiGWIkLsXo7kQDv+V5AwiXtIZlxYSlTm/KAfxfqRK+J1A4uLeMKOkVfHnNVFezeI0/mpOLn/X1s8XHlKo3xlekHycDPftVMiGjk/eovMb+ppj5AS7HXnzCMwmMiLdpkyb5kvEJOTuBvXKPaM2V7udwgac+TzI3GRNeIef5xwQzxRfXoQQ2ipNMgfCEBKhtI4QXpR8GPcONRnzoqfw6YKs6okDlDTLWbNZMOJbHOF93GtvJiC8CSq7Xzx8FUJg0vbqDQ34XRA3eueFmZL9z8GND1xS+bnvnm297Yd6L1WVQfDIOZWeLoyPy1qoK8fhFK3KcWtT160mQ+q+GLbWHMUIgI0Zm8nZ/5Cx4Y9sPcwk9uenVC+pLSI8tNVgWuWsykpTRRPKc3BlbnRKooIhmdnggizhtU23SkOnE9z4GDaFsvdEchhy6lduKLnTu+PN7d9PSyIv5BfNuPc9j6IViY34zoX/jhtmHl0kTCALkjIDjXn0FvExC766dYqiwi+P0sTpqJoMRNwKjmXq2DGr6wbuZ05qlR4OSjaKc/6nFckw5BqRt6na4QPu8VhZ7lk0yS7TZI5QGJieF1vClJSUKI2lp4o+/UW+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fnSfR9SyvNG9Zj2OoyuLWyIKBYEprYTUI3jb6vFPd4FqwmF+JkYsLn4qMMf6L18ZIgcXSfTp5KP2DGInvF0qAbVVI9LHs4wAzorM/QApuRSsuyMSBLB7LA8tQDSmyjzx8JHWbVaPAFsGe2glygCcGEFbsLQI8PYJTUHILkd0PPkZmrwqRasVeDKl+wMHGVobB96vKZVFWLODrMifYqz2a0BZ7UZpVSebGvgNgnangG4bbnZUJlIEfFk+PQb5xS5E+9HUeIWCdrDgMZBgiarPqvJP/MRgq9zP8SM7qrUX5D2bz5RTdDIFstdTtw1oVISLXsEGhpjcvrnJl/qw2gJhsbpi5/yWMtoVS596CVJtNBilmfwZ2VWch00xdKIttSXUBBxo/KLKSEW4+BfAvC5sRR7RC4q/XkIAxU2r91xBtKQwguXm6MyNTXdviEnSHkvLbDYg8JT/X4EmNMOaGTOCYzXlgvmzWxX6rYGZYyTRIlyr1U7+Aofr4hioaEvex7qlPq8z15LwtEcfhbIZlaKWPEGlx9Y0qM4tWv/rqC/uF8JQvy0y7UmXkMuUnsBcSHuyuO0Y6hZHHHbgFBQGcQprpCVSin22+sxFsy+4k1jyJyJKy0ce2rzE6TdpIG5mnAjhaMpopW6kMmmAEneon0ia8OzK/14Vt5ntPY3piF1k1e35S4U4MuKhV6oicCx9bXPZ1aR7YA+w7THE222IRTYOuCeMhgX1H8yxOgUmkxBgI9HtQhpqNs02vYxU26v1yGpKvcgVmrlwR+kZqgrmZCdTWv4ZrA== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 20c6f729-02e4-43bb-3a1e-08db4d904927 X-MS-Exchange-CrossTenant-AuthSource: SN6PR10MB3022.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 May 2023 17:43:50.2238 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: MdkU2h/xI/jTFSAGZNIUB2kyZ1r2VXmK4bBAYKQ1XmQ4Nofak5xRuMhPFMYFOfQ6kYwmAgEoAkmaJTE4UkwaGQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL3PR10MB6089 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-05-05_24,2023-05-05_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 phishscore=0 spamscore=0 mlxlogscore=999 bulkscore=0 suspectscore=0 mlxscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303200000 definitions=main-2305050146 X-Proofpoint-GUID: bF4WDtPkzC7WAPmPJpFsTkkv4v7qEKS5 X-Proofpoint-ORIG-GUID: bF4WDtPkzC7WAPmPJpFsTkkv4v7qEKS5 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Convert loop type to ensure all variables are set to make the compiler happy, and use the mas_is_none() function instead of explicitly checking the node in the maple state. Signed-off-by: Liam R. Howlett --- lib/maple_tree.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/lib/maple_tree.c b/lib/maple_tree.c index 5b29d5a916f2c..1e7e7249a0cf2 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -6739,15 +6739,12 @@ static void mas_dfs_postorder(struct ma_state *mas, unsigned long max) mas->node = mn; mas_ascend(mas); - while (mas->node != MAS_NONE) { + do { p = mas->node; p_min = mas->min; p_max = mas->max; mas_prev_node(mas, 0); - } - - if (p == MAS_NONE) - return; + } while (!mas_is_none(mas)); mas->node = p; mas->max = p_max; From patchwork Fri May 5 17:41:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Liam R. Howlett" X-Patchwork-Id: 13232885 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3C140C77B7F for ; Fri, 5 May 2023 17:43:57 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id BEA666B007D; Fri, 5 May 2023 13:43:56 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B99FB6B007E; Fri, 5 May 2023 13:43:56 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9EC706B0080; Fri, 5 May 2023 13:43:56 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by kanga.kvack.org (Postfix) with ESMTP id 7E2FD6B007D for ; Fri, 5 May 2023 13:43:56 -0400 (EDT) Received: from pps.filterd (m0246630.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 345HhJ2A014769; Fri, 5 May 2023 17:43:56 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=x1F35Nl/y1jdMAp6sXSkI9LKCTzgTwzSHQmh+g/8a1k=; b=cQFb0KfSxygxC+DaZ04C9ZAfd7TaOnyTEivoUa/hyyJTuJiRg679HczQ3d009Yr0KvPn xazBh4o4L8yELnL7y2Y6GaT7iyn+TDNU/Z7NP0aUnAuxWmWVEIiuRoN5rhHGVpguaVzl 6fy7kdw/ODDD0xKsPpbrdCfncPL+8xmBl7I4vNYw2lZllumcq27LEHvrkNMTy3GHMC1q tCN2LQIdqEQRjHdYPiQWH3y5xpLpsxm7Mj//nJQighD1tYhPm3TFzf06lKkbBLhh9hQJ VtQmpQUt3h8n9k+ygaCAy21YT5KS+bqj4CVeQZbhy/g0/x6HIJYbr5GkoOtVU8Ej5lTz Fw== Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3q8sneddxx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 05 May 2023 17:43:55 +0000 Received: from pps.filterd (phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 345HUmNx024917; Fri, 5 May 2023 17:43:55 GMT Received: from nam12-dm6-obe.outbound.protection.outlook.com (mail-dm6nam12lp2171.outbound.protection.outlook.com [104.47.59.171]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3q8spachws-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 05 May 2023 17:43:54 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MFubAfT2/OrCTX6BP81JdCqcFzpcBOU2lhsRxqZC0lGs8MtnGa2OAX1rNDtT3QzKmL3x2NlQxWEoEyx0miF1Qd73sgeskVihinJq7wJDUo1YxrjzB5m15xUKk7Id9FIOHGidGj+bmFFXY3R9Z5giuArz7Tm5UWYzo4qQ6SWsRb4aRLzwykpIS2bKT7Ir4qm5+0I8Q7f9H+kHm9mZgQKFMndAgOYw0YWBuU8uENdyWzp8xIexEhCw0E4ZrXiNbmsR+yJf6FSlVPL0WCQnD/HOzZwyE//IYF+7OaxwQepIBYq7q3igYixji3XCRI8lnQsjAR1qQM8oIUgpUYS0LYW3SA== 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=x1F35Nl/y1jdMAp6sXSkI9LKCTzgTwzSHQmh+g/8a1k=; b=O4jryDruqPUBw5rwzh2wWM1Gm8L2NENuNy6MwMUxyaMO7VsJficPSRK/1z8aswdR36pcJM285cbQLIUD6mqM44IdDevhOAzB9rS5eG3P5/2fzrZlrvEf/f0+i2TNS5QbKCrwVv+XqPax2hiEQrgF0Pu9QhJ1fyxZ7Ak/0ViSV2X7r/bFWH46wCRbh95AjjhK68shzjJW+5HZlk4Urq9uxCToIOe3lJIdruspoGWxJvLzcmOQ3rLRkAGK77V6yFym8n1JjE6XIUHtMMaNBWqMkFzY3S4Kpe9fYFCnnfcxNxmyoqgeMgh1jgA0WThFei0cowHKvHWWIyMFaioWvXKkJw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=x1F35Nl/y1jdMAp6sXSkI9LKCTzgTwzSHQmh+g/8a1k=; b=IOaIVDnzGTs2VjbxQEwlGjDmj6G3mVjl8YwhmzhDF9TCy2QFaTdlBqObQB/cO/mWR6Z8vqqYSfo7IDAcwPwM0JtdkwS8iUViA9BjT/Dnfo7blQIjv+ImyJgst4vANTkGw1XV/4XjUlWKNPOaw1mTzgi0qRWCU7t/KeAJxzxg5EM= Received: from SN6PR10MB3022.namprd10.prod.outlook.com (2603:10b6:805:d8::25) by BL3PR10MB6089.namprd10.prod.outlook.com (2603:10b6:208:3b5::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6363.27; Fri, 5 May 2023 17:43:52 +0000 Received: from SN6PR10MB3022.namprd10.prod.outlook.com ([fe80::8bb9:2bb7:3930:b5da]) by SN6PR10MB3022.namprd10.prod.outlook.com ([fe80::8bb9:2bb7:3930:b5da%7]) with mapi id 15.20.6363.022; Fri, 5 May 2023 17:43:52 +0000 From: "Liam R. Howlett" To: Andrew Morton Cc: maple-tree@lists.infradead.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, "Liam R. Howlett" , "Liam R . Howlett" Subject: [PATCH v2 05/36] maple_tree: Add format option to mt_dump() Date: Fri, 5 May 2023 13:41:33 -0400 Message-Id: <20230505174204.2665599-6-Liam.Howlett@oracle.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230505174204.2665599-1-Liam.Howlett@oracle.com> References: <20230505174204.2665599-1-Liam.Howlett@oracle.com> X-ClientProxiedBy: YT4PR01CA0239.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:eb::27) To SN6PR10MB3022.namprd10.prod.outlook.com (2603:10b6:805:d8::25) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN6PR10MB3022:EE_|BL3PR10MB6089:EE_ X-MS-Office365-Filtering-Correlation-Id: 4befc877-8761-4ee2-e93f-08db4d904a80 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 2q5e+IpiD0vwOkZnrYwLd6nfKs1HLFp05wW/qQn8lg+0+BV1du2Fmkpruq19BvWaxF0i0Xc2njwEQatNJYxgU2k9PXvYiCbNBxVzyK7KjjcaNlk7tvArF2EjVoYHGiumAdGIwq8L5SnX5mrJREenOH0+8i1fcvbx3LI/m01CkjztMz8Ebh//WNZkkDkodC6j/V+dhiPZwjBVxUszeqb3Q/3qNDVUVGdxKylnEzfZxO1ae3VimpMpv/CogbsTHHZf+nEPrpbM3an4pxk4vG5IkLfRjgS+h2Tlb10MBG0SDrUInAlZyBO4osDJ0WQyGBHvolQFxqjKP92xbMWAZaJoYduRt3j/P4zdXgJLCPBz98ULfXNAc7m+szp9dEdV5SsOB2jvdqVrk+5gPDw0YVEs/CbM8pYUU332YHZZb6uaCD6O+cel/rdGA2dBJKWWtLymC1WSBF+Woe/VI1b7I2eQnCGtmx1EgW7qsGgUaoIrGe4s8aAIxP7WJqodpj/eB2xaEM//4Ww78ekMMIDIcxXm5V6TrgCTENFsA8c55GAf4rqE8NLhprMOaBHoZ0ryF3VB X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SN6PR10MB3022.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(396003)(346002)(366004)(39860400002)(376002)(136003)(451199021)(66476007)(6916009)(4326008)(66946007)(66556008)(6666004)(478600001)(6486002)(316002)(54906003)(36756003)(86362001)(83380400001)(107886003)(2616005)(6506007)(1076003)(26005)(6512007)(8936002)(5660300002)(8676002)(2906002)(41300700001)(30864003)(186003)(38100700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: sAL3cuFEGFeUC4MG0VzFz2avl52VLB6KyhfZ8q1h29DWIEsyVf8QdZq9+TF6QCt6cMBaSDDQuh7KzXYvbLdkM+G1iWC2oIWZF/+A6aKe1Pvq8WMEg11D6/OpOv4H7MGQfRlsioInpcfALTIto4F7dBhN9V6bSMbMeUPIr7pFc6RTYa3TB/kxrvqlzhjTan/vpu/CvGfAgL2obGbYB35w8wbP+l5gnXTuXXojLSS4RKSP8FPoUQL7pvfAsagfU8tz5iynwnkjmN9jSidDfHRqLbyyOkDqSf2Mz++6TfpX+8xfeDQ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Du/v0OlDIzk3Jy+PjYJ+h3rxWPfwk4ghNX/LumBaeUvg1D7pRGL0TH1E2E8tBDBs4PeG2ci4QXL/esfVudDeM9XX2KvvI1guhkaO4rN/CpVPRQ8Y4JASQrecDnrZdOzydiaRsnZbgv4iOhGQ== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4befc877-8761-4ee2-e93f-08db4d904a80 X-MS-Exchange-CrossTenant-AuthSource: SN6PR10MB3022.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 May 2023 17:43:52.5615 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: m/4GxqRXCvlwcJHQKAut12ICDmSPvFH2ozshtgeKoKwvC4yIrKfsJOq7jy7tiA0a9NEYkEHKjJg7uiaYpuEx7w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL3PR10MB6089 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-05-05_24,2023-05-05_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 mlxlogscore=999 spamscore=0 phishscore=0 adultscore=0 mlxscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303200000 definitions=main-2305050146 X-Proofpoint-GUID: fCMBOxz_OERR5Ea3L8s58j90Znkkg6ET X-Proofpoint-ORIG-GUID: fCMBOxz_OERR5Ea3L8s58j90Znkkg6ET X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: From: "Liam R. Howlett" Allow different formatting strings to be used when dumping the tree. Currently supports hex and decimal. Signed-off-by: Liam R. Howlett --- include/linux/maple_tree.h | 9 +++- lib/maple_tree.c | 87 +++++++++++++++++++++----------- lib/test_maple_tree.c | 10 ++-- mm/internal.h | 4 +- mm/mmap.c | 8 +-- tools/testing/radix-tree/maple.c | 12 ++--- 6 files changed, 82 insertions(+), 48 deletions(-) diff --git a/include/linux/maple_tree.h b/include/linux/maple_tree.h index 1fadb5f5978b6..140fb271be4a4 100644 --- a/include/linux/maple_tree.h +++ b/include/linux/maple_tree.h @@ -670,10 +670,15 @@ void *mt_next(struct maple_tree *mt, unsigned long index, unsigned long max); #ifdef CONFIG_DEBUG_MAPLE_TREE +enum mt_dump_format { + mt_dump_dec, + mt_dump_hex, +}; + extern atomic_t maple_tree_tests_run; extern atomic_t maple_tree_tests_passed; -void mt_dump(const struct maple_tree *mt); +void mt_dump(const struct maple_tree *mt, enum mt_dump_format format); void mt_validate(struct maple_tree *mt); void mt_cache_shrink(void); #define MT_BUG_ON(__tree, __x) do { \ @@ -681,7 +686,7 @@ void mt_cache_shrink(void); if (__x) { \ pr_info("BUG at %s:%d (%u)\n", \ __func__, __LINE__, __x); \ - mt_dump(__tree); \ + mt_dump(__tree, mt_dump_hex); \ pr_info("Pass: %u Run:%u\n", \ atomic_read(&maple_tree_tests_passed), \ atomic_read(&maple_tree_tests_run)); \ diff --git a/lib/maple_tree.c b/lib/maple_tree.c index 1e7e7249a0cf2..084868865849c 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -5699,7 +5699,7 @@ void *mas_store(struct ma_state *mas, void *entry) trace_ma_write(__func__, mas, 0, entry); #ifdef CONFIG_DEBUG_MAPLE_TREE if (mas->index > mas->last) - pr_err("Error %lu > %lu %p\n", mas->index, mas->last, entry); + pr_err("Error %lX > %lX %p\n", mas->index, mas->last, entry); MT_BUG_ON(mas->tree, mas->index > mas->last); if (mas->index > mas->last) { mas_set_err(mas, -EINVAL); @@ -6753,22 +6753,33 @@ static void mas_dfs_postorder(struct ma_state *mas, unsigned long max) /* Tree validations */ static void mt_dump_node(const struct maple_tree *mt, void *entry, - unsigned long min, unsigned long max, unsigned int depth); + unsigned long min, unsigned long max, unsigned int depth, + enum mt_dump_format format); static void mt_dump_range(unsigned long min, unsigned long max, - unsigned int depth) + unsigned int depth, enum mt_dump_format format) { static const char spaces[] = " "; - if (min == max) - pr_info("%.*s%lu: ", depth * 2, spaces, min); - else - pr_info("%.*s%lu-%lu: ", depth * 2, spaces, min, max); + switch(format) { + case mt_dump_hex: + if (min == max) + pr_info("%.*s%lx: ", depth * 2, spaces, min); + else + pr_info("%.*s%lx-%lx: ", depth * 2, spaces, min, max); + break; + default: + case mt_dump_dec: + if (min == max) + pr_info("%.*s%lu: ", depth * 2, spaces, min); + else + pr_info("%.*s%lu-%lu: ", depth * 2, spaces, min, max); + } } static void mt_dump_entry(void *entry, unsigned long min, unsigned long max, - unsigned int depth) + unsigned int depth, enum mt_dump_format format) { - mt_dump_range(min, max, depth); + mt_dump_range(min, max, depth, format); if (xa_is_value(entry)) pr_cont("value %ld (0x%lx) [%p]\n", xa_to_value(entry), @@ -6782,7 +6793,8 @@ static void mt_dump_entry(void *entry, unsigned long min, unsigned long max, } static void mt_dump_range64(const struct maple_tree *mt, void *entry, - unsigned long min, unsigned long max, unsigned int depth) + unsigned long min, unsigned long max, unsigned int depth, + enum mt_dump_format format) { struct maple_range_64 *node = &mte_to_node(entry)->mr64; bool leaf = mte_is_leaf(entry); @@ -6790,8 +6802,16 @@ static void mt_dump_range64(const struct maple_tree *mt, void *entry, int i; pr_cont(" contents: "); - for (i = 0; i < MAPLE_RANGE64_SLOTS - 1; i++) - pr_cont("%p %lu ", node->slot[i], node->pivot[i]); + for (i = 0; i < MAPLE_RANGE64_SLOTS - 1; i++) { + switch(format) { + case mt_dump_hex: + pr_cont("%p %lX ", node->slot[i], node->pivot[i]); + break; + default: + case mt_dump_dec: + pr_cont("%p %lu ", node->slot[i], node->pivot[i]); + } + } pr_cont("%p\n", node->slot[i]); for (i = 0; i < MAPLE_RANGE64_SLOTS; i++) { unsigned long last = max; @@ -6804,24 +6824,32 @@ static void mt_dump_range64(const struct maple_tree *mt, void *entry, break; if (leaf) mt_dump_entry(mt_slot(mt, node->slot, i), - first, last, depth + 1); + first, last, depth + 1, format); else if (node->slot[i]) mt_dump_node(mt, mt_slot(mt, node->slot, i), - first, last, depth + 1); + first, last, depth + 1, format); if (last == max) break; if (last > max) { - pr_err("node %p last (%lu) > max (%lu) at pivot %d!\n", + switch(format) { + case mt_dump_hex: + pr_err("node %p last (%lx) > max (%lx) at pivot %d!\n", node, last, max, i); - break; + break; + default: + case mt_dump_dec: + pr_err("node %p last (%lu) > max (%lu) at pivot %d!\n", + node, last, max, i); + } } first = last + 1; } } static void mt_dump_arange64(const struct maple_tree *mt, void *entry, - unsigned long min, unsigned long max, unsigned int depth) + unsigned long min, unsigned long max, unsigned int depth, + enum mt_dump_format format) { struct maple_arange_64 *node = &mte_to_node(entry)->ma64; bool leaf = mte_is_leaf(entry); @@ -6846,10 +6874,10 @@ static void mt_dump_arange64(const struct maple_tree *mt, void *entry, break; if (leaf) mt_dump_entry(mt_slot(mt, node->slot, i), - first, last, depth + 1); + first, last, depth + 1, format); else if (node->slot[i]) mt_dump_node(mt, mt_slot(mt, node->slot, i), - first, last, depth + 1); + first, last, depth + 1, format); if (last == max) break; @@ -6863,13 +6891,14 @@ static void mt_dump_arange64(const struct maple_tree *mt, void *entry, } static void mt_dump_node(const struct maple_tree *mt, void *entry, - unsigned long min, unsigned long max, unsigned int depth) + unsigned long min, unsigned long max, unsigned int depth, + enum mt_dump_format format) { struct maple_node *node = mte_to_node(entry); unsigned int type = mte_node_type(entry); unsigned int i; - mt_dump_range(min, max, depth); + mt_dump_range(min, max, depth, format); pr_cont("node %p depth %d type %d parent %p", node, depth, type, node ? node->parent : NULL); @@ -6880,15 +6909,15 @@ static void mt_dump_node(const struct maple_tree *mt, void *entry, if (min + i > max) pr_cont("OUT OF RANGE: "); mt_dump_entry(mt_slot(mt, node->slot, i), - min + i, min + i, depth); + min + i, min + i, depth, format); } break; case maple_leaf_64: case maple_range_64: - mt_dump_range64(mt, entry, min, max, depth); + mt_dump_range64(mt, entry, min, max, depth, format); break; case maple_arange_64: - mt_dump_arange64(mt, entry, min, max, depth); + mt_dump_arange64(mt, entry, min, max, depth, format); break; default: @@ -6896,16 +6925,16 @@ static void mt_dump_node(const struct maple_tree *mt, void *entry, } } -void mt_dump(const struct maple_tree *mt) +void mt_dump(const struct maple_tree *mt, enum mt_dump_format format) { void *entry = rcu_dereference_check(mt->ma_root, mt_locked(mt)); pr_info("maple_tree(%p) flags %X, height %u root %p\n", mt, mt->ma_flags, mt_height(mt), entry); if (!xa_is_node(entry)) - mt_dump_entry(entry, 0, 0, 0); + mt_dump_entry(entry, 0, 0, 0, format); else if (entry) - mt_dump_node(mt, entry, 0, mt_node_max(entry), 0); + mt_dump_node(mt, entry, 0, mt_node_max(entry), 0, format); } EXPORT_SYMBOL_GPL(mt_dump); @@ -6958,7 +6987,7 @@ static void mas_validate_gaps(struct ma_state *mas) mas_mn(mas), i, mas_get_slot(mas, i), gap, p_end, p_start); - mt_dump(mas->tree); + mt_dump(mas->tree, mt_dump_hex); MT_BUG_ON(mas->tree, gap != p_end - p_start + 1); @@ -6991,7 +7020,7 @@ static void mas_validate_gaps(struct ma_state *mas) MT_BUG_ON(mas->tree, max_gap > mas->max); if (ma_gaps(p_mn, mas_parent_type(mas, mte))[p_slot] != max_gap) { pr_err("gap %p[%u] != %lu\n", p_mn, p_slot, max_gap); - mt_dump(mas->tree); + mt_dump(mas->tree, mt_dump_hex); } MT_BUG_ON(mas->tree, diff --git a/lib/test_maple_tree.c b/lib/test_maple_tree.c index f1db333270e9f..d6929270dd36a 100644 --- a/lib/test_maple_tree.c +++ b/lib/test_maple_tree.c @@ -219,7 +219,7 @@ static noinline void check_rev_seq(struct maple_tree *mt, unsigned long max, #ifndef __KERNEL__ if (verbose) { rcu_barrier(); - mt_dump(mt); + mt_dump(mt, mt_dump_dec); pr_info(" %s test of 0-%lu %luK in %d active (%d total)\n", __func__, max, mt_get_alloc_size()/1024, mt_nr_allocated(), mt_nr_tallocated()); @@ -248,7 +248,7 @@ static noinline void check_seq(struct maple_tree *mt, unsigned long max, #ifndef __KERNEL__ if (verbose) { rcu_barrier(); - mt_dump(mt); + mt_dump(mt, mt_dump_dec); pr_info(" seq test of 0-%lu %luK in %d active (%d total)\n", max, mt_get_alloc_size()/1024, mt_nr_allocated(), mt_nr_tallocated()); @@ -893,7 +893,7 @@ static noinline void check_alloc_range(struct maple_tree *mt) #if DEBUG_ALLOC_RANGE pr_debug("\tInsert %lu-%lu\n", range[i] >> 12, (range[i + 1] >> 12) - 1); - mt_dump(mt); + mt_dump(mt, mt_dump_hex); #endif check_insert_range(mt, range[i] >> 12, (range[i + 1] >> 12) - 1, xa_mk_value(range[i] >> 12), 0); @@ -934,7 +934,7 @@ static noinline void check_alloc_range(struct maple_tree *mt) xa_mk_value(req_range[i] >> 12)); /* pointer */ mt_validate(mt); #if DEBUG_ALLOC_RANGE - mt_dump(mt); + mt_dump(mt, mt_dump_hex); #endif } @@ -1572,7 +1572,7 @@ static noinline void check_node_overwrite(struct maple_tree *mt) mtree_test_store_range(mt, i*100, i*100 + 50, xa_mk_value(i*100)); mtree_test_store_range(mt, 319951, 367950, NULL); - /*mt_dump(mt); */ + /*mt_dump(mt, mt_dump_dec); */ mt_validate(mt); } diff --git a/mm/internal.h b/mm/internal.h index 68410c6d97aca..4c195920f5656 100644 --- a/mm/internal.h +++ b/mm/internal.h @@ -1051,13 +1051,13 @@ static inline void vma_iter_store(struct vma_iterator *vmi, printk("%lu > %lu\n", vmi->mas.index, vma->vm_start); printk("store of vma %lu-%lu", vma->vm_start, vma->vm_end); printk("into slot %lu-%lu", vmi->mas.index, vmi->mas.last); - mt_dump(vmi->mas.tree); + mt_dump(vmi->mas.tree, mt_dump_hex); } if (WARN_ON(vmi->mas.node != MAS_START && vmi->mas.last < vma->vm_start)) { printk("%lu < %lu\n", vmi->mas.last, vma->vm_start); printk("store of vma %lu-%lu", vma->vm_start, vma->vm_end); printk("into slot %lu-%lu", vmi->mas.index, vmi->mas.last); - mt_dump(vmi->mas.tree); + mt_dump(vmi->mas.tree, mt_dump_hex); } #endif diff --git a/mm/mmap.c b/mm/mmap.c index e96f96c69c342..76eaf12f13903 100644 --- a/mm/mmap.c +++ b/mm/mmap.c @@ -301,7 +301,7 @@ SYSCALL_DEFINE1(brk, unsigned long, brk) #if defined(CONFIG_DEBUG_VM_MAPLE_TREE) extern void mt_validate(struct maple_tree *mt); -extern void mt_dump(const struct maple_tree *mt); +extern void mt_dump(const struct maple_tree *mt, enum mt_dump_format fmt); /* Validate the maple tree */ static void validate_mm_mt(struct mm_struct *mm) @@ -323,18 +323,18 @@ static void validate_mm_mt(struct mm_struct *mm) pr_emerg("mt vma: %p %lu - %lu\n", vma_mt, vma_mt->vm_start, vma_mt->vm_end); - mt_dump(mas.tree); + mt_dump(mas.tree, mt_dump_hex); if (vma_mt->vm_end != mas.last + 1) { pr_err("vma: %p vma_mt %lu-%lu\tmt %lu-%lu\n", mm, vma_mt->vm_start, vma_mt->vm_end, mas.index, mas.last); - mt_dump(mas.tree); + mt_dump(mas.tree, mt_dump_hex); } VM_BUG_ON_MM(vma_mt->vm_end != mas.last + 1, mm); if (vma_mt->vm_start != mas.index) { pr_err("vma: %p vma_mt %p %lu - %lu doesn't match\n", mm, vma_mt, vma_mt->vm_start, vma_mt->vm_end); - mt_dump(mas.tree); + mt_dump(mas.tree, mt_dump_hex); } VM_BUG_ON_MM(vma_mt->vm_start != mas.index, mm); } diff --git a/tools/testing/radix-tree/maple.c b/tools/testing/radix-tree/maple.c index 75df543e019c9..ebcb3faf85ea9 100644 --- a/tools/testing/radix-tree/maple.c +++ b/tools/testing/radix-tree/maple.c @@ -1054,7 +1054,7 @@ static noinline void check_erase2_testset(struct maple_tree *mt, if (entry_count) MT_BUG_ON(mt, !mt_height(mt)); #if check_erase2_debug > 1 - mt_dump(mt); + mt_dump(mt, mt_dump_hex); #endif #if check_erase2_debug pr_err("Done\n"); @@ -1085,7 +1085,7 @@ static noinline void check_erase2_testset(struct maple_tree *mt, mas_for_each(&mas, foo, ULONG_MAX) { if (xa_is_zero(foo)) { if (addr == mas.index) { - mt_dump(mas.tree); + mt_dump(mas.tree, mt_dump_hex); pr_err("retry failed %lu - %lu\n", mas.index, mas.last); MT_BUG_ON(mt, 1); @@ -34513,7 +34513,7 @@ static void *rcu_reader_rev(void *ptr) if (mas.index != r_start) { alt = xa_mk_value(index + i * 2 + 1 + RCU_RANGE_COUNT); - mt_dump(test->mt); + mt_dump(test->mt, mt_dump_dec); printk("Error: %lu-%lu %p != %lu-%lu %p %p line %d i %d\n", mas.index, mas.last, entry, r_start, r_end, expected, alt, @@ -35784,10 +35784,10 @@ void farmer_tests(void) struct maple_node *node; DEFINE_MTREE(tree); - mt_dump(&tree); + mt_dump(&tree, mt_dump_dec); tree.ma_root = xa_mk_value(0); - mt_dump(&tree); + mt_dump(&tree, mt_dump_dec); node = mt_alloc_one(GFP_KERNEL); node->parent = (void *)((unsigned long)(&tree) | 1); @@ -35797,7 +35797,7 @@ void farmer_tests(void) node->mr64.pivot[1] = 1; node->mr64.pivot[2] = 0; tree.ma_root = mt_mk_node(node, maple_leaf_64); - mt_dump(&tree); + mt_dump(&tree, mt_dump_dec); node->parent = ma_parent_ptr(node); ma_free_rcu(node); From patchwork Fri May 5 17:41:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Liam R. Howlett" X-Patchwork-Id: 13232886 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 080F8C7EE24 for ; Fri, 5 May 2023 17:44:00 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 92A816B007E; Fri, 5 May 2023 13:43:59 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 8DA766B0080; Fri, 5 May 2023 13:43:59 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 72C2E6B0081; Fri, 5 May 2023 13:43:59 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by kanga.kvack.org (Postfix) with ESMTP id 3D2806B007E for ; Fri, 5 May 2023 13:43:59 -0400 (EDT) Received: from pps.filterd (m0246617.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 345HhDHg020188; Fri, 5 May 2023 17:43:58 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=Bn7CJVTTzCGJHfmLE/+2NIyJatFk0uV6AOMMUMy4o98=; b=eCLtTp28q5kfhjOyhJ9SQ0tElaDRPrLBIn3+yYuog5+ZtskK5jNa97bQNsx8kGfT8BL9 eNbrQWJ7TSzad0Q5g056wug7uQbpvX5fhm1j8zGi3KrEpsm/PRJQqO3pMTOtCQNdL1Qm ZuVyHUnBjHIK0+rW1IW6FHKlX9s6H/LtSJRzEataG6PLDLdTKE6QDgQ6fKPZnWHbxLLv 5iusK3Rr8iaakdW4EmBEwpIDMaxdhCn2gqxFwxeuS/k9IKq7BHH625gxB2g4RI9e6dVa hpGDKMcpzyeHH7IaU6RrEkKjKoKhTxI6YpK7QCdie6XpCYql6qZcfFsX+e5j6BzbFnjk cw== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3q8usv5crr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 05 May 2023 17:43:58 +0000 Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 345H4Dir026812; Fri, 5 May 2023 17:43:57 GMT Received: from nam12-dm6-obe.outbound.protection.outlook.com (mail-dm6nam12lp2174.outbound.protection.outlook.com [104.47.59.174]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3q8spgeyfv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 05 May 2023 17:43:56 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=m1P2+r8PoJDMxG5xx4KTTLPMIhsXu9I5HK3VOUdvOBLAQHz2YBZXaOqzjFGt7A78BZPk2tKDlGBCphGqPEhal9B5bM+JOb74OR6+IzsTXYQ6Xv8Gfdsv4DZeBBlSgZSgRDdqrTTa/eZU9o8kUQASg0JHm5bj74MHiIlwG3djh1+xrilPfafVWP1kuHGJhkyD0KYtMv/9vL4QHZQBm1UBoGRZWVZpkBmOZmnYT0Ei9YwzAIuPG1j3Tsc6ySBItUVEOKtMpi6UYAlc2xQpraip0h9+yR9/LOayqP/rDWMV3XQENadFT2XgmTFGTC6p0yh2u7W2oybaxC7vjfi0fsLjjw== 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=Bn7CJVTTzCGJHfmLE/+2NIyJatFk0uV6AOMMUMy4o98=; b=Kn3CkRqcOVQA4wGCBuKNnM3yt+VZ9s43Wi9BT1Dd4VY9O8NeUPog1h3FGNjdoEjMzcKRGjKNMztEwMOxXgQa5Qb5DQvA+MJuZ8Kji27si6U0rj0ty6kn30T1/v2aJwe8nI3+9dbj7vBGVXbiv6o6vcN71otwRXK3TwP8SO+9AMfb/frvmohjAIoawEc9GM/smkFaXcO3xtG6OgKxMyd1IwMw643s7WN40C2F2FYub4Oh7jBcGq6vB06d5R/y+KwAilZlv8pm8q2K/mE629s8ZMxm4uX05dZoDP3Dx7D/t2g7NmBhQap4iVMYW+/pxZtak2KymjCYVm4or7fM7phAIA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Bn7CJVTTzCGJHfmLE/+2NIyJatFk0uV6AOMMUMy4o98=; b=UezRQApuE/oGokPTBepJCJtEnMkfJpTkupfxXt8f355M6AQfLNm33z4o10rifaL4I8TS7K9radzXyklEMd0jtgWROvR9OiukW93po0FNym4puqJf0q27rq+iycKNcCsGart2XDgmvzMqPQfjyN4RlDcoAM306RYJ5ZSz6hl+doA= Received: from SN6PR10MB3022.namprd10.prod.outlook.com (2603:10b6:805:d8::25) by BL3PR10MB6089.namprd10.prod.outlook.com (2603:10b6:208:3b5::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6363.27; Fri, 5 May 2023 17:43:54 +0000 Received: from SN6PR10MB3022.namprd10.prod.outlook.com ([fe80::8bb9:2bb7:3930:b5da]) by SN6PR10MB3022.namprd10.prod.outlook.com ([fe80::8bb9:2bb7:3930:b5da%7]) with mapi id 15.20.6363.022; Fri, 5 May 2023 17:43:54 +0000 From: "Liam R. Howlett" To: Andrew Morton Cc: maple-tree@lists.infradead.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, "Liam R. Howlett" Subject: [PATCH v2 06/36] maple_tree: Add debug BUG_ON and WARN_ON variants Date: Fri, 5 May 2023 13:41:34 -0400 Message-Id: <20230505174204.2665599-7-Liam.Howlett@oracle.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230505174204.2665599-1-Liam.Howlett@oracle.com> References: <20230505174204.2665599-1-Liam.Howlett@oracle.com> X-ClientProxiedBy: YT4P288CA0016.CANP288.PROD.OUTLOOK.COM (2603:10b6:b01:d4::29) To SN6PR10MB3022.namprd10.prod.outlook.com (2603:10b6:805:d8::25) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN6PR10MB3022:EE_|BL3PR10MB6089:EE_ X-MS-Office365-Filtering-Correlation-Id: 9d4bd6e8-1585-48e5-aadd-08db4d904bed X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 6qgWEQdPtx/18ROW9aY+/n5sSH+IAFtJodIezjiZaSL7Dvmx8JJV8c+v3khatrtWDZzCXWuppeRY7bKxFuI24Vb3s9vxx+jVYzrPWhNJ6PcglIj0uTIBxOViN3e9muF66uH1WrGr5ZRjF20kp/4YFzfDLCvh9YV6b2RLAsgD5NQMGKhj9QCk1btj3YR00oUaeKY++2263TfJansYE1oI6BnhfTInKZJMU8BQyG3wD2B3k9CErgJczPOPBGvlNhyApdwu5G9IRU4nqEAakqQhp3FyBHCCiQw9LMlmuIOFBilEMv++fRLRr024yLTAJFjVSYzcnVhTzVcoDKL0BwTrxdnD1e3qW1qs5rr67EMYemv9loI5UJr9jr9ZcUtfHKyuY3E/vDpS0JnkvA1FTP2FzuGV+4WXyZDbK2s8UQhm5V9sRFXJ/RLPAbSK5ygK/Nhc719NuWrQ5wcX8hmEh17x5aVa3FjJxYJVF4DaQV6QLH1fdDcimOkMJM4ovMQzkGTt1FWkKgZ2zlNbyGprLujgFEIjD2dN6qZVItlBHb2c348x9+vVF9fZXXYv3x4ujDvy X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SN6PR10MB3022.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(396003)(346002)(366004)(39860400002)(376002)(136003)(451199021)(66476007)(6916009)(4326008)(66946007)(66556008)(6666004)(478600001)(6486002)(316002)(36756003)(86362001)(83380400001)(107886003)(2616005)(6506007)(1076003)(26005)(6512007)(8936002)(5660300002)(8676002)(2906002)(41300700001)(186003)(38100700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: uPs27AAqHPLOhnXFDLdp6tMdzqTcBWvycD8cDDeigTxNRe2DmShZfGz2ok33orUqlpnMnnapJhx40W3NAFysWNxb7G/RluKHY6EugWgiuNP0Ozr1hBTy0WuvoZiTvBTHrb9lweTdPnevv/lW1t66DJvoWAPoIQaqDi+HunY8twjpQh4bSr14Qe+s614cZpGNEwtXuHS4w5JESgByjXH39uZomIrk5S1PHwrYSAsspiXCNCXdCgIpfeSwMCo9DyzHBoLKPiMxfPmzDw4cCkL7/ginQaZ8BgTzyEN1f8nbei0lHbS6S6P3LKTXtGuRjEcyuaQzoiIVnsenBjcrf8XIeZ6jmae1vcVpOUvh9WZ8jBkhll8JDiR4TUU+/AYpw+aRaxOY/Q15Yx2PvjOlOD6ZXSWz/LwN0Z4uiRuZiSnwI4WR8EUAysM7o3kw/AkJELkokg4UPIM5dIWhmZm/Gm18rEklLmBckK59GUaIjBV/DK234h3BNH0KC+fAdXArhUpcNWwcL4XAfaEvEV4j8ixtPY/5fnFMAfpBJYMglP6etysCqut4HY6rVjVVy7GxRd6jNJOWSf76VtDksZ3GVK1x2HvsOhLtvfiZBswgtUMO6lrdSq4SNNNFgIBXMa+fvpISC4hkUzxQPzl3YZ4D5+4OZGSKn9pX+hmah4NrfZJe2QwiCHEn1yFzXZMvxgJY8nCS78NwgjXYFwU8MihXGMY0FwBm4UKWkO8bZB/F0HG6KgdQRWVpRaCpypPd/GKZz9ycYb1ProINSMo/7ckhjzInDClHAjYAckRltdu3a/gEnbiGIUcThL1wTn4PmBxSUm3EZaxq1oUJD/vqCElBWrobscCxBsK1VMLqsoL5kX0aLdVy39vA7EeuXI265eGOUEA3hieNijY3BP05aXq7bp9/r2UIwTxdmsDwrnXBOd9E8KWBV9R6S3/PsXnLB7kYsqRvvdLrplvoIBknH3T+VOCG8qQwPCB71pPkZC2gnpMEGvZf1OMA3b0cYgv8YbGnZpDRFQZI9I7Yhvrr82nVOCqvNADFzEbV3UQjNNMpowe38yNNXmi7zW4dM6foaRmHtIikks9gnRvJ7B54pX/3kXk77oIYM285sswAxuCxjgCgt+VA6xYUcxS43rxmD7Gcr32xHBCAflx3nS/sdTQslWMzHJjjciClNaSSe2FulLv8QvpokC+ZWQu4kbhTY4IJfxQRIyAfGQD9FbGLUa6kRhacr658OZJkH9WwJJg38alP1P3XyceOBrxT6QRryuT7EhbF+h1PUWh0GR7kq3T+SE7M2mF8vFeo4MXDHZaVsE97/nOThOBfuUBdxBv+dM8kvUNIxfDWfTyhIDE/meCBqMY9ZyKCCT/zEORhoCQdinfycuXTAgw/QaL6NJ5DdVBexxBgzcu4q6Pz+w72L4ay+CwoC3J1Y/K1meX6vsLaqbIRx8xFNMeOIL/9RQJFvDie/UX0XOq1/78rebc1pJD44sd6greDQoI3vlR2us6ckan5KGTzPxfypzo0cLwliUnyfRXBySDA1640X095ckpEM2LwqiAJR4E4wRxMZPuDBgDgfAiDXnz511THtNIlCWCZd7qz46XPIxYUkU7YQEnF+UFeYA== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: 0tqRSs8lqu2Z5v05hmol47nBAuTF35AkzHRtSTNunzOSRpqgcTUyBmGHjOSLOKVBsKbs03sCR3ZQxPdvFAHCUavtHgcjN53RGvghSPRCjUQ+iFYFff0RVWoHrttbvT07F4eHJW63iWIdyWt/Wq/zD3/5bjiizym+czCo8KBDFmSS2jvDPGKjbfp0eWlzLJGEnuKNuDmx6bKCWXaUnwni8dgHw+G6z02rjI48zCn3oQFNHfTjQALm+Qf8zxaFP0KbxGuZWyPhU8rzcza7y5hDrxro6M+bS1qFM08Lx1uuarALqYi+6qXnlzDSIlea+9MppZjLG+ggzDOK2abl8Agj2IcwnZSyFXsH3T0SjVPmYZUJSTg9+S/2nOASMlIaqIGdIewlH3H4h2U9YHqnuPsu073Je8gDQqOwgeu4Ah6tD7T2VkZplzsAuYt0wXqXiyTueKGRbat1pDqto9qimnGweyO09GZ24KKrPY8nsRhYMuKgZKz0U/bRhMCjd9diYIGRmABwOrAVy6QMxGi39vm09+trSOZmKbz+llOOrn6z1DMAssVWI1r2/XUMVkYI7mAT2UZylpt1PYZ0U8ayi0jw7Y8FTF+iSEBboeK+fpcqyCghzR82WlJBVPhGR/V9depwDHkzwgV7Vpp3DR0ZTWXmsRUDvFUD4eEKw6NR4PF9uNUzBq3J9z0OElyaVkfbE/YSeAI9HwG4h789LwyR9nMrdHusOasKjs6igCtRBcFOB77T1lCadBkS/ktjjk6ndYy/L6voGU81KSiXBmE60ow3zLbD4F7Pm4p/t5nq4jpOoC76ef9oQG+A6W3wcahBM0n0cSyuXzFQgMMoiJZSMNlRG8bZADo9uTC16JZ6HeCdlLga4qkn8pUEIYP21yldx+ai+49OWGCmTxyf4pfAeKeH9A== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9d4bd6e8-1585-48e5-aadd-08db4d904bed X-MS-Exchange-CrossTenant-AuthSource: SN6PR10MB3022.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 May 2023 17:43:54.8546 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: ArjaPRTLv1vxnpQN2x6cFjkcgVH6eIvdvLoeNbgTT+pp11F+wKcEtp+kg667FM3X/Vwm5e+qLWeHj+Mg2sTeWA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL3PR10MB6089 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-05-05_24,2023-05-05_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 bulkscore=0 spamscore=0 mlxlogscore=999 mlxscore=0 adultscore=0 phishscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303200000 definitions=main-2305050146 X-Proofpoint-ORIG-GUID: nR6x51K2FWxajrG9MacuTRyZyrQW5SBf X-Proofpoint-GUID: nR6x51K2FWxajrG9MacuTRyZyrQW5SBf X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Add debug macros to dump the maple state and/or the tree for both warning and bug_on calls. Signed-off-by: Liam R. Howlett --- include/linux/maple_tree.h | 100 +++++++++++++++++++++++++++++++++++-- lib/maple_tree.c | 34 ++++++++++++- 2 files changed, 129 insertions(+), 5 deletions(-) diff --git a/include/linux/maple_tree.h b/include/linux/maple_tree.h index 140fb271be4a4..204d7941a39ec 100644 --- a/include/linux/maple_tree.h +++ b/include/linux/maple_tree.h @@ -482,13 +482,13 @@ static inline void mas_init(struct ma_state *mas, struct maple_tree *tree, } /* Checks if a mas has not found anything */ -static inline bool mas_is_none(struct ma_state *mas) +static inline bool mas_is_none(const struct ma_state *mas) { return mas->node == MAS_NONE; } /* Checks if a mas has been paused */ -static inline bool mas_is_paused(struct ma_state *mas) +static inline bool mas_is_paused(const struct ma_state *mas) { return mas->node == MAS_PAUSE; } @@ -679,6 +679,8 @@ extern atomic_t maple_tree_tests_run; extern atomic_t maple_tree_tests_passed; void mt_dump(const struct maple_tree *mt, enum mt_dump_format format); +void mas_dump(const struct ma_state *mas); +void mas_wr_dump(const struct ma_wr_state *wr_mas); void mt_validate(struct maple_tree *mt); void mt_cache_shrink(void); #define MT_BUG_ON(__tree, __x) do { \ @@ -695,8 +697,100 @@ void mt_cache_shrink(void); atomic_inc(&maple_tree_tests_passed); \ } \ } while (0) + +#define MAS_BUG_ON(__mas, __x) do { \ + atomic_inc(&maple_tree_tests_run); \ + if (__x) { \ + pr_info("BUG at %s:%d (%u)\n", \ + __func__, __LINE__, __x); \ + mas_dump(__mas); \ + mt_dump((__mas)->tree, mt_dump_hex); \ + pr_info("Pass: %u Run:%u\n", \ + atomic_read(&maple_tree_tests_passed), \ + atomic_read(&maple_tree_tests_run)); \ + dump_stack(); \ + } else { \ + atomic_inc(&maple_tree_tests_passed); \ + } \ +} while (0) + +#define MAS_WR_BUG_ON(__wrmas, __x) do { \ + atomic_inc(&maple_tree_tests_run); \ + if (__x) { \ + pr_info("BUG at %s:%d (%u)\n", \ + __func__, __LINE__, __x); \ + mas_wr_dump(__wrmas); \ + mas_dump((__wrmas)->mas); \ + mt_dump((__wrmas)->mas->tree, mt_dump_hex); \ + pr_info("Pass: %u Run:%u\n", \ + atomic_read(&maple_tree_tests_passed), \ + atomic_read(&maple_tree_tests_run)); \ + dump_stack(); \ + } else { \ + atomic_inc(&maple_tree_tests_passed); \ + } \ +} while (0) + +#define MT_WARN_ON(__tree, __x) ({ \ + int ret = !!(__x); \ + atomic_inc(&maple_tree_tests_run); \ + if (ret) { \ + pr_info("WARN at %s:%d (%u)\n", \ + __func__, __LINE__, __x); \ + mt_dump(__tree, mt_dump_hex); \ + pr_info("Pass: %u Run:%u\n", \ + atomic_read(&maple_tree_tests_passed), \ + atomic_read(&maple_tree_tests_run)); \ + dump_stack(); \ + } else { \ + atomic_inc(&maple_tree_tests_passed); \ + } \ + unlikely(ret); \ +}) + +#define MAS_WARN_ON(__mas, __x) ({ \ + int ret = !!(__x); \ + atomic_inc(&maple_tree_tests_run); \ + if (ret) { \ + pr_info("WARN at %s:%d (%u)\n", \ + __func__, __LINE__, __x); \ + mas_dump(__mas); \ + mt_dump((__mas)->tree, mt_dump_hex); \ + pr_info("Pass: %u Run:%u\n", \ + atomic_read(&maple_tree_tests_passed), \ + atomic_read(&maple_tree_tests_run)); \ + dump_stack(); \ + } else { \ + atomic_inc(&maple_tree_tests_passed); \ + } \ + unlikely(ret); \ +}) + +#define MAS_WR_WARN_ON(__wrmas, __x) ({ \ + int ret = !!(__x); \ + atomic_inc(&maple_tree_tests_run); \ + if (ret) { \ + pr_info("WARN at %s:%d (%u)\n", \ + __func__, __LINE__, __x); \ + mas_wr_dump(__wrmas); \ + mas_dump((__wrmas)->mas); \ + mt_dump((__wrmas)->mas->tree, mt_dump_hex); \ + pr_info("Pass: %u Run:%u\n", \ + atomic_read(&maple_tree_tests_passed), \ + atomic_read(&maple_tree_tests_run)); \ + dump_stack(); \ + } else { \ + atomic_inc(&maple_tree_tests_passed); \ + } \ + unlikely(ret); \ +}) #else -#define MT_BUG_ON(__tree, __x) BUG_ON(__x) +#define MT_BUG_ON(__tree, __x) BUG_ON(__x) +#define MAS_BUG_ON(__mas, __x) BUG_ON(__x) +#define MAS_WR_BUG_ON(__mas, __x) BUG_ON(__x) +#define MT_WARN_ON(__tree, __x) WARN_ON(__x) +#define MAS_WARN_ON(__mas, __x) WARN_ON(__x) +#define MAS_WR_WARN_ON(__mas, __x) WARN_ON(__x) #endif /* CONFIG_DEBUG_MAPLE_TREE */ #endif /*_LINUX_MAPLE_TREE_H */ diff --git a/lib/maple_tree.c b/lib/maple_tree.c index 084868865849c..a28b021f740f1 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -240,12 +240,12 @@ static inline void mas_set_err(struct ma_state *mas, long err) mas->node = MA_ERROR(err); } -static inline bool mas_is_ptr(struct ma_state *mas) +static inline bool mas_is_ptr(const struct ma_state *mas) { return mas->node == MAS_ROOT; } -static inline bool mas_is_start(struct ma_state *mas) +static inline bool mas_is_start(const struct ma_state *mas) { return mas->node == MAS_START; } @@ -7251,4 +7251,34 @@ void mt_validate(struct maple_tree *mt) } EXPORT_SYMBOL_GPL(mt_validate); +void mas_dump(const struct ma_state *mas) +{ + pr_err("MAS: tree=%p enode=%p ", mas->tree, mas->node); + if (mas_is_none(mas)) + pr_err("(MAS_NONE) "); + else if (mas_is_ptr(mas)) + pr_err("(MAS_ROOT) "); + else if (mas_is_start(mas)) + pr_err("(MAS_START) "); + else if (mas_is_paused(mas)) + pr_err("(MAS_PAUSED) "); + + pr_err("[%u] index=%lx last=%lx\n", mas->offset, mas->index, mas->last); + pr_err(" min=%lx max=%lx alloc=%p, depth=%u, flags=%x\n", + mas->min, mas->max, mas->alloc, mas->depth, mas->mas_flags); + if (mas->index > mas->last) + pr_err("Check index & last\n"); +} +EXPORT_SYMBOL_GPL(mas_dump); + +void mas_wr_dump(const struct ma_wr_state *wr_mas) +{ + pr_err("WR_MAS: node=%p r_min=%lx r_max=%lx\n", + wr_mas->node, wr_mas->r_min, wr_mas->r_max); + pr_err(" type=%u off_end=%u, node_end=%u, end_piv=%lx\n", + wr_mas->type, wr_mas->offset_end, wr_mas->node_end, + wr_mas->end_piv); +} +EXPORT_SYMBOL_GPL(mas_wr_dump); + #endif /* CONFIG_DEBUG_MAPLE_TREE */ From patchwork Fri May 5 17:41:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Liam R. Howlett" X-Patchwork-Id: 13232887 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8F74FC77B75 for ; Fri, 5 May 2023 17:44:06 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 24C3A6B0080; Fri, 5 May 2023 13:44:06 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1FC146B0081; Fri, 5 May 2023 13:44:06 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 09D916B0082; Fri, 5 May 2023 13:44:06 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by kanga.kvack.org (Postfix) with ESMTP id DCE516B0080 for ; Fri, 5 May 2023 13:44:05 -0400 (EDT) Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 345HhOID028094; Fri, 5 May 2023 17:44:05 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=IbTSmdyb2l0AxI/fykNQrwHeQXPrfhWT/toCcPlgTno=; b=FIgsVyjHkx1HBwzNx5m93fIiUUIyWgcZt4DpauEzRefY5gycl40dDTlixkwpK9w61jDz pxF5xYfw2CYToK2cQgkM7xqjZPR+lADCkGxhoBrDpFbGddgDWBLn9BOrhwf4EsueVCt2 oPMqs2aKLlf0kUKsJudjh1bXjQb1njNHaeiKqkk15YOP67kN9nsogX4v28FbGlSM048m ymA6nQTSTG5tMRxhIvaN1h5ISfThcY+x8MBb+8nnDMmKKGoHqZ4PDNTsDkiKRsamdZ58 7RSQY0gJYfG2xQdrOSx4yxdA700GuIWSONUo3QyJKbNWrRg6NJLWqWHtjZ9Qx16ALNG7 cg== Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3q8t145jcq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 05 May 2023 17:44:05 +0000 Received: from pps.filterd (phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 345GVNqt024864; Fri, 5 May 2023 17:44:04 GMT Received: from nam12-dm6-obe.outbound.protection.outlook.com (mail-dm6nam12lp2170.outbound.protection.outlook.com [104.47.59.170]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3q8spacj05-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 05 May 2023 17:44:04 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jwTHHocOicNwRtjzoeWERVPG7WXSZ/qDbfLXlXAupLIMus8hjhB/FJj8/st3aQjMkgJ5F9oqBZwd4QiMt9hz7cnK31bq83ll2kLlqzm4vIf7TSmLVnO//gV8UVJIM5aYtLH6UXEQHQxR/TC1oU+Dy2gJWbhVWNdxqAUVE9L2SLKnshB7YhkuGuW0gXi4G/ryEhNiqEsHVOR5mwlaQghvutGSGlIrxZEtJ0mFMcGr3VAwYjmTHNRZan2zEfKOq5APzmgTFl2e82s2wh186DQaUkVfZVtaVNRs0JcthZD5lxpYDSimZdMWZ6CdVvM+BbDPr/hbJcN0wG7xfG9FVmkFGA== 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=IbTSmdyb2l0AxI/fykNQrwHeQXPrfhWT/toCcPlgTno=; b=Pk1+6OB2HDWDF+A+1R033hufITiZA3jQW2ce/ZQfE96UWKC0dXTS7aG/4xaHRr10UHzN2GA/3DW38oGtTyWOoCqE47U03bQAFm0pRzC6I1Ew46bx/17zPpXELrZnW08kfXN1dE0D6pAnlibxZWk+gEhITStdvY7Hnpna5MWj8aJrbYJfyoRuUxPfDEWBbgOnPWXqk2ahzJEPuYfcpseP92wRqE5bXyGI5fGa1o8jKOUdJA0CGolIV19g6k/mMnmzY5j/gZZUyRKuC19mWgm73JR0f4ZVxXIOFTWb6TrJh7EXYYW5FZV4a2q6YGHzYQY0crM8QrT0AZPOzpQFmqH1rA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=IbTSmdyb2l0AxI/fykNQrwHeQXPrfhWT/toCcPlgTno=; b=j6RpMMILtZ6XEmehJ0AkQRRvQwOyNqgZcLg4YscrxWkms2fj2aWO/j0V9dhlj66qIBKDjuptKoOJ9uOPGI3qSMu1cto25Rz3vW2kEZE98R3g7jyBwSythjO/d7hPiPpsvjW0ueJCePm8Nfa/oFpxXneGN3blNFEa2CtdA5RAa1Q= Received: from SN6PR10MB3022.namprd10.prod.outlook.com (2603:10b6:805:d8::25) by BL3PR10MB6089.namprd10.prod.outlook.com (2603:10b6:208:3b5::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6363.27; Fri, 5 May 2023 17:43:57 +0000 Received: from SN6PR10MB3022.namprd10.prod.outlook.com ([fe80::8bb9:2bb7:3930:b5da]) by SN6PR10MB3022.namprd10.prod.outlook.com ([fe80::8bb9:2bb7:3930:b5da%7]) with mapi id 15.20.6363.022; Fri, 5 May 2023 17:43:57 +0000 From: "Liam R. Howlett" To: Andrew Morton Cc: maple-tree@lists.infradead.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, "Liam R. Howlett" , "Liam R . Howlett" Subject: [PATCH v2 07/36] maple_tree: Convert BUG_ON() to MT_BUG_ON() Date: Fri, 5 May 2023 13:41:35 -0400 Message-Id: <20230505174204.2665599-8-Liam.Howlett@oracle.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230505174204.2665599-1-Liam.Howlett@oracle.com> References: <20230505174204.2665599-1-Liam.Howlett@oracle.com> X-ClientProxiedBy: YT4PR01CA0262.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:10f::26) To SN6PR10MB3022.namprd10.prod.outlook.com (2603:10b6:805:d8::25) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN6PR10MB3022:EE_|BL3PR10MB6089:EE_ X-MS-Office365-Filtering-Correlation-Id: f838c09a-da3d-4f7f-4586-08db4d904d53 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: TVjs/kMUbaTNT+Zw0TwIiWprUjseWCCkvLSM4cbVPiFmSqb+V/zclfD8IOWdOAeLD2gTrdVQJ+TQEL3czlTdEASRzG9gIHf1bVraXo79AHS39Z/ofdkZN6fP0D43TLtqDIFAw+FCzAk7n19ZTxJXXuB05VofHobXxd72y6p8YsP+iHiaprJKOAZpGg4pPiBdmxHPJd9VhPu+CwxQ91Ykq/dHdha21kmGK9KCbZTJZDfoKPQzantiw9sBwthDMCKuqi4LSPp5f5nj2/32l1L/K4166Do7M93XV82zFyGmr91nsYforjXDPcGK2+PC2InLWrel36qtNyMlWkK5xi47OX/zy9WkRjE3InAVk8wJi0YrL6XFKc7lN1BQA5PYX132npRtqzaeushstHPa6mdRwikySuIoHrVKIzt6ScfOixicNzRjLkwhpp2EM8K4wH6NwcdXZj2IKXgZIlIoFYvheh7NwpKzsKmjaKjTn7OPhqrQUcaUJ7oWLSV0mxsmJSDKbM/GpagLyR5Wywvh79Ta4ELJtqOvEg+4iBRInuUoMBrWpAav2UNUs3nPw7dWybzA X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SN6PR10MB3022.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(396003)(346002)(366004)(39860400002)(376002)(136003)(451199021)(66476007)(6916009)(4326008)(66946007)(66556008)(6666004)(478600001)(6486002)(316002)(54906003)(36756003)(86362001)(83380400001)(107886003)(2616005)(6506007)(1076003)(26005)(6512007)(8936002)(5660300002)(8676002)(2906002)(41300700001)(4744005)(186003)(38100700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 2KtuLIsyPwugbGvWwM2s+ppSn1nCiXvrbjipKASHuBLNYZ+mXfTy5s4O9p9eZe10pCL3rDj+DlzoAggHGTp1Qtzw6aKr8LPgW4LqTjSFnj4326t1HZB4ddtonIbZEYNf/gGy1UUUGMbInDs7KUIKGEPNuWRL3c4MFQzstqwGxYgnjksHl0bWvR5tVQOWRzl86+t2OXjYIZKwT8/l9WffenA0/cTvDcUOSBMKRr7zysImPGl+y2BWw4lWjN/bFSNySxQLM+izKjE+mYKZOqd6let4dJLNyN8spzECvtJYGlmvEPJjqpANPEuzelNIlzl5qqvXGbbHGLrHHkpWx+h6NLxvxf8858bc5qMTfQzakfrMA+eqlWcmZTdioLRMUOZNX3Mwb6iOw+aJGZZZVpdqu4AvU1xfjkhc5uo6SLKjBogf71wrMo/TYQ0/VtK3vg0V70aOpweoR+SESHuuNre+OgfJQ1QAG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nq47pIcvRLW2/6fN8d5NabgJU1AvYspawu12jtK/p1k90GAak41R/m0XquPnPs6Q== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: TR5CI5HGFDGntasAJpbZw5RBMEtdBNMd7iF5sgzYmZMHESJOCFRChTrq68Vo50L4LYIdkWTVXZLfxz5omOL7ZXoyq9SKyljCXZpcJCFG9KrMqMT/Yovnx0rjBYXVo5EGb3f5za+uAUlh19kpfofhf5hUb4mJoS1gOdIi+1KqMu++yiPWy2uQOXrq8uI5pjO85J++/kVnjmwfOgsfO8uWJeZb/ru8LXeklW19JPlTNeNyl38t0rTP2PnSY3NyhGrOF4vJXnf43TXK4kOU70NuTwKqerwVaei7bxtz7HI5IzV3/s9e9Ks+y2MvG2FfKWuHCTSK/JnEddJovWvFT+fKBvPAdN89/DAgyzEILbKBo0k8Kx3FsMl0VdxM88ASFUfpnZkC7kny8/ZcdxLXSBDe6AvP7klZJJC3lIff+xuWNVcPnMPk/qG1n3HCJoK6pgSpnLpvzBn1isJFDKVFCJx8xnl6IsfAwVw1IbAUAM3VrjAdEN0YNTEhoaQtMDJCxjkeEBcPwM/HWaQzwhyaghPuy/H+WsJ77aqmSxIKj+4RsLFgN9XVZRy7/cGkLx/CM3RD+mQf0WUI5bcKOe6015BZtOcsacq5W8YrX2lXZ2WQm06Or9QanYkceEeUlxgVqMAv6tgqgkvVlw/dgO8WU3ofR5JtbKYbEYJomOp0MstcH3SbtnwrUauObuDahVBL365fSiG8/mjaM7W9BDHCDSE39wOSDcy7owhW5E7ZaGOJJ01zKury4GFViD8MhxpnkDNKhIzYW1aQTtgn8ZY0QsKdHczf7et+b7VpeEM+dCiH/3c6gkx73QDHzOoipd4E/NoJvNgoApNlHHK+9grG47HDEdxJtBsyY/PfBtKi0zNqR65ib/53BgdRlYjxzXEp0W7F7AH5OR50hYhVYr+dOxXR5w== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: f838c09a-da3d-4f7f-4586-08db4d904d53 X-MS-Exchange-CrossTenant-AuthSource: SN6PR10MB3022.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 May 2023 17:43:57.2123 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: QawuG0CLqHXL+lzdg3PzY5EXxb3eABbfQfM06N825NZgVpNV1z1ssj/OWexxM5KoMfLFue2EIwwnme679mzzqw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL3PR10MB6089 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-05-05_24,2023-05-05_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 mlxlogscore=999 spamscore=0 phishscore=0 adultscore=0 mlxscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303200000 definitions=main-2305050146 X-Proofpoint-GUID: QrLV76Ilo-Cwoq2-kmfLUs69XoD8go7A X-Proofpoint-ORIG-GUID: QrLV76Ilo-Cwoq2-kmfLUs69XoD8go7A X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: From: "Liam R. Howlett" Use MT_BUG_ON() to get more information when running with MAPLE_TREE_DEBUG enabled. Signed-off-by: Liam R. Howlett --- lib/maple_tree.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/maple_tree.c b/lib/maple_tree.c index a28b021f740f1..c3ce2bc594123 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -194,7 +194,7 @@ static void mas_set_height(struct ma_state *mas) unsigned int new_flags = mas->tree->ma_flags; new_flags &= ~MT_FLAGS_HEIGHT_MASK; - BUG_ON(mas->depth > MAPLE_HEIGHT_MAX); + MT_BUG_ON(mas->tree, mas->depth > MAPLE_HEIGHT_MAX); new_flags |= mas->depth << MT_FLAGS_HEIGHT_OFFSET; mas->tree->ma_flags = new_flags; } From patchwork Fri May 5 17:41:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Liam R. Howlett" X-Patchwork-Id: 13232888 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 849EAC77B7C for ; Fri, 5 May 2023 17:44:07 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B753B6B0082; Fri, 5 May 2023 13:44:06 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B24256B0085; Fri, 5 May 2023 13:44:06 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 976526B0083; Fri, 5 May 2023 13:44:06 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by kanga.kvack.org (Postfix) with ESMTP id 759A66B0081 for ; Fri, 5 May 2023 13:44:06 -0400 (EDT) Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 345HhI2W028007; Fri, 5 May 2023 17:44:06 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=W5VCQae/u+KrSguTgZokUl+Fxo+cz9ZckZBWA2If+Ro=; b=PYRNpmeUczSDqawrC/QcyXE6aI1B2NpsCZUw+mkg8Uss/aKmTGEQPhdNpRItCncFLOct 9fCZLL28+MAkHpztI2JtLkiiytkBYWNqsXxdCMHJCKX+n4EBMaBx/FCnYxWqg6KW7ZCT g42C+uMrUZXoEAXnMFnFDmq9FEhdoap2F5rh4ge03r7/rPnWkAhmDlr+uaE+UyhgYV/l LS4GByXOpbe3RNdk7vrV3x/Q63yv2IVIiQ0I/cV/SCRBdyew3/DyTEztQ+zFA9cQgbik cT3HncYfj/TOLMcN5Q+Cw9FbDYV2sdBXxqAofQ1Wnsx3xxDuzTXbJYwW2ieRs5l0RabQ 5g== Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3q8t145jcr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 05 May 2023 17:44:05 +0000 Received: from pps.filterd (phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 345GVNqu024864; Fri, 5 May 2023 17:44:04 GMT Received: from nam12-dm6-obe.outbound.protection.outlook.com (mail-dm6nam12lp2170.outbound.protection.outlook.com [104.47.59.170]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3q8spacj05-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 05 May 2023 17:44:04 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PR7VMIph/fO9l3zLeXBF6nZmOAMCEyMBoL3XNvU4VXVZjNYgi+2qFRZFbLQGHzsZMUxd6DIdGP0hX0fX++YhnRq+c8wliSAexbzIz0n9vOe0pBdCx1kRdc8YkWnACEx5cIjeukzTl+2XcRudxXOEucXekoa+GT5pWMoTZ86DdnczeTa6SZRrGZeZCh2l6FRWR+2D0GZ/veK2ZuU2ZIbvb93UjSeN/ZazI1+mXy3HBWStnRxfmnRvsRYSYotjmmV122LJcR4B3nUScAp/wqTw8E9ptTLWp7NYrEjdVCRBQbUQc5qMVS0DevbM7RIhMpFZ09c4y86y0zmvVeErIr6JbQ== 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=W5VCQae/u+KrSguTgZokUl+Fxo+cz9ZckZBWA2If+Ro=; b=m+weNgqhz1/dpLNoK44Bd6NMNfnGNcCGk/y66Za69hd0B0LQ9iupZYRsxXz+lqSxTNbwp57B2UUx2tNU8s5xyRHcbuQhCChWWhI94+cNf2nZtmgsL03wQd8jd3Uz1167f0V5mfUw5IMXd0+zWQG+1/LrwIo8NzW2ZtpZ3iiZ0jTvgETOyfEGE/kmoIZPjGm1CxlWBWhMW13PmrIaZEGjn8a8xmk5Z+V+jJeKzEgVpU7qDHazXm13rVG1oA/8WPWKaDN/rh1a51S6Qed6x/KeMyi/z7YNJsE8FlDcSgZYc0uSt7j6tHv+Op3bTaBRXFSyUf9PzF8/rE5MSi3lBruHJQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=W5VCQae/u+KrSguTgZokUl+Fxo+cz9ZckZBWA2If+Ro=; b=EqjmN0dO+xauWhY9p7Z68FvQzrqZSJiOa7tMr8TJAy6+VKqrNHEv9Oz3XZT8c974J2kmR8TgAcebrHTx+f1Rki8uFORK03qviMZOzKAJu5QrFX6LQZnBtp3ZcUm5HCoe67SpP5TSncdfXocv9aAHDBpDPEseUo/j6HppxynFwAo= Received: from SN6PR10MB3022.namprd10.prod.outlook.com (2603:10b6:805:d8::25) by BL3PR10MB6089.namprd10.prod.outlook.com (2603:10b6:208:3b5::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6363.27; Fri, 5 May 2023 17:43:59 +0000 Received: from SN6PR10MB3022.namprd10.prod.outlook.com ([fe80::8bb9:2bb7:3930:b5da]) by SN6PR10MB3022.namprd10.prod.outlook.com ([fe80::8bb9:2bb7:3930:b5da%7]) with mapi id 15.20.6363.022; Fri, 5 May 2023 17:43:59 +0000 From: "Liam R. Howlett" To: Andrew Morton Cc: maple-tree@lists.infradead.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, "Liam R. Howlett" , "Liam R . Howlett" Subject: [PATCH v2 08/36] maple_tree: Change RCU checks to WARN_ON() instead of BUG_ON() Date: Fri, 5 May 2023 13:41:36 -0400 Message-Id: <20230505174204.2665599-9-Liam.Howlett@oracle.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230505174204.2665599-1-Liam.Howlett@oracle.com> References: <20230505174204.2665599-1-Liam.Howlett@oracle.com> X-ClientProxiedBy: YT3PR01CA0009.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:86::21) To SN6PR10MB3022.namprd10.prod.outlook.com (2603:10b6:805:d8::25) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN6PR10MB3022:EE_|BL3PR10MB6089:EE_ X-MS-Office365-Filtering-Correlation-Id: 902de8eb-59db-4565-3005-08db4d904ea8 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: DSU1fR+s/856spKUFEFrzTqDWguS3/lNfO+0YdsdxbEjBDai571NsuQNSCPx2UbwZWcfBvredlGz4njOlZKuntH0HqGW7dbFMw+atZzDjKi39kMj/w7wDQEodQWKX9FjPutUY1V7EeYV9YBu6/SBH1l5zLSta9YzlgD/lhU6lIoMhWHSqKteORKFxBJV7dVomruPolowQdq6nTZwkcMjfmdJ4tMLDibDibqSJ0TSq9HZf7aY6Zb6o9QUw6/x95mc8g9zuFvp3ZXPotZTDzJ7rFV/jus3xFnCJiAzoU423SVHIGfnx4jJ9FVhXcDV+CRyNMxO592iPSfJ5Vhm4ji6fJczUqwc8olOtvRPY4rtStU+uCYgECCuf+kmWzEokAs59HhqTtd8p71qNOO1vJsLaqNbkyyW4FFwByAAt4QjPTkOKYGXXNYQwvsiGCpOqsWeh+mgRC9hCVYKSgQKGVtFZAPmI5JPUyoWEj/M8qtLpBs71vrJYpYsFob6kOU8H4QN/mfFar8xPk2zdoCxKUitNH3MRqmEn3jWLR6JAlxA6xx9YR/G4+SOxDYWf3NvDyld X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SN6PR10MB3022.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(396003)(346002)(366004)(39860400002)(376002)(136003)(451199021)(66476007)(6916009)(4326008)(66946007)(66556008)(6666004)(478600001)(6486002)(316002)(54906003)(36756003)(86362001)(83380400001)(107886003)(2616005)(6506007)(1076003)(26005)(6512007)(8936002)(5660300002)(8676002)(2906002)(41300700001)(4744005)(186003)(38100700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: BaFQDCkdvGgyx0BHFUXcXLlwJgHldSLPxgIQArM0B6xBW5AHqnREzvzHjDogV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z4Z/hIMwQn1rKvLjDOLC7hn6KiZkaGk3ydr/FmCZBnshXnXBzAr/+qdNLgoqYnn2X6P6giGfVhgDUI8Dn57SwwjQMuBWzj0UAKRK1Dc/2RDgwpCsulY6v69WX74MPL+Y3II/bJoWyGhrHl+MCdLvVR7W1JX+Ri6xqMgmnO0gi3IzEr6FqNYHo4KWD1e0/11ApHyd6EaLg9dKmKSgaQxtA/iieub5QxwOO5+ebUDeokjYIZIhVlDXUraAP1eQltdRWxCh//j1prJD5+I0DnswPNWnU0znPq0V8oPG7d65Exh3QpPoKJEEDGDEpEXjnImRYpEGtaTGTvQklZvE2DN8UaTb8kqHNSM2ebw9HFGV9K1zz7j2LDUFqRpdIPa1FvtT5Ajx3ihW12mOf/uA== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 902de8eb-59db-4565-3005-08db4d904ea8 X-MS-Exchange-CrossTenant-AuthSource: SN6PR10MB3022.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 May 2023 17:43:59.4541 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 9B4GKTkRymNlPT0CCMCPBmnUgYAziN8daov0Eg4PtDoyusqnvGeQAz/Ivm+O3ploK6CldBTmOSIR6xuvyy0lHQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL3PR10MB6089 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-05-05_24,2023-05-05_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 mlxlogscore=999 spamscore=0 phishscore=0 adultscore=0 mlxscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303200000 definitions=main-2305050146 X-Proofpoint-GUID: SsO2WRPHfTzJBXWP9TYV7fuokPEnX2Wz X-Proofpoint-ORIG-GUID: SsO2WRPHfTzJBXWP9TYV7fuokPEnX2Wz X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: From: "Liam R. Howlett" If RCU is enabled and the tree isn't locked, just warn the user and avoid crashing the kernel. Signed-off-by: Liam R. Howlett --- include/linux/maple_tree.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/linux/maple_tree.h b/include/linux/maple_tree.h index 204d7941a39ec..ed92abf4c1fb5 100644 --- a/include/linux/maple_tree.h +++ b/include/linux/maple_tree.h @@ -616,7 +616,7 @@ static inline void mt_clear_in_rcu(struct maple_tree *mt) return; if (mt_external_lock(mt)) { - BUG_ON(!mt_lock_is_held(mt)); + WARN_ON(!mt_lock_is_held(mt)); mt->ma_flags &= ~MT_FLAGS_USE_RCU; } else { mtree_lock(mt); @@ -635,7 +635,7 @@ static inline void mt_set_in_rcu(struct maple_tree *mt) return; if (mt_external_lock(mt)) { - BUG_ON(!mt_lock_is_held(mt)); + WARN_ON(!mt_lock_is_held(mt)); mt->ma_flags |= MT_FLAGS_USE_RCU; } else { mtree_lock(mt); From patchwork Fri May 5 17:41:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Liam R. Howlett" X-Patchwork-Id: 13232889 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3BB06C7EE24 for ; Fri, 5 May 2023 17:44:09 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 29B1E6B0081; Fri, 5 May 2023 13:44:07 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 24E0D6B0083; Fri, 5 May 2023 13:44:07 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 029B16B0085; Fri, 5 May 2023 13:44:06 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by kanga.kvack.org (Postfix) with ESMTP id AB2CD6B0081 for ; Fri, 5 May 2023 13:44:06 -0400 (EDT) Received: from pps.filterd (m0333521.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 345Hh61m027900; Fri, 5 May 2023 17:44:06 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=A/hWRGZ+r+UMcw2/v9TIxTDIJ+JR1dErT7KveUbbwtw=; b=fbjDNS3N965hQg2Kn0hFv+NueLkt/Ov3sSK2Sx6jOv8mSi+7X/JLZeDENLLeuhNgAtPF Gnu0tBAXcgtBapAcHZfzBnN+AB6dxR71OKrSytuEIw3Y7Z4oAkmc+grrsJKIh2xUwr8x RbPuXTNCGow+gEmcuLUF39QbDFni5CYcPU5NGMnIlHxTBc4mIoWxG4OKtA7ll9C9k6LW IeYpfQLTCnpUb1hEkuY/dX7TjxGviRdAv4UlEWVQt6OE/d4cB5tShCo2Q9cV0okv/iap TdmsgevCi09FqlHZ2R1aoLWlYSB6mbXLpO9/n/LsJkXC3uHn3tuaA3M4ODx7/gykqlKF eg== Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3q8t5fwf3a-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 05 May 2023 17:44:06 +0000 Received: from pps.filterd (phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 345GVNqv024864; Fri, 5 May 2023 17:44:05 GMT Received: from nam12-dm6-obe.outbound.protection.outlook.com (mail-dm6nam12lp2170.outbound.protection.outlook.com [104.47.59.170]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3q8spacj05-3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 05 May 2023 17:44:05 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=L0M2adONDnlfZJrwppUx/es1al6o9KmhsqQKdtOpDR2+m/zZ5qFuXDEQf5DvtObPlGk4DGrEp2QvkJfXFmbw1ChqDCc5SWVdcyOgBXndeAgNs++1L+Q++LeQ8rC531H2JP6krSOXEzGInyH45B7vlI0WbQgSn8cr2vp1Q2rDsZaPbbHp9WuuWxREn+7ghpk+ws1u0Kr0lqLbMvIlDzx4tPyGJm6lay93FBlMmhmeXOQmt+oWAFgFyTOK7DddyvRHGMx32WqVNkh/v8ulSUJKftmsSYrKFy2ck3bWmq73m0Iv3h4XSkW6MI1TZQ1FfqXh7v2xr5td8N90zHzPpkQe1g== 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=A/hWRGZ+r+UMcw2/v9TIxTDIJ+JR1dErT7KveUbbwtw=; b=ShuPvrMwDJVqHE8NhmOvWq+6/jb+7rw2dgaH1VsWWrhMd+GiI/u1PTrhTHqf3UoY50NQ2NqUKj05DHzqNCQkCYUoMcpKzibCvogP1W8lg2eE8ipS74qUeX8jgU+g5qnvdvOxrdhO3sJgsxcyJLJUdyg9vYLxg7YDMPTRMopfOq1s6yhVNiHHyAd8Ym9j2mhTETP18K4PdjVAKamf6jfTYAyzlUVZoJcURRogjg47MoZaE9Imjc7dsTmpcrVzLeu7icaaUJnH8E6gfmIGc7dK1NTavvBU8V6XK3pf0kvYldecZrQ/3t5usibQVk0WOq4DBvCOKLdcubAa2khr0QKd+w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=A/hWRGZ+r+UMcw2/v9TIxTDIJ+JR1dErT7KveUbbwtw=; b=VhgVecnjvBmf7uVeGCCAIHMT7McMX118BTBpvi4RyDIBBhTNCLQdvyBYHh2F6AjdlmqwKupIKhuZI9d/zLC6zxdgTJMgv+BVlWqlUOD/ioIZILmmGVFdzF+kAbQbpyTIKhTYv9SLKP7oXC8Q6UElKMRD52W+D2t13K33JcV4PeM= Received: from SN6PR10MB3022.namprd10.prod.outlook.com (2603:10b6:805:d8::25) by BL3PR10MB6089.namprd10.prod.outlook.com (2603:10b6:208:3b5::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6363.27; Fri, 5 May 2023 17:44:02 +0000 Received: from SN6PR10MB3022.namprd10.prod.outlook.com ([fe80::8bb9:2bb7:3930:b5da]) by SN6PR10MB3022.namprd10.prod.outlook.com ([fe80::8bb9:2bb7:3930:b5da%7]) with mapi id 15.20.6363.022; Fri, 5 May 2023 17:44:02 +0000 From: "Liam R. Howlett" To: Andrew Morton Cc: maple-tree@lists.infradead.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, "Liam R. Howlett" , "Liam R . Howlett" Subject: [PATCH v2 09/36] maple_tree: Convert debug code to use MT_WARN_ON() and MAS_WARN_ON() Date: Fri, 5 May 2023 13:41:37 -0400 Message-Id: <20230505174204.2665599-10-Liam.Howlett@oracle.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230505174204.2665599-1-Liam.Howlett@oracle.com> References: <20230505174204.2665599-1-Liam.Howlett@oracle.com> X-ClientProxiedBy: YT4PR01CA0131.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:d5::28) To SN6PR10MB3022.namprd10.prod.outlook.com (2603:10b6:805:d8::25) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN6PR10MB3022:EE_|BL3PR10MB6089:EE_ X-MS-Office365-Filtering-Correlation-Id: 68f39d8e-4e3b-4a05-efb4-08db4d905033 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: qOMooxY1m+g4BZZvymxgXsr+/VkErSwfeWqE2CSCknuuHjQ9V5GKCcc2iwqVxVa8z0r4/EXb76zcZ/aBZKcTAOEwVh6tAJ3cF2ELsr9IaGszDn9laYrpvTkk2gf/NyncQsv52GGci+E8w3dF8hCNy4qWiEEGdYFgonY0EgHrc1DI26FjEHVuow0T8tWwhzae/DaJDzCs73GujWVYHV8G0euo0Xs9chqzeM/TiCgLxnWDb3Ry1LF7ACot+g68VRNU2jsMOjzikdrdOYI5GVNyQ8m5rUh7YUaK0rRtYUW39GKeuVmyaetcmc471Bn/qRWjEGfIA1bCiaFvXJw47RELjWxzerPKxjSpRRah676tm7LkLLU7HssZCIDMP0xisGM/usbkETrHi+mGBN2m34A7B3MkCGdK9Kb/CM62taonpThPhBwK3CjNsINVoS/90sneZq0r4En3Yu5HM9eo9LmH0epWcbJDbpFIEfz3mO5a45of347ar7+B5Xaq26kVV1j7XnTfLioj8nDx/Jk3m4Ew/GUwKaub+qPej8sUh1eUXiMUUKhCpfQHQb/P+y08IfEt X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SN6PR10MB3022.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(396003)(346002)(366004)(39860400002)(376002)(136003)(451199021)(66476007)(6916009)(4326008)(66946007)(66556008)(6666004)(478600001)(6486002)(316002)(54906003)(36756003)(86362001)(83380400001)(107886003)(2616005)(6506007)(1076003)(26005)(6512007)(8936002)(5660300002)(8676002)(2906002)(41300700001)(186003)(38100700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: ko05ixTfypauaaWTgnwUi5zpRK3gIhZzTEEnPaSaGMrT5gLXH/bwNAmvKE9L1w3fTxJi2sgPYYhyGya+eg7mg9w/8D1fIjlDAyAs2d4F6Kz4wlbNUIuxS72AGv3alGXrzQW4pJGkw17xSxMNOjj1GJXWmPPXQci11PJCFD2Dkj+cyG/e/6ejAVsLj9sdOtG9qA4RmC8Xqve04NADHVxTMv/ckHTHH5M9f9PWMiueGoZ8mTf+Ifzn51NLbGdQuSBxQIZ5Qo9nvBlP1Bf46jasbqnKsz7W/6SOIyFK2PxPjnv8ccWV2bGR0dAsxTsjrYA+5968sCC5u0748ob7shZgTlWgp/HQTQii/SeOPJeBYVGZPlEw63K7vbcSuOyYY0McxFuylD13O6snYseJYSoQ9VWVTYDAgEPiR38MuNIg779CujIcgfj+xkT3rASkHH1+3J9gtbCHbJYaoGHgYlxPwlcH43zmCX3N+HP6BaBMAWzdLRiESV0xD++jRUn5XcZjmgyZcqeGXZXZiFswl3ycO9A1MXWEmdToeGdSRTviT2sPYd3zV1rzwb9G8/pLX9BomhO8aQsbuC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Spam-ExternalHop-MessageData-0: PpYkklic4YvYnnPmVSU31hHOwE+hDLpm6A1ulwaDansKdOXtV89dvrlBFxySdIFxmk+jcR5LWOGycTx7RPn3VTtHwHHPwtoXz3g3minBn2iJn5aYOGznsteP7sHoA+/elB1R46WipuGjcMBF1loPEHV5lZaKI9wYIfy90kQSjS5fRAuU+WKEgaGnkmD+5ElGYUGRuz1VicOrmFULPsMNpXv5IGucov0udJeZrmMvWdbYTrmhnlQLo/a6LNhLwxhgSHNQQIQMEanTPC3kxkMZtcm38g78Vpl9VWrGZkrJNwI/YDDuzeGsNyhw9Mx7MWmy9w4QskL12TWIMr57Bxd63K9IjrYZWo6kh2zB6JkTcDnKzFDoSm6GfVNdK7cH2Qamd9NdZk4IaJeydGzmkGb3eGcfflfd3VJ5pqqhPPitLshtZKB763o9ND0XHJtaB6wYtdcR6GUuCVcixmCZuIx7gHzj3GW5CsdoeZ3MnsTYivWfpE86CJHHvHSa9DGFx/r0DLdZIYkmSyRncJb+PibBOKHs21lB6Mswec4W4q+z5wbYqvPpcYyVtJUdYhICIEOih2Z0S9O5ASP0t3s2YOExViZ3ZHPI12homyjX+8u0NuFQFTq8MlOQPFlNDeL+QW8YmXtf6Mw3iY/u/eTwe0E0qIm7Kr8jjsgwpCvJE3Gy+TfTaZnvMQ884Qz9aVlJg+9POM9uQgux2G3kEMCnwS4Afb93J7fQafNhRWTl4MpfHRLwNTSPmv1KJP4TifZ4K/UhfDSLHhkhGlnG15XC3zFSSiPFhQBqNWz3fZT06vUjIptwYvxnNhL5iSLjGG9+hDJzClj0PRlMsAoVWfED+EQLj3GOECjPLiX+fOXIU0tsD624furHzc1avurAEbTQMIJcGdhOiI7t7joi0gXXxKsjdQ== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 68f39d8e-4e3b-4a05-efb4-08db4d905033 X-MS-Exchange-CrossTenant-AuthSource: SN6PR10MB3022.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 May 2023 17:44:02.0232 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 7R4t20kWAoG6qYbvd5b0mvgc7tG4gPCq40uadAiIciscnErK5bb1v+02APAIyZhtG01UuyZ8IbWH5uMMAFZ8Qw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL3PR10MB6089 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-05-05_24,2023-05-05_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 mlxlogscore=999 spamscore=0 phishscore=0 adultscore=0 mlxscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303200000 definitions=main-2305050146 X-Proofpoint-GUID: LeDJOY7V9-E8eBVSuQ_fulIGXj7q1wGa X-Proofpoint-ORIG-GUID: LeDJOY7V9-E8eBVSuQ_fulIGXj7q1wGa X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: From: "Liam R. Howlett" Using MT_WARN_ON() allows for the removal of if statements before logging. Using MAS_WARN_ON() will provide more information when issues are encountered. Signed-off-by: Liam R. Howlett --- lib/maple_tree.c | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/lib/maple_tree.c b/lib/maple_tree.c index c3ce2bc594123..8fd83f21caf00 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -5698,9 +5698,9 @@ void *mas_store(struct ma_state *mas, void *entry) trace_ma_write(__func__, mas, 0, entry); #ifdef CONFIG_DEBUG_MAPLE_TREE - if (mas->index > mas->last) + if (MAS_WARN_ON(mas, mas->index > mas->last)) pr_err("Error %lX > %lX %p\n", mas->index, mas->last, entry); - MT_BUG_ON(mas->tree, mas->index > mas->last); + if (mas->index > mas->last) { mas_set_err(mas, -EINVAL); return NULL; @@ -6529,10 +6529,9 @@ void *mt_find(struct maple_tree *mt, unsigned long *index, unsigned long max) if (likely(entry)) { *index = mas.last + 1; #ifdef CONFIG_DEBUG_MAPLE_TREE - if ((*index) && (*index) <= copy) + if (MT_WARN_ON(mt, (*index) && ((*index) <= copy))) pr_err("index not increased! %lx <= %lx\n", *index, copy); - MT_BUG_ON(mt, (*index) && ((*index) <= copy)); #endif } @@ -6678,7 +6677,7 @@ static inline void *mas_first_entry(struct ma_state *mas, struct maple_node *mn, max = mas->max; mas->offset = 0; while (likely(!ma_is_leaf(mt))) { - MT_BUG_ON(mas->tree, mte_dead_node(mas->node)); + MAS_WARN_ON(mas, mte_dead_node(mas->node)); slots = ma_slots(mn, mt); entry = mas_slot(mas, slots, 0); pivots = ma_pivots(mn, mt); @@ -6689,7 +6688,7 @@ static inline void *mas_first_entry(struct ma_state *mas, struct maple_node *mn, mn = mas_mn(mas); mt = mte_node_type(mas->node); } - MT_BUG_ON(mas->tree, mte_dead_node(mas->node)); + MAS_WARN_ON(mas, mte_dead_node(mas->node)); mas->max = max; slots = ma_slots(mn, mt); @@ -7133,18 +7132,18 @@ static void mas_validate_limits(struct ma_state *mas) if (prev_piv > piv) { pr_err("%p[%u] piv %lu < prev_piv %lu\n", mas_mn(mas), i, piv, prev_piv); - MT_BUG_ON(mas->tree, piv < prev_piv); + MAS_WARN_ON(mas, piv < prev_piv); } if (piv < mas->min) { pr_err("%p[%u] %lu < %lu\n", mas_mn(mas), i, piv, mas->min); - MT_BUG_ON(mas->tree, piv < mas->min); + MAS_WARN_ON(mas, piv < mas->min); } if (piv > mas->max) { pr_err("%p[%u] %lu > %lu\n", mas_mn(mas), i, piv, mas->max); - MT_BUG_ON(mas->tree, piv > mas->max); + MAS_WARN_ON(mas, piv > mas->max); } prev_piv = piv; if (piv == mas->max) @@ -7167,7 +7166,7 @@ static void mas_validate_limits(struct ma_state *mas) pr_err("%p[%u] should not have piv %lu\n", mas_mn(mas), i, piv); - MT_BUG_ON(mas->tree, i < mt_pivots[type] - 1); + MAS_WARN_ON(mas, i < mt_pivots[type] - 1); } } } @@ -7226,16 +7225,15 @@ void mt_validate(struct maple_tree *mt) mas_first_entry(&mas, mas_mn(&mas), ULONG_MAX, mte_node_type(mas.node)); while (!mas_is_none(&mas)) { - MT_BUG_ON(mas.tree, mte_dead_node(mas.node)); + MAS_WARN_ON(&mas, mte_dead_node(mas.node)); if (!mte_is_root(mas.node)) { end = mas_data_end(&mas); - if ((end < mt_min_slot_count(mas.node)) && - (mas.max != ULONG_MAX)) { + if (MAS_WARN_ON(&mas, + (end < mt_min_slot_count(mas.node)) && + (mas.max != ULONG_MAX))) { pr_err("Invalid size %u of %p\n", end, - mas_mn(&mas)); - MT_BUG_ON(mas.tree, 1); + mas_mn(&mas)); } - } mas_validate_parent_slot(&mas); mas_validate_child_slot(&mas); From patchwork Fri May 5 17:41:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Liam R. Howlett" X-Patchwork-Id: 13232891 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7D216C7EE24 for ; Fri, 5 May 2023 17:44:12 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0F0EE6B0085; Fri, 5 May 2023 13:44:09 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 052916B0087; Fri, 5 May 2023 13:44:09 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E0B396B0088; Fri, 5 May 2023 13:44:08 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by kanga.kvack.org (Postfix) with ESMTP id AF5F16B0087 for ; Fri, 5 May 2023 13:44:08 -0400 (EDT) Received: from pps.filterd (m0246627.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 345HhIvK029381; Fri, 5 May 2023 17:44:08 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=VFSQL5/0YuqNDgTT1gzifbZK16he4AsT0QLV48AYt1g=; b=ZaugMnNjTBk3nfgwsdnS11VSGluAiwHbpfH/QUkdKUZxZmxcll5/XfV+bpQp3o+dghf7 DzBvPqnkDpq4Oy7KJ3mwhn9C8E+mmV1tNy7p/gDN96xsk0CrHV8ahfA5tmIFw9l8sdLk dGW1uI3/CllmBEmFCR/bwJw2Jc2jgLd78eo3jCKF7NOCn/K7fpMEYZjkqnI9bNZCYCyK rQ6zDILNor3VIt2pX/PFqGVdZn7tpENiVy/tVRHbkRdXOY8nLmLUNA4vImQ5THUyf2sx QZmyFjuQ7dI1LYlaq5khMsrIsSFGEbXtxOReeC5KrNOjJuSQTAjkBnd/Hun2US9f4f+H Yg== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3q8su1wf4r-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 05 May 2023 17:44:07 +0000 Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 345GQG4V026938; Fri, 5 May 2023 17:44:06 GMT Received: from nam12-dm6-obe.outbound.protection.outlook.com (mail-dm6nam12lp2173.outbound.protection.outlook.com [104.47.59.173]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3q8spgeyp5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 05 May 2023 17:44:06 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Tl68ta80GoKxNU9lBMOqW48Zg/CJGLdYVvIcYAM7APyWLswHAkpPG4+gvT1r8TEoKOQER/Xi7Mo3HUDY+MkXHtnZW50sj0/tNIqiv4MjPwgp1pliqh6UT+PxCB3ruTbQa3uYDbo3HlPrtpa4HWhRmQC97yRe66zLrjTZFy3JD9IgQPtqsf9ZALYCsqBGgpdxCciA1CFIEcBuQ0cDGc5lqWz+EywjnnAXWuBKpHT9zJtAczlYWwhqN3rMbid2G8+qGGbmcVrzjoYi15JcZaaBH3Nhp1KKXFfYSdL7DcOVp9Ar9OkUfucgdiXCeCdWXKnZWP/ZN/XrJnZpQjerXZTpjg== 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=VFSQL5/0YuqNDgTT1gzifbZK16he4AsT0QLV48AYt1g=; b=dvybn2ZVjQVs0rS26I3uOrTRV6jyRoZXmt1LHfFsCwi/CTeAMAGO2NDt2W/8Pbm8Uq3xIdKSXxDAXtujZXoPaIz4CxAVEixwAhNWMUUvLmDgzLrs3otvEZAKqjqFyHG94NfvtJbtpfOsAgLq/14yUG4rnk/hyPtwWISSKVJHvbN0+GsLFq72xN5208Out8WvYEvUXPHIxdbJpmdS4bZsOyArwAm4I3XubKGDlhoMguvPpLngU5L+ON+aVDA3s/VSznqi7j7DB2qVMiBNJiRR7/YEJNfxSwEcHIM5s4gBEuM1Yjq2vXRP2/lf9d1qObN7vg9MHXHaBbBSplw5ThLTJA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=VFSQL5/0YuqNDgTT1gzifbZK16he4AsT0QLV48AYt1g=; b=KwRBA/bbQoIig2JQmIDR5UoSQRQu2EUvr1CbFZTUaxVRH0yQ8HcTsRCzAcSCynrl4lnZYoABsUxAvif8047i0WB968fx3o7UKX93TO0F8SoXBWK/sX0A4YNP+eYqYEcPy1vV/PvThRddSYbfx0L/cNHyQmnlt4rrkXK5igniTmk= Received: from SN6PR10MB3022.namprd10.prod.outlook.com (2603:10b6:805:d8::25) by BL3PR10MB6089.namprd10.prod.outlook.com (2603:10b6:208:3b5::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6363.27; Fri, 5 May 2023 17:44:04 +0000 Received: from SN6PR10MB3022.namprd10.prod.outlook.com ([fe80::8bb9:2bb7:3930:b5da]) by SN6PR10MB3022.namprd10.prod.outlook.com ([fe80::8bb9:2bb7:3930:b5da%7]) with mapi id 15.20.6363.022; Fri, 5 May 2023 17:44:04 +0000 From: "Liam R. Howlett" To: Andrew Morton Cc: maple-tree@lists.infradead.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, "Liam R. Howlett" Subject: [PATCH v2 10/36] maple_tree: Use MAS_BUG_ON() when setting a leaf node as a parent Date: Fri, 5 May 2023 13:41:38 -0400 Message-Id: <20230505174204.2665599-11-Liam.Howlett@oracle.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230505174204.2665599-1-Liam.Howlett@oracle.com> References: <20230505174204.2665599-1-Liam.Howlett@oracle.com> X-ClientProxiedBy: YT4PR01CA0144.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:d5::10) To SN6PR10MB3022.namprd10.prod.outlook.com (2603:10b6:805:d8::25) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN6PR10MB3022:EE_|BL3PR10MB6089:EE_ X-MS-Office365-Filtering-Correlation-Id: 8b9321ec-c6ca-4807-75e5-08db4d9051a5 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 5IrhhRdvB8vv/17lhNS6AdWofb8lZZIR5z3871A/n9DPKkaqeSIMTcCDr+XoVO1+HqVJfsBSTSqrJU1KcCQIGDs+xeuQYLGV8c2adVIXLAkqgP4cM/x/K+dtS5SINQYYGavq0Z2B9NwO5wUEU8fcwepkg4WWE6Htfhh9d74NcjAMCLT+6wL73tc2y8vjpMtBT59+KInzZXk8r6VbX+Pzf2RXWkKfHjs/SyCgeb8dEmd6UOK1YEoV5buTCXwVlNrLS+TOZnxGyslXkhRl0AGn5+tFAaWVG7CeFDYcI97Uj1+l3vrqbcz2lWiYVHtSKY+yc7JATTj7HqNnsbDNzVY2Wq4k8yQaM3tdPgc/VHO5+DxXLDlFo7a1LY4H4wZVNlCK2xEBLXcPif8bNfG622yYIFJebmuHzoVpCPMsrn/4aovLQzkrNVa8+/pximnb1oQgSoooJ5z/8LfA4/0oEZZhBXsP/gTm7TaOQG1JIGhx3ucg0hHqnLM3nFWBm+eZmVm5hd7q1a8+A8+6DIeH24S0ANh38vXnqXHdJTRqY6DJHR458eytg3zXMfxNxRcPo8c1 X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SN6PR10MB3022.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(396003)(346002)(366004)(39860400002)(376002)(136003)(451199021)(66476007)(6916009)(4326008)(66946007)(66556008)(6666004)(478600001)(6486002)(316002)(36756003)(86362001)(83380400001)(107886003)(2616005)(6506007)(1076003)(26005)(6512007)(8936002)(5660300002)(8676002)(2906002)(41300700001)(186003)(38100700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: By2OzFSEbXewBukove7VeQG2ACqCGtvk6ajnT2N+tEfsTinSf/QvwA4K7Mkf1qsKY9fm2mk9077xxrmrRdS0dHJV9NmGIecdQxjlBwMowMW43KAxk6dwXO1qVobf/AuNeRFmAEqFDTZtyxqFOfnCiflZxgay9g6vbLDKLNBGwWjOu8pOwCOtTzzCs81oRReynPlPqAsNFiU/jv7A48Haxg2AzECZLt/PzZ86VMEoS+L7RZJG6Yv77fBRVCEuuhTQ1WaDPmGXJSN/+I+9U4Y9Tr3PFgc3GbVxXKiWF6VWzxo6P5CCVczLUwryfvxb/VImrXst8psxDq3Fxxe9OFbLdIGBOd+mGjeXU9wFVpvVtPXWvdIFcfE2EGusYdQYPeuRYx7b2BG7DzhjhCyIqs3HBTXQIJ7VqffPH1GhunctVE9IrrVSYDp0wKK6eCWJTa5qaUTiCJ+xJg2OZTNduODAz0vISoMhhKYkrCPif2qSMjtHtvKAj0MqHYyjKHzV33F6y4+pylLimYQ73RVW+LR4/iLUcfmDeNoRjI/JY46p2283QjYWZPkU15aiZ1ZdwUiFbD6tQNznlHdNQ7ChPm2DpUydutCA42DjR8NsEl7jQJ+YFZeybWN8izJnzBWijFMtc5GYJtDqWJSa3rzHYXi6sXBJCsTZgslxsWHnKXCukjNUDtE9Pj3BV84ZSo2V8EB5ds1D2C9dfAwtcwD9WoEeQcZeGHva/gWxsOpMCyGihCP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TV6qRPGCVuLMEbfMjHByEfVOiT4nH9Mp7NiNSkvxXV6Yitd186phyI7IeKkT2tfbE70GlXFCqGa1EulbqWrxYBksiuz1sHqM5N5dWe6u1ZII3XI4BxS1t21NfUDA0pxDWbTYrDn9Q9ePnqCijWlmRbYZd5/iOffSYi+PJdYT42VPvnWaSwERXQBQ+KattU5plMM7hfzoxvePixijD/bCsAvU3S7GE9ASXDPQHjo9A7ykhbaUv+aIa7kbYVs6yokwDCnjAhMxpLSblHanF9ebiQ2luBDhBlM/5k4aKKPMA5jRthFPJd0i22WruUZGVEfGnPluimBdUwvSAxkljVBVBUN+YP33r2lu2/X0jsACRNyE6I1t6jjWhlHA9PVM/mKiZdE+w6GYVH7M5sRFKtl/8gDnpKqJn4gjB+hoUyg83C9sb3wdBlrWphaIZ3uzbY8IPOx2NrGh4UZHcf7xJIU1UfRA/N4WBZ9ojUDza8RrjuejTOlUFxxJ43eEAgdr7jG8CAgKhFyzSp++Qqtm1xMQPsf+Ocdg1iAWV8rua1RndHE0+5hf9T7YUTTFNh4dFzaGRYGbKGAgkZFQHdLSvq0xEyOMi09ihUqMZ3P+D3WQOkWCVg9JOmLX/gvYo5/WKwaD7QkswoWnF2s9CEC+QgR3dowdDKmEf7JiXsGTn2joIhiSHsoYM52nFYPhit4FRoBJpC+/b4FPaab8l7YGIfeiQn++K+d1lCAob/xCeOvlxsm6Oj/omy77raPJ9GJjQ3UUzZUoxU4r5ETrFOgmHV35z2w== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8b9321ec-c6ca-4807-75e5-08db4d9051a5 X-MS-Exchange-CrossTenant-AuthSource: SN6PR10MB3022.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 May 2023 17:44:04.4688 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: vb3iBgdDKw1izveosrSgKJvbQXEJZ0ikD+pBJYcdlHc/EdN6GOYgMdk+pdPYAUZFBXGPfi8DBq4I/fHnKeTnSw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL3PR10MB6089 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-05-05_24,2023-05-05_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 bulkscore=0 spamscore=0 mlxlogscore=999 mlxscore=0 adultscore=0 phishscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303200000 definitions=main-2305050146 X-Proofpoint-GUID: e9RYm0PeKU_u5aA2vraGPTpuqLugWopS X-Proofpoint-ORIG-GUID: e9RYm0PeKU_u5aA2vraGPTpuqLugWopS X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Use MAS_BUG_ON() to dump the maple state and tree in the unlikely event of an issue. Signed-off-by: Liam R. Howlett --- lib/maple_tree.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/lib/maple_tree.c b/lib/maple_tree.c index 8fd83f21caf00..a594f1d88d062 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -453,7 +453,7 @@ enum maple_type mas_parent_type(struct ma_state *mas, struct maple_enode *enode) } /* - * mte_set_parent() - Set the parent node and encode the slot + * mas_set_parent() - Set the parent node and encode the slot * @enode: The encoded maple node. * @parent: The encoded maple node that is the parent of @enode. * @slot: The slot that @enode resides in @parent. @@ -462,16 +462,16 @@ enum maple_type mas_parent_type(struct ma_state *mas, struct maple_enode *enode) * parent type. */ static inline -void mte_set_parent(struct maple_enode *enode, const struct maple_enode *parent, - unsigned char slot) +void mas_set_parent(struct ma_state *mas, struct maple_enode *enode, + const struct maple_enode *parent, unsigned char slot) { unsigned long val = (unsigned long)parent; unsigned long shift; unsigned long type; enum maple_type p_type = mte_node_type(parent); - BUG_ON(p_type == maple_dense); - BUG_ON(p_type == maple_leaf_64); + MAS_BUG_ON(mas, p_type == maple_dense); + MAS_BUG_ON(mas, p_type == maple_leaf_64); switch (p_type) { case maple_range_64: @@ -1740,7 +1740,7 @@ static inline void mas_adopt_children(struct ma_state *mas, offset = ma_data_end(node, type, pivots, mas->max); do { child = mas_slot_locked(mas, slots, offset); - mte_set_parent(child, parent, offset); + mas_set_parent(mas, child, parent, offset); } while (offset--); } @@ -2705,9 +2705,9 @@ static inline void mas_set_split_parent(struct ma_state *mas, return; if ((*slot) <= split) - mte_set_parent(mas->node, left, *slot); + mas_set_parent(mas, mas->node, left, *slot); else if (right) - mte_set_parent(mas->node, right, (*slot) - split - 1); + mas_set_parent(mas, mas->node, right, (*slot) - split - 1); (*slot)++; } @@ -3104,12 +3104,12 @@ static int mas_spanning_rebalance(struct ma_state *mas, mte_node_type(mast->orig_l->node)); mast->orig_l->depth++; mab_mas_cp(mast->bn, 0, mt_slots[mast->bn->type] - 1, &l_mas, true); - mte_set_parent(left, l_mas.node, slot); + mas_set_parent(mas, left, l_mas.node, slot); if (middle) - mte_set_parent(middle, l_mas.node, ++slot); + mas_set_parent(mas, middle, l_mas.node, ++slot); if (right) - mte_set_parent(right, l_mas.node, ++slot); + mas_set_parent(mas, right, l_mas.node, ++slot); if (mas_is_root_limits(mast->l)) { new_root: @@ -3336,8 +3336,8 @@ static inline bool mas_split_final_node(struct maple_subtree_state *mast, * The Big_node data should just fit in a single node. */ ancestor = mas_new_ma_node(mas, mast->bn); - mte_set_parent(mast->l->node, ancestor, mast->l->offset); - mte_set_parent(mast->r->node, ancestor, mast->r->offset); + mas_set_parent(mas, mast->l->node, ancestor, mast->l->offset); + mas_set_parent(mas, mast->r->node, ancestor, mast->r->offset); mte_to_node(ancestor)->parent = mas_mn(mas)->parent; mast->l->node = ancestor; From patchwork Fri May 5 17:41:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Liam R. Howlett" X-Patchwork-Id: 13232893 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6B785C77B7F for ; Fri, 5 May 2023 17:44:15 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5D2C96B0088; Fri, 5 May 2023 13:44:11 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 50D166B0089; Fri, 5 May 2023 13:44:11 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2E9836B008A; Fri, 5 May 2023 13:44:11 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by kanga.kvack.org (Postfix) with ESMTP id EE35D6B0088 for ; Fri, 5 May 2023 13:44:10 -0400 (EDT) Received: from pps.filterd (m0246627.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 345Hh4h4029134; Fri, 5 May 2023 17:44:10 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=3KyBz6QjokieOxuGt50Z4gigq9psaMvhxNm998CObA4=; b=GDD+mLNirCcGAYlTuRZb5VCmYwv5U26pWcgVsYvLALxo75qp2yGi7UZHX/6qgZeke6Lm aSUebghC97x+GFBVgurkzWnBM4UmMPc+QiGM/b9jAjhGqfAOlyNYhmphzxnqJ/HwViBc J85A3HYuS8U7aCjbhS/q5pbzvGF3fHVtn854NDFw5Wmeqwgn2Y4BaC0fZE12XmdZAKs+ lrYlMlpEsGbEEOwfqOKFisZjvsXOamKXbZ2toxtO4TiikOAnb27tLCbVJt3P5k3+StHd z0XJzU+z9HccazAuVZpm1TRtpP/7bnrXWPJZx1oszVRYtLAb7IB6wFwA0DLsqb9AXBPz 4g== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3q8su1wf4v-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 05 May 2023 17:44:10 +0000 Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 345Fx0fO026877; Fri, 5 May 2023 17:44:09 GMT Received: from nam12-dm6-obe.outbound.protection.outlook.com (mail-dm6nam12lp2174.outbound.protection.outlook.com [104.47.59.174]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3q8spgeyqq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 05 May 2023 17:44:08 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=P+cWwZ2WPVfD4BfHYksS98i6MCpGz9KA3pt9qZKMvsAF+diLR0q/SBi9JYkmbTVW1UY/+Wb9iPsRHoMR9ZXT8mOLT+RumfhpwJY8pjLrFfLozDd+aGKKFtbhsdLJP1dF9pTmYNiaLpaqre5VgW/I740YSZDAzkCt/qDKfpIeC2ztfeMoTUBbizlBm/XCgolD3DFcELVR/rD+DsLaXqPWnXIGuYIA1YmjYeqsEAgIvLQ8ebwKwHtWdELg/NDkgfYMWZ/oOL40XOQ1JLETdlk8KqfaRbUDsmsqqdmxnuJxJjCX0GneLuRMkhM5SYAx0xa40ooWI8iB0gEKLxKlr97xHQ== 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=3KyBz6QjokieOxuGt50Z4gigq9psaMvhxNm998CObA4=; b=AhY4/R1UbSwkfHOHFUcT97s8ozLBosWX8DwIhRWuNsQoIDsdjtvIzg8M0rs6CWzq979UxoT3mvHe8s22MKKYssblXdXJcFrjdMhgsr3d0fQgj9WHbrONASY1KlfrEnfWL6LNQxPej/Q2HzWX6dmCDYaJiMVIzbFhzHT/k8QUYNGSWg7tpDvLKGgjCFa62wHJDKkHH6LRiMIXPKnGh7mvFs4K9QRFmux0KGOoy9RHqQbyB1d5BRm31sb80SHjI+cssFuVunq2T1ogTCZQst2CAKXop7ccXQFBEl3zMWN0LmdASknJzbGbrp86EUc/FyZzBMAgRPW7vpjYP+22bWGVDQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=3KyBz6QjokieOxuGt50Z4gigq9psaMvhxNm998CObA4=; b=UjT/W8z9mdrRJhk2+Ue67KqWM77cpVH07fmda1zOVz7J7yWFtQMZrvIjB5FdtLUOfXkQtqgyaQUHBuHdKt/yfW/2ZIL4D9seHiw9afX2o3spT+O9CQbjO2axksrAUGGoVkeBeWb4+TW7TAhQolUaHlfSz2NVU6agQZDg7VRShpU= Received: from SN6PR10MB3022.namprd10.prod.outlook.com (2603:10b6:805:d8::25) by BL3PR10MB6089.namprd10.prod.outlook.com (2603:10b6:208:3b5::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6363.27; Fri, 5 May 2023 17:44:07 +0000 Received: from SN6PR10MB3022.namprd10.prod.outlook.com ([fe80::8bb9:2bb7:3930:b5da]) by SN6PR10MB3022.namprd10.prod.outlook.com ([fe80::8bb9:2bb7:3930:b5da%7]) with mapi id 15.20.6363.022; Fri, 5 May 2023 17:44:07 +0000 From: "Liam R. Howlett" To: Andrew Morton Cc: maple-tree@lists.infradead.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, "Liam R. Howlett" Subject: [PATCH v2 11/36] maple_tree: Use MAS_BUG_ON() in mas_set_height() Date: Fri, 5 May 2023 13:41:39 -0400 Message-Id: <20230505174204.2665599-12-Liam.Howlett@oracle.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230505174204.2665599-1-Liam.Howlett@oracle.com> References: <20230505174204.2665599-1-Liam.Howlett@oracle.com> X-ClientProxiedBy: YT4PR01CA0364.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:fd::28) To SN6PR10MB3022.namprd10.prod.outlook.com (2603:10b6:805:d8::25) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN6PR10MB3022:EE_|BL3PR10MB6089:EE_ X-MS-Office365-Filtering-Correlation-Id: 6da968de-662b-4611-5c8f-08db4d905338 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 0kLXTBb5imCkbFAvqOL6wLwOGhm6z5Xrr7TxIaF3Zgm6qMHZG9RV+rf32OKe3dDccLOxO+5BkC7nCiLuCJm6LPB7EY/gm89BdEX9CsNJD9rtzsXWnG3IspY4ho0lBzR46DYwCwlwRzYhyTQs7wKtQMx1fwEK00yB9J1Pgj1uTvMScvSYiSUKRh/mtmlYebn3GrwLCgxdb2MqpAqo/EInxQMgiqrWeu75vLPZIe103RTGDGzZmd6KQnqoLcy2Ds3wUpxC4l2pfZgMCCMaylt5BFFhSVE/Pdtm1ypUglFEzVHHJEKCRvmWiEgnflwEsqtu74V26KM1/xf4iNiNjPW9DvqdXsso+CeJQUiPdVXBAh6Fe/yggK04wRDlqMe58Rq87PQW1W2QdYCzyQXDiqqjtslVuPMhiY7XJUnLQ4AcuGVQoUBudyp0qpiLcIABN3f5gukpIVpGdXt/uyN93Abagw7uCLbereJqUkYyovUj+dBXhm5grp0xdWPfPpooO3IUkCKuB9QkNDAXEA3kSKYCVD8RsXohA+t0FyTedNvLqoqgQflN2WT6DSSsGRl7wLjz X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SN6PR10MB3022.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(396003)(346002)(366004)(39860400002)(376002)(136003)(451199021)(66476007)(6916009)(4326008)(66946007)(66556008)(6666004)(478600001)(6486002)(316002)(36756003)(86362001)(83380400001)(107886003)(2616005)(6506007)(1076003)(26005)(6512007)(8936002)(5660300002)(8676002)(2906002)(41300700001)(4744005)(186003)(38100700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: O8nPm0rrboh6KQgEPTirpiKJ5ggGDYWIb0Y3Q/5eIDkWjE+bbW7KCOiXfJC8Se0z1fidLO5L7+wiz1BxpDIcF7wgq4hVPHUdncpT9wKq2rTQjSclJybZQh9uoeMYf6D0wU1V4etKCxv5USf3AKv0EAPHBo4j6wgwoS+Gb+psMPDxldl4C5zt3nXEpmYn4KBMtZmEPtLYj/UAEw9YEgN9aAjxRbyJWO96gXHYGklEzBqzolhzryOJqIgPTaAz8g6SF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Y80EDZrhPN/xZeqrKho5+sS9fcdAtGiHNOXZOFu6iaUjF5/h6cMqiKItJkTp7iBRhJg1wNx7d4VuzpWkraa191bb1Q7yPxDsL1/oHYriRsmpkexfAqvQar154tUdtgREOaNXHlHKayFWNQxwbwTi/03CUio4QKqQy4hAycicwOHhEjvhQ+xL8V9FilxPaXg== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6da968de-662b-4611-5c8f-08db4d905338 X-MS-Exchange-CrossTenant-AuthSource: SN6PR10MB3022.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 May 2023 17:44:07.0807 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: EHx95zKOI0oOjtOBSkuS4bD+Gpw/YlUARHaKdsY7ueUyqePYZp7V5ehk/nbwpSSjR3OOZqmRygnZ79qskZxXoQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL3PR10MB6089 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-05-05_24,2023-05-05_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 bulkscore=0 spamscore=0 mlxlogscore=999 mlxscore=0 adultscore=0 phishscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303200000 definitions=main-2305050146 X-Proofpoint-GUID: gW9Y0Os_QzaDm_JcydKvErszg8FtQ-HX X-Proofpoint-ORIG-GUID: gW9Y0Os_QzaDm_JcydKvErszg8FtQ-HX X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Use MAS_BUG_ON() instead of MT_BUG_ON() to get the maple state information. In the unlikely event of a tree height of > 31, try to increase the probability of useful information being logged. Signed-off-by: Liam R. Howlett --- lib/maple_tree.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/maple_tree.c b/lib/maple_tree.c index a594f1d88d062..da441042ec8ac 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -194,7 +194,7 @@ static void mas_set_height(struct ma_state *mas) unsigned int new_flags = mas->tree->ma_flags; new_flags &= ~MT_FLAGS_HEIGHT_MASK; - MT_BUG_ON(mas->tree, mas->depth > MAPLE_HEIGHT_MAX); + MAS_BUG_ON(mas, mas->depth > MAPLE_HEIGHT_MAX); new_flags |= mas->depth << MT_FLAGS_HEIGHT_OFFSET; mas->tree->ma_flags = new_flags; } From patchwork Fri May 5 17:41:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Liam R. Howlett" X-Patchwork-Id: 13232894 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 018F0C77B7C for ; Fri, 5 May 2023 17:44:16 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2C85D6B007D; Fri, 5 May 2023 13:44:14 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 24B416B0089; Fri, 5 May 2023 13:44:14 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 09D466B008A; Fri, 5 May 2023 13:44:14 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by kanga.kvack.org (Postfix) with ESMTP id D76016B007D for ; Fri, 5 May 2023 13:44:13 -0400 (EDT) Received: from pps.filterd (m0333520.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 345HhL0H031584; Fri, 5 May 2023 17:44:13 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=d6ZJYb7OBgZ8fLZD1qapOKPbyb6wU+xw9GGDQ21f5yA=; b=3iF8LE2YLKxfuIKGgF1GL4OcQVnMJJx99axeD/eV5X89F4sCoIeKzzV7DeStfHu8viqM Zx/fQc1xVEsbq4Stg4gjKG9NeOUe8K7Ex9En74CQtLFhwD76r6nnPfQLDoxTlKlD+tRn eJT1AbPbkccDht2oV5u5I9ihXn3x1gTEIkyDOsEwYMUFDAYhbFjiaOw35N7WGxTPe2VX iFlbrLgHTEAhNB0Z9MBa5ziXHLY3IYztqBD6oLFNL5ihBK9+WlcLhoP1/n1uHwdfRtSw Ze5sChU9u6Mf17rRt0UHH61WYIHvgyFYvU/ZUoPhwE8mST3PAZmd1OxQggMWpq7Ez7br Ww== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3q8u9d5nec-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 05 May 2023 17:44:13 +0000 Received: from pps.filterd (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 345G1jbU020766; Fri, 5 May 2023 17:44:12 GMT Received: from nam12-dm6-obe.outbound.protection.outlook.com (mail-dm6nam12lp2174.outbound.protection.outlook.com [104.47.59.174]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3q8spa5fa9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 05 May 2023 17:44:12 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ao7O8O3xDuZhbRN+hHDl1KDXLzjzM1Q5hKjBmHHOrdXSZREpTn7mXvm0cwXNxDMx8VqNSn2zdbSvTaAqMXnnuqsHkBeP4zzAxCVH/ufLlIF/DCjxoqkjgO94va4elFNbba6R77aLODIaQf87difOz3+lCEQR+S02M+RKjt7nxu9iHb1dH2iYLTYHi32RhFjxWxhZf+Z9YJne5XNIYBusZ+YX1RVXW0NAuDOm5VYnS5lB63Ml+1fWXPvL2Iutv6jKDaMTEsr4k4qPXrsxfYwfY/hkVNyHCBZwzYimI0FOfUeQeMSUynEGUFZa2/x3sZ6iCoo6V39+MZgK3MlSMjV/oQ== 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=d6ZJYb7OBgZ8fLZD1qapOKPbyb6wU+xw9GGDQ21f5yA=; b=B1lh5tg7he94N5YowKDmg/W3w0tcF02zKqbZ2cBaicYe/W3gPX1qkk+8b6xpashH/WYzvmJA/7kp7scTkXzTag9PBjXFITSEKO0XDlsZhxeo8Rr/3qGj6dr1+ap66kcGpP64BwusPDnDdd09We1AlaDzJbk3Btpui0NhxbzZTfQunLa1iMtICFn+sUP83Ipk8acbqk1I0dyJzrkkA1koQ+fn0anCrQYLeNyM4iYV4QMMNjIL6jtw+DsjSigL0iUy8YLKif6uVKpeaCtfg5T+blRPAsny2ZI5D2cofxTNOVsxrWfdj2EGVA0vBmz3eCWHKL+B1DGvN+QQ3nQgsituxg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=d6ZJYb7OBgZ8fLZD1qapOKPbyb6wU+xw9GGDQ21f5yA=; b=XC32+v/n6cQDJJesBuUJCrLnWar2uE2FfiDByIosaY/vkgNZ+Su/xbmQDQN/J8oXCl03WEUIQvXqx9MqDFj90K9r2mWxlL0JAwuJkfgAZVGRs9dxLv3VAoyW4WY1yn0QEMSYFePAE3vWs54M2p96rIrLKGXSnX7YqA3C8AsNiW0= Received: from SN6PR10MB3022.namprd10.prod.outlook.com (2603:10b6:805:d8::25) by BL3PR10MB6089.namprd10.prod.outlook.com (2603:10b6:208:3b5::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6363.27; Fri, 5 May 2023 17:44:10 +0000 Received: from SN6PR10MB3022.namprd10.prod.outlook.com ([fe80::8bb9:2bb7:3930:b5da]) by SN6PR10MB3022.namprd10.prod.outlook.com ([fe80::8bb9:2bb7:3930:b5da%7]) with mapi id 15.20.6363.022; Fri, 5 May 2023 17:44:10 +0000 From: "Liam R. Howlett" To: Andrew Morton Cc: maple-tree@lists.infradead.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, "Liam R. Howlett" Subject: [PATCH v2 12/36] maple_tree: Use MAS_BUG_ON() from mas_topiary_range() Date: Fri, 5 May 2023 13:41:40 -0400 Message-Id: <20230505174204.2665599-13-Liam.Howlett@oracle.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230505174204.2665599-1-Liam.Howlett@oracle.com> References: <20230505174204.2665599-1-Liam.Howlett@oracle.com> X-ClientProxiedBy: YT1PR01CA0083.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:2d::22) To SN6PR10MB3022.namprd10.prod.outlook.com (2603:10b6:805:d8::25) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN6PR10MB3022:EE_|BL3PR10MB6089:EE_ X-MS-Office365-Filtering-Correlation-Id: 6f7a18dc-bc9b-4fb8-2ca5-08db4d9054f6 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 1Jtn4BS+ph1ohbR3TT2hvh7yICIYZp39CrtCg1R/s6UIYsQEuiwQRZ4XCid2cAZcasr4APOnMeMEGt8Vm13z5UrBEvBwfd4xBplMxzbl3e+FlolkG2DWfwa8+4vdWH4B/brWEAoI0QNzNTNaMEEeAY4+dY/x6yZ/yk7un10obTqS4ZEjhvJi+ICFwIE27pAnBbfNrVOvwA6I6NHGt7DqggbvCvnAllPpbXMPyLhYPkhYyaVjUDE38kY47zxLeDgULBDgV/aW0q/S2q3t+SztdXwWFKVQyuptkCQFsQhm/W4193kjuWTT26l8mf847Eu9Xle9m1IePZpf36xeaopsC0Il4/35Vdrtp7aO6GsWZw6FEAFtVj4kDg7J9Mk8ysMrQjfWArheyKlxd+peKYv16xrYR4SDIcxoQJqHvDsPhqwye9QDqg8Y6MtLpmUNnkdfLrees8fD0yf2XThm7NKR7zLiUbCBThwU1oZat8teamM47/qRr/tExrAVpDEaCzL/+A64XLWV0urLzzBj7n6voYqRn5aefCYEkHb1PoeiAXLX5so3DazgHUA/rnF6xjXo X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SN6PR10MB3022.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(396003)(346002)(366004)(39860400002)(376002)(136003)(451199021)(66476007)(6916009)(4326008)(66946007)(66556008)(6666004)(478600001)(6486002)(316002)(36756003)(86362001)(83380400001)(107886003)(2616005)(6506007)(1076003)(26005)(6512007)(8936002)(5660300002)(8676002)(2906002)(41300700001)(4744005)(186003)(38100700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: q6MCUG2NXuc8fNEMncc5ZHZ8vEbXVPE4+XqpTS526zY6J9a65w3DFukpm9wu4qzzQr3cwmJyf/bNMJuFukJSOLOMznS6WIYA9T34wSHzvLzExX5HXNhamVA9ljkK3ZlgwXampXTjlxjdprNz3nl6Nz78vWQxss0mJFV47lnezpeX8jFj7l/gOjVo+m8JXhQr24hc7Qah7+KLMVU+e6bafFOadLg84G6uJe4lnUNCXoYgmG+ljK7ljraRhHcJvgYFnTKI4oQlZ1r8GZ7TRuah11Md/5E4OfXx5AxEth5jOpRQPTH0xe10kxdkBUCeClrG8bpAEXaKkN9uG1D7a0X7r1PnThohIN1ZW7SBlBC+0XaI5wX0Pc4jg3az0Wj3+ucoFdOVMLBYJZ1I4dOB5PqE/VWOVCJ29/FjG9C6zKbxPoLOHdX1WYBxANYXqbUlnVehEjudUE7HazUIylAIdAvVcxgrlNxUZz20uCpOrpG0DyBxcJ0jq7YDvcq3HmMxrsUk2dA54s0+ELa07bkyRNuerLF2MYaKLwhdV7K2otj/nw94hgiQ5+5D1MXsPKS7sNQrRJcxH23BXQg1xfcBG2BtlzzFhVnlnSWirFfbeQvx0AKtByNas1iGB6G65PqzFUAi55e9p6eRvWSeEcHDPiuT7eAG8LfnGcjKSCyMBlGFvRDpK/LmR572VO3yzfzDmVuo/rbEZAaGIAXPt1FqHemUDY12Ad8DOGJ8qynOAm2REzV+mvtjJI7kCdY5KMjKXeZ6Ks7PYgMLpGurJRKNoaBPZcjfPSc7DPk9Qen5vC+yNGEcxmpct/xZljqZuJbeqFHctGHRTC2bfd0RdPXL+FILGmBt6ScbKSa6gGV3akdtp64p+CrkQNbNy2QhdjX/plOtmJcwcY9h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WIFwQ680JZXdUa0shjUjYJ4+ueKMaljWEF1n4J/PSZHI912wERgFEB0s7d/83IdosVcyxhy1gzKBpqSYbUfXVuNCYIvq4wjFfQa8diBNwJZrqToPX153Pbpfcxmx01je0VhmtNK5jJFwPYGltexhVCpqWoiU/gfHiLplpwTxXaK7pZDZttXo7A937XkMAgLv2J7sz5ifvn7QxZdhj/rdrt+8aYk0JGF5ZD8YrqWDPwWnIm5hAqCJ6/U1EiVlX8QzJCrSjBYPabKOuJbUjGnZ+baeV3F9mKF+XsGDJOlH1yvScx+VM6eO+8IE95RYhWvp4IVEEn1ixUp4hG4Uj2xrvmcsoepx3llhHIytUAjvTzaqJ1uzHLDkPKB8gUsK5lmZl7QjFUl2exxLDeRIMyj42slN189vztByJ5ORDtQtljSMEOPWjkASCJuvFFaPN4vSY7gqwecklGkrBXPKt635lN8wGhwV4NyyE/Nk2L3QyRlp6dJeON4EerbJwW6FRvISA/pnRPhE9PVNkkaQZwTdjIC+eOVOoJtImMDv6GQZuoWaymewCk6f1RnxERpD7TOHv7/+kWVWXgyq/eHIidxce9Dc2i0kmHAXWAM13BhtHg3iJPdG5Yetw== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6f7a18dc-bc9b-4fb8-2ca5-08db4d9054f6 X-MS-Exchange-CrossTenant-AuthSource: SN6PR10MB3022.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 May 2023 17:44:10.0225 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 0CsVVBf9UrFAK/Uh+hVhkmfka5BypDZQysjjBdgERmHjQAvmE4JTZWtsyRRcbgD5LQtSgaiPWu7HkRjqgLmIzA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL3PR10MB6089 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-05-05_24,2023-05-05_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 mlxscore=0 spamscore=0 mlxlogscore=999 phishscore=0 malwarescore=0 adultscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303200000 definitions=main-2305050146 X-Proofpoint-GUID: k8_3q9NBZ-H3VTUXg9N74yRvCI0c2oW5 X-Proofpoint-ORIG-GUID: k8_3q9NBZ-H3VTUXg9N74yRvCI0c2oW5 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: In the even of trying to remove data from a leaf node by use of mas_topiary_range(), log the maple state. Signed-off-by: Liam R. Howlett --- lib/maple_tree.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/maple_tree.c b/lib/maple_tree.c index da441042ec8ac..824967872d426 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -2345,7 +2345,8 @@ static inline void mas_topiary_range(struct ma_state *mas, void __rcu **slots; unsigned char offset; - MT_BUG_ON(mas->tree, mte_is_leaf(mas->node)); + MAS_BUG_ON(mas, mte_is_leaf(mas->node)); + slots = ma_slots(mas_mn(mas), mte_node_type(mas->node)); for (offset = start; offset <= end; offset++) { struct maple_enode *enode = mas_slot_locked(mas, slots, offset); From patchwork Fri May 5 17:41:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Liam R. Howlett" X-Patchwork-Id: 13232895 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 26DB3C77B75 for ; Fri, 5 May 2023 17:44:19 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B03CB6B0089; Fri, 5 May 2023 13:44:18 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 9ED0D6B008A; Fri, 5 May 2023 13:44:18 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7F0956B008C; Fri, 5 May 2023 13:44:18 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by kanga.kvack.org (Postfix) with ESMTP id 3BECD6B0089 for ; Fri, 5 May 2023 13:44:18 -0400 (EDT) Received: from pps.filterd (m0333521.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 345Hh6Bb027906; Fri, 5 May 2023 17:44:17 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=fS3QzFuLOtxJjXjPIV+nCtOmoBdMiTTxr1dJoGyuKyc=; b=JHS7b5VTcmxg3kI8kEVsQAC4Ti1h5KVNcZHnG4g9x6Jtoz21LZ22SdikdlT2Ec0svw8m YyCCMT1gBmtk7WMbK0hp9AUYTWds89ihmx1jlyRTA98y/931icU42GOtH8sdVNAaRyvD JmDDatY5lx3lO2eHIU66Duy83u3vNu4zUOWV1DCbn3ZAm2IZoO6dwRR0c/7O1qP2d8Cu cK7Hr3vYATv0qKG4VOF/4kAZ9lAGnP6OLPWiwVAWMacYxllKp9qtq4zBVRT8elGWFNip eW5zFlssBhsxHIrrRNhEvNP3o8BaYTPilxnQXdS7iO0xuGRnInjuwTvfSCukaXpAAtqh Ew== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3q8t5fwf3s-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 05 May 2023 17:44:17 +0000 Received: from pps.filterd (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 345GHB5t020761; Fri, 5 May 2023 17:44:16 GMT Received: from nam12-dm6-obe.outbound.protection.outlook.com (mail-dm6nam12lp2173.outbound.protection.outlook.com [104.47.59.173]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3q8spa5fbr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 05 May 2023 17:44:16 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lcKTlijIpSfzxtY4xlFYqqfczGnV3EEHI3a0kKjjGGIbo5goYdQEwJHo4/ahyJh8wK670VRrDypHnkQWNfedukwWnO+QCu/5/D14BvRnRn8Rp4eCtvZtgMVfIqvVmvM6Q3zhl5XxZ79wIfOhQ4MtkbHs7J+RTTEnAkYtVxMmmwiaq6dD2d1nDv7Mb/CaNmswGPnOnRZwo5hRWI+7W6T/YMxgtIIkWAS+jxSbi9NO9ocrIfGiaWh6xmZDPig7PimNF4uQihCl8BnobK8dNvIzoHb/BSq7KAf5EaFvMySiZq6+g+ibNSLVJn7kpCUouw6fByyKm4TLZLx6qcOctWm5Tw== 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=fS3QzFuLOtxJjXjPIV+nCtOmoBdMiTTxr1dJoGyuKyc=; b=BL53pTWtZ2TQjrSyUHMvwBFsRu4YpMqdFEB7HZcbTheeY9rpa8VQ0JAoOz+JvE+XWciSw9uvkeKl6DJizb1ssI/vVUsdhzQmPZ76DuEf8fh4gslSflanHp5Er+mi4JhkMPxYnClkctNztNVKFs6AT9/GCVrL6JUrSwvO9TBhcUUYZs5TdIE2ISWzJRaPRYb8Z4mt86xOSCPyWdih9S3mFX6gLK4b8FODUGCxLuEhZ3CLV/L3kAM+e04kp7sqXK2uCztVoH0MW6ATIf3tjhA7KAj7LceICjS3Uw6R81oVWXt6BeDVUURL2wSqq0pU6Sh4niNuWS8a/ERvdnh/u0zyUw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=fS3QzFuLOtxJjXjPIV+nCtOmoBdMiTTxr1dJoGyuKyc=; b=oDzev12CfoX9CrqodZqUfUZR+pAHGavHs4HtihNQoeQ0t9LlAbY6taRoflS/2eqn1WBRtdR5ZpgwZBwxddiAEOrs9oKEgQZ8Tn+tBYmbhtgp7cxfr09ZFkWU9sBDUWDVMYiOFGSP4KurDGdOFK0E4NbAHiZ5Cny1NR4KX8TumtM= Received: from SN6PR10MB3022.namprd10.prod.outlook.com (2603:10b6:805:d8::25) by BL3PR10MB6089.namprd10.prod.outlook.com (2603:10b6:208:3b5::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6363.27; Fri, 5 May 2023 17:44:13 +0000 Received: from SN6PR10MB3022.namprd10.prod.outlook.com ([fe80::8bb9:2bb7:3930:b5da]) by SN6PR10MB3022.namprd10.prod.outlook.com ([fe80::8bb9:2bb7:3930:b5da%7]) with mapi id 15.20.6363.022; Fri, 5 May 2023 17:44:13 +0000 From: "Liam R. Howlett" To: Andrew Morton Cc: maple-tree@lists.infradead.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, "Liam R. Howlett" Subject: [PATCH v2 13/36] maple_tree: Use MAS_WR_BUG_ON() in mas_store_prealloc() Date: Fri, 5 May 2023 13:41:41 -0400 Message-Id: <20230505174204.2665599-14-Liam.Howlett@oracle.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230505174204.2665599-1-Liam.Howlett@oracle.com> References: <20230505174204.2665599-1-Liam.Howlett@oracle.com> X-ClientProxiedBy: YT3PR01CA0053.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:82::20) To SN6PR10MB3022.namprd10.prod.outlook.com (2603:10b6:805:d8::25) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN6PR10MB3022:EE_|BL3PR10MB6089:EE_ X-MS-Office365-Filtering-Correlation-Id: f0cb0878-2d0f-4038-bba4-08db4d905715 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: doZ9hF5MoukUp4x0aD7+p7F2zFLmT73DcjH+3apq5YqTyB0TyxC0iNwBsLEhuizFwr4rJ24mfb8FwYhveVOSwZzt6WmbIWMIYYen7sDxkDn+Lrup/V6cK/6/pyT9uB32h5FQgQ4VCv+Nhh1Ytv6DHwcBVTbI7S5358m2+q5uVxeIjuH5hVqnWNK385/6UtLNZ2Ue5mr0koQzBMGJKnubEx2V8Nro2bWjEk3ymTQB98COXRrO/+K1Af9eXgn6RZfMZ1VTzDaKytJpe4s4zdH0bi9IBxDJhoHujrlX7S8wBNIVrBeoxXNeoSRGdEqhioblLy8R1hPzRYfATyptGVEOlULNniiUyi+lJBBuvsiJlp1Ft98C+2LvTTc8qN1pRTMPl0+3tnySOiQ9fmGAYDh0kWBWGKwDoQ8ZPuGQ3AbmCIamAahDKpT462N+yo43gf4pim/XQ6O3AhbWuhUyahxFtKyaI49XPGIrEZBboeDiVaCX2Tr9jPlWTNO2drMIx91pqhyk3ISFL1mKdQlj91/MD35u/Y1nPW2bGKbuVPZPuTUyS8HJ+RfPpDrBkhvBuBKz X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SN6PR10MB3022.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(396003)(346002)(366004)(39860400002)(376002)(136003)(451199021)(66476007)(6916009)(4326008)(66946007)(66556008)(6666004)(478600001)(6486002)(316002)(36756003)(86362001)(83380400001)(107886003)(2616005)(6506007)(1076003)(26005)(6512007)(8936002)(5660300002)(8676002)(2906002)(41300700001)(4744005)(186003)(38100700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: TPM1q+8DzgdB1pFNufba6gWqBwrJH4VCI/C9mJNyHghyJPyiwCWy0CHjoKp6a9fpGsc7xQh2c0PZ6P2zIWPM/3Ge2syZKJqSHtqETuDZfh0/F1HOTa1IFDSKyha5QrfcsNdsQH2x26AqZPQ5A7b5JPG2ditI2EGqRZ2JywnQ3uQi53XIef8Qrnah3QzPwIZhenczqpLdFRSlaKeSd4VM8DZRXU2/XiieUm1qhhVk/0fKGq27ST8mMNwpiLOFbFRAqfXPhuNauUdsspQN4xeuXpPrVgJd9F/jRhmsScMssmCO2QsZw2Z1XmOVwHeFHc0XQp0UUkrnnERwORDib0MGAlLTb39hbIOwxX/r3t4xuDi3yIyctMXAF1F5HdET5Z6AfomnHanShBY+o9MZ9CuJLV98AcgR8ccP7thGGGdAet++j+wraP7+M5iFXOeYrp9F3PWE4ZY+zanQ0fJxoeopH30gUH+9j5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oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: f0cb0878-2d0f-4038-bba4-08db4d905715 X-MS-Exchange-CrossTenant-AuthSource: SN6PR10MB3022.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 May 2023 17:44:13.5932 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: rorvM8ncg8TIBPwTacTbXFmer6WvQa9lZ+6nzf5pAxflbqGlls/IlXtk9PDQZKRCcTXFk1OHHJ067vwZBYrCoQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL3PR10MB6089 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-05-05_24,2023-05-05_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 mlxscore=0 spamscore=0 mlxlogscore=999 phishscore=0 malwarescore=0 adultscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303200000 definitions=main-2305050146 X-Proofpoint-GUID: hU4HFTngmMBmCtnLrJ29gfnmbBSHgVcL X-Proofpoint-ORIG-GUID: hU4HFTngmMBmCtnLrJ29gfnmbBSHgVcL X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: mas_store_prealloc() should never fail, but if it does due to internal tree issues then get as much debug information as possible prior to crashing the kernel. Signed-off-by: Liam R. Howlett --- lib/maple_tree.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/maple_tree.c b/lib/maple_tree.c index 824967872d426..d5ccf7bcf3b5d 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -5761,7 +5761,7 @@ void mas_store_prealloc(struct ma_state *mas, void *entry) mas_wr_store_setup(&wr_mas); trace_ma_write(__func__, mas, 0, entry); mas_wr_store_entry(&wr_mas); - BUG_ON(mas_is_err(mas)); + MAS_WR_BUG_ON(&wr_mas, mas_is_err(mas)); mas_destroy(mas); } EXPORT_SYMBOL_GPL(mas_store_prealloc); From patchwork Fri May 5 17:41:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Liam R. Howlett" X-Patchwork-Id: 13232896 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0DF87C77B7F for ; Fri, 5 May 2023 17:44:21 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9C65A6B008A; Fri, 5 May 2023 13:44:20 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 983BD6B008C; Fri, 5 May 2023 13:44:20 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7A3366B0092; Fri, 5 May 2023 13:44:20 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by kanga.kvack.org (Postfix) with ESMTP id 4DB956B008A for ; Fri, 5 May 2023 13:44:20 -0400 (EDT) Received: from pps.filterd (m0246630.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 345HhMLS014811; Fri, 5 May 2023 17:44:20 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=9yNU9HJW6liJ2fUnwkIAF9WIpSr2/rxcoMxVBhqd718=; b=11n+ziE2wH30vCc5YSng/swz2aTw6+RJqOx/euoewRe2PUYlKDmWJhWU/V5UiUvhz7dT w/+40Us/+/Qhb/JbBfi72AeeR+AQ403Kg8JcVvGp+uLHCTAV3GzKaImcS9P+Stzhvxtj Pn5p1tAeb4JxMhiXT1QYpeP8MwM/sOJp3dWmcKVZu43ZRqkTmiJvDZD0dcOaf2b48ls4 Ygvl3Gmlc1jDjSM9d5tWez7pUC8kd31Fc7prJNQdopO1e/Bmw47fngg/JoF/+SP5kUc+ bmR5fdzKqwC3XLPYdUqa044ft+Q+mf+ySWP021h9tPEL1fs5QfidbVrvNJbKYTq2Rdow nA== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3q8sneddyb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 05 May 2023 17:44:19 +0000 Received: from pps.filterd (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 345G9u6i010002; Fri, 5 May 2023 17:44:18 GMT Received: from outbound.mail.protection.outlook.com (mail-dm6nam12lp2174.outbound.protection.outlook.com [104.47.59.174]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3q8spank55-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 05 May 2023 17:44:18 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EPvINDff1hO3LsvcAq0BJ/ZjxWeft/31uVAGGEZlZLkiotIsnnJOFaM29TVvt7tVTWlMu8nz8E9UP6BIejf9/IGSZ3PJWmKfm7oW5NdfxSyEoCZR4ASbnb4kRKZ9tKqot6Zg9cpZ3fqAnWPSqOL0ULL9TMQuhD8RlLutcgeuMbjJBgZI5Ly3V+oJSDXgxbBuwlXgVfalyLE51A2qkC82S6638wXALmJ5Zm6PdgrGujbfeC2HpuzrHbfEyofVJ/WTykW/n+NBbLZG7AhF876tHR+z4nyK3nViRJUJ5ouldmA8csC1asMajm3dPOTIFVcpt2HKKXV1ouU6e0NbCwS6bA== 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=9yNU9HJW6liJ2fUnwkIAF9WIpSr2/rxcoMxVBhqd718=; b=X9/66fMZ8TOU4CF/Owb7cGWBvAg9bd4r5lMvnfTCfowc+SJdkaSb6bsJOCiIQGQtcXO7Und47vSgPHwS00YeEOFdXXDXTpWlcwiD2Vg1C3ZZzRRcn73shqaX9dCB23/wD6AdpyY+4GWqAtYvbdbV0U0PVbgFL3lMpJtVh02Rlrxhral+HxvSc/NmQW9H4Wu36vJA4Oydmshz5NUtR9quBiDEGHgnUpXmFLWW9oDSO3ac2ygVq3utkdDff4/CPxK1fVqnPxIQ0y7ArZdkP+bF1eYLr8dfjEhudVCK5nR3iT23n2QZTORw+iv1SPm/94q+Qxg/Kp7973Uh9Yvc4eXvGw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=9yNU9HJW6liJ2fUnwkIAF9WIpSr2/rxcoMxVBhqd718=; b=BBQDQ1M+8676PLd9kZXtJWGV2AKdzmGvpMeNbT7ZZgAjx0g3KOhS159eAH/fTK6d8uZsfpkbQbZRgvqL2qEa/vCC0ElqnrEX5s3AyJmlP/p2w3wjZUYH1Nbxabfs3KyqLOasEGq9zB7Eko1VTaZf/mlC8esINL2XswpAeMN0f8s= Received: from SN6PR10MB3022.namprd10.prod.outlook.com (2603:10b6:805:d8::25) by BL3PR10MB6089.namprd10.prod.outlook.com (2603:10b6:208:3b5::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6363.27; Fri, 5 May 2023 17:44:16 +0000 Received: from SN6PR10MB3022.namprd10.prod.outlook.com ([fe80::8bb9:2bb7:3930:b5da]) by SN6PR10MB3022.namprd10.prod.outlook.com ([fe80::8bb9:2bb7:3930:b5da%7]) with mapi id 15.20.6363.022; Fri, 5 May 2023 17:44:15 +0000 From: "Liam R. Howlett" To: Andrew Morton Cc: maple-tree@lists.infradead.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, "Liam R. Howlett" Subject: [PATCH v2 14/36] maple_tree: Use MAS_BUG_ON() prior to calling mas_meta_gap() Date: Fri, 5 May 2023 13:41:42 -0400 Message-Id: <20230505174204.2665599-15-Liam.Howlett@oracle.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230505174204.2665599-1-Liam.Howlett@oracle.com> References: <20230505174204.2665599-1-Liam.Howlett@oracle.com> X-ClientProxiedBy: YT3PR01CA0060.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:82::18) To SN6PR10MB3022.namprd10.prod.outlook.com (2603:10b6:805:d8::25) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN6PR10MB3022:EE_|BL3PR10MB6089:EE_ X-MS-Office365-Filtering-Correlation-Id: 05e3a9bc-75a5-48fd-8120-08db4d905844 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 8hQlCXgIbryg4d8HvtLVWFrkl9HJalHWWSLRs7dyUhtaVdSVW6Dm2cSIr6z0DLmpViKMmqw3NzIi/rfZSak+Av3Exg1osWTM/w430cEfz6tVV+HxRlGPOYo2tQyEfFNk3zvs5QZfPgHe6ykb+tal7serAjLXjtL+SHuiswOtNc3QcMreByQwhHfCJR8dbeA3N3xqqcm6tXdjiWtvg+kqlr2xd8G5IGI6JyJo8RYv840oB+TS6IkZfcJDO36+fPpvWsY9mbLExiauCI/R7cp4VY2M8gQh9cAeaqSv7pWdcL+yAq4/DJA7kh27gB6PzWonWR4OABFwnUngL4Pt4K9p50KpbtHIkRP6rTeAhn+pJOugwwholfr6Ik2+S9ZoNyzabWxcIbasvpLl+Wl4Gy9mUU92ECFNEMn4x1ywOmngXboSIHqR+6GtWimx8kse/iu1stTNnUrWAUn4ruWtQelCRPArwUwpLexU3xaKL7P70THqcm6w5PRjrR6d/0m64kLB5ukZV4Vr2cb0bXKl0+7cCjXZFhhS96qZRD0ESpjBaS59Oc7vwbbWa+71WBvPw8Ik X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SN6PR10MB3022.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(396003)(346002)(366004)(39860400002)(376002)(136003)(451199021)(66476007)(6916009)(4326008)(66946007)(66556008)(6666004)(478600001)(6486002)(316002)(36756003)(86362001)(83380400001)(107886003)(2616005)(6506007)(1076003)(26005)(6512007)(8936002)(5660300002)(8676002)(2906002)(41300700001)(186003)(38100700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: XDcEqYMvMOkS1fXe2NKaCvTjITJpU27ftwNnEjJOmKrian0AECLfo3iduKdj5afx7ss/4Uy/Id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pFjFoWAHm79kTbX40pR0wVedSQkWAaPwV63F4Y+8lH1d/gBb/gtxgly+Tbm/F6V+l0ewAAkMl37BWC3N+2XRzyenhFtV2vyDnoyqEzr9zwCXvgWndvOJIEyhiqmlFCJnrpADzAEIkIDUb595mREZq3UCPiIsFWDmyZ+sEyzJBW+AxoqDo7JNSU09n6V6wCP98pnZsMw0Vd/9Q6QRMvV3OJfRmRWlJFosIXVIwerbQTDgXvmLY8bkpwTMAJGpxiixnzqHpaQ9wodes2s7zKLyxrx6RTBBwiwgHWCgxUz+65Jq9v9ONthobM5FMx09l9kYSkBgttrRBZo20Vafz4ew49M29iVvs4QR9aXyB1zoFymn2aDlig== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 05e3a9bc-75a5-48fd-8120-08db4d905844 X-MS-Exchange-CrossTenant-AuthSource: SN6PR10MB3022.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 May 2023 17:44:15.5963 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: bjNd+dQ7lh0usRIMzjjQNgbfIW0hUBiyIeXz+W7HIBrWjsJepvD/APeqmkcecVQdqvokyHq48pOhTfxgGrrzRQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL3PR10MB6089 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-05-05_24,2023-05-05_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 phishscore=0 spamscore=0 mlxlogscore=999 bulkscore=0 suspectscore=0 mlxscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303200000 definitions=main-2305050146 X-Proofpoint-GUID: cP8GtmiRcDCrQNxIQs5lLM3gySqSZnmt X-Proofpoint-ORIG-GUID: cP8GtmiRcDCrQNxIQs5lLM3gySqSZnmt X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Replace the call to BUG_ON() in mas_meta_gap() with calls before the function call MAS_BUG_ON() to get more information on error condition. Signed-off-by: Liam R. Howlett --- lib/maple_tree.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/maple_tree.c b/lib/maple_tree.c index d5ccf7bcf3b5d..d7809a7000c58 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -963,8 +963,6 @@ static inline unsigned char ma_meta_end(struct maple_node *mn, static inline unsigned char ma_meta_gap(struct maple_node *mn, enum maple_type mt) { - BUG_ON(mt != maple_arange_64); - return mn->ma64.meta.gap; } @@ -1628,6 +1626,7 @@ static inline unsigned long mas_max_gap(struct ma_state *mas) return mas_leaf_max_gap(mas); node = mas_mn(mas); + MAS_BUG_ON(mas, mt != maple_arange_64); offset = ma_meta_gap(node, mt); if (offset == MAPLE_ARANGE64_META_MAX) return 0; @@ -1661,6 +1660,7 @@ static inline void mas_parent_gap(struct ma_state *mas, unsigned char offset, pgaps = ma_gaps(pnode, pmt); ascend: + MAS_BUG_ON(mas, pmt != maple_arange_64); meta_offset = ma_meta_gap(pnode, pmt); if (meta_offset == MAPLE_ARANGE64_META_MAX) meta_gap = 0; From patchwork Fri May 5 17:41:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Liam R. Howlett" X-Patchwork-Id: 13232901 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id B62A5C77B7F for ; Fri, 5 May 2023 17:44:38 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 580986B0072; Fri, 5 May 2023 13:44:38 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 530F9900002; Fri, 5 May 2023 13:44:38 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3D1FB6B0096; Fri, 5 May 2023 13:44:38 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by kanga.kvack.org (Postfix) with ESMTP id 0C1676B0072 for ; Fri, 5 May 2023 13:44:37 -0400 (EDT) Received: from pps.filterd (m0333521.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 345HhN2c028545; Fri, 5 May 2023 17:44:21 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=zUoTYTMCkwTw/+6/qqWbswBoxi9E+3/SfiPHa6ic8us=; b=S6+J16g5TMCmzs2AmWW1GYcdLtZPGyPGWv8T1pG7nc+BZcW1lmcrNZxD09oYly8M70cV FbJQ5L+0B8AYg2h+bHvOfEU2GqoXfWOqlb3igZcytjWtnEVsUp0YRvcFza3PJku2QZ7Q 66VqNuGok2FRMLuHt4zqBeSGNlPXEF9wR9T0WeAwrSc31y92QYVp0Ia7waUsIslVk1tE 7vc1LGP/kszdy5xhhrLM5nhyLmzyMJ/0Lqm9dqgG9L3IBGpcQE4pivHzICs0J8+DdiTQ gMN4eCHu08uPp0H6XvU/wOYlNkbJdNiU2/aRysgJdHXh8pW+wy9IUpJmehwfTLEFI9WL vg== Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3q8t5fwf3x-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 05 May 2023 17:44:21 +0000 Received: from pps.filterd (phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 345He9ff024982; Fri, 5 May 2023 17:44:20 GMT Received: from nam12-dm6-obe.outbound.protection.outlook.com (mail-dm6nam12lp2172.outbound.protection.outlook.com [104.47.59.172]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3q8spacjak-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 05 May 2023 17:44:20 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=n3MaMAOFC4V1gilFGPXY/lPcB6TdZPV3EO0krjrGdxPepCfP3lXBFwnYXo2v89L76jBplkSARfISuvDozkVnsV7qmizNguj8rDH6I5KfFmXKOPXuAZ1H5yJsr0AZevikqvFYvTvxxm8uV5SuUqMt7hKb0GpJEdSQGZYzUB2qdw0lWivelO+g/DI2Lf4ccEKMuIBpa9xWwV/dXbRSzDOfgbL73vV6/bPEtnUWMIeZdNjYSQIEWqeKPhvZryX0WzhntYj90x4Dj3PXmmMCO+Wa331HSDSdrwA6BuIRducVWDnJMkbtu7h8l9d/hZzfLxgeRdO2XJ3fj42X8SA+G5aXEA== 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=zUoTYTMCkwTw/+6/qqWbswBoxi9E+3/SfiPHa6ic8us=; b=oAnmGBF2Q1TwdV7e7a9MjaFfOTxuq0sc1IOu3JsQ59h6m1EIoFGy6HN4dubcNlapyGumVhJ4+Huwm2scOVLGnE9tchznghX+4Ba+LdWeFxt5RlQ8NlNFZ6HjlPWea9uASG4uM2iZ3BrKrxgbfxHM5y2Vip+nn0d5MCqzrglqKidztkUNe+IjTCD7juMDqKqCSh+z3C8pCOmubjAKt+qOtjw8nt6gWIUWIHvvQ9ggOpWAnNATcnQDJijPDyT8SzveyTxI1WOE8Pl8s/t+3L9VvZgB6vXJUz2p2hOpxOPJux0Qf9QG+pfPJ0TX5a3LCjdQuc//WxPoUZkzGBqtrN3ajg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=zUoTYTMCkwTw/+6/qqWbswBoxi9E+3/SfiPHa6ic8us=; b=wXwrk+1HRcfHv82kgfHWVmyaE1RZ69AQC6amJZZZ1CEkRqn94JsWFswsCB/NR6BHvV/bSlz8dyaL1e6Q3s7w7tMbxL9QRQjG/4zKZhFJE5AUH2OMJOaM5/7XV8R1uShvMG3/g7nUmorvZjYVTX4KuC7t+UzukKy2+xiag1Icpbw= Received: from SN6PR10MB3022.namprd10.prod.outlook.com (2603:10b6:805:d8::25) by BL3PR10MB6089.namprd10.prod.outlook.com (2603:10b6:208:3b5::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6363.27; Fri, 5 May 2023 17:44:18 +0000 Received: from SN6PR10MB3022.namprd10.prod.outlook.com ([fe80::8bb9:2bb7:3930:b5da]) by SN6PR10MB3022.namprd10.prod.outlook.com ([fe80::8bb9:2bb7:3930:b5da%7]) with mapi id 15.20.6363.022; Fri, 5 May 2023 17:44:18 +0000 From: "Liam R. Howlett" To: Andrew Morton Cc: maple-tree@lists.infradead.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, "Liam R. Howlett" , Peng Zhang Subject: [PATCH v2 15/36] maple_tree: Return error on mte_pivots() out of range Date: Fri, 5 May 2023 13:41:43 -0400 Message-Id: <20230505174204.2665599-16-Liam.Howlett@oracle.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230505174204.2665599-1-Liam.Howlett@oracle.com> References: <20230505174204.2665599-1-Liam.Howlett@oracle.com> X-ClientProxiedBy: YT3PR01CA0037.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:82::14) To SN6PR10MB3022.namprd10.prod.outlook.com (2603:10b6:805:d8::25) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN6PR10MB3022:EE_|BL3PR10MB6089:EE_ X-MS-Office365-Filtering-Correlation-Id: 839cb527-22d8-4cc8-b394-08db4d905a04 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: wyI4o3WoxFdD8Y7MScXDJYl+KOPVh0NtpmgaPcV2XZCKLobFz6t8Opd/ewo6bZTgrUt0tGxHbhuNFUQlQxgz9uideDdqVPFxII8vr3sLcyJjKbzQdCTG6H2Bl4ocEUmYU+aT+Z3OwEv83jfkOsPvCegk74xkeIMKIuEq0N8UvUT9UtPINV/g1cMSqt5p/p6NzTsTkLvp6yh+HKgCINz/MFexe7ms2qP0Jdr1pE/AmC/XLFsL61pTXb3d+1/YYLko75X2+26cDD5asrHFTkjuwKS/uEVaTLz9bgqpInrWyVMoHpxMDU0RoFtnhCuUddi9hcN6lMlVU8oyZVg/7QBv/vK0ykbstM6reQLNfc686Qzy8/0JA3R2wamq+lYateSiI99jqKS4ATXM1jI1cz7c6vlsQtvtH0Ga1epwgxy7/oSNnivj/X0arIW0rYb4NIRK5BrTWvkylv4pFxRj55Z2QGmPDDiVSOI2ogdXlSsMmcP0eekjPkazgR7JIJmwbUSGSQaVt4/zLOeoS0SRihti5qLxq3uANpfDFOnlMEDz+ET85OmkKlk57ZZ+Eh8D9n6o X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SN6PR10MB3022.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(396003)(346002)(366004)(39860400002)(376002)(136003)(451199021)(66476007)(6916009)(4326008)(66946007)(66556008)(6666004)(478600001)(6486002)(316002)(54906003)(36756003)(86362001)(83380400001)(2616005)(6506007)(1076003)(26005)(6512007)(8936002)(5660300002)(8676002)(2906002)(41300700001)(186003)(38100700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 3GgGhjxTWnxArczJ3BnSuuiAN4y9go7LZbY0upkf+gVirYXiF4nId+UVPWSO94PHlHX+zbWbnHWGxxEvDvILzC/nK2TOhuego9Uk5uH8XSLXjx/AhKKfq4bKb41vpXZqwphdn2jFaLyb4iomvxz3pIsAjoy0djTsSytQIeOPOlTjUhUQYovtlTbdjPyQE5brzUIMVfw4nVenX4lRXFPHxs6Ne+AKpLtlW/rJlSScFvfeC+w1p54K0WJVTZaHSpB06/CUtnQoS0jW40ww3r/ARg21Lh+pirEQa201shfFCpGyOfzFeRrzljXuSAxfuhmH+L/EoghwoSLnGGB5OTYeNRRjzqCIKE9IL3VpJpAXAg0bXWggPgE/BColAwhDe40SdTJ2Z+3OX0cGFO3+K3YDZ1U1wct8XmTrvv6inoqLy03rnWk9iwVj30Xotf9kmpGP99WYi+BmiWduk4vj6KyM1sXf3/tcIgwksxg5Guk/EQEvCpaFiaPZl8ST1hero4MU9AwF+xwLOEBFF1kTAQ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6PQK1m7hrowzQXQ0mT5WPbw== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: HgsV0Hurf5gVcIBGcPnOsgcLhEYCxrvekhlpyLJikzUa39lGkemjp4+adaxcPA/4AbnfjLP4CsHWFvT9X6YSL7nnCj0gqKL9F0EDQmPt6P1QRqNOQv135gMyG9+w0LOzBl1ZAdJMcjRdn5387VFa1EjPrl3IFmtNpQChV40kMnpRPVtha3U1lWDLnERUYiRBPQXhO6nzST6+iLnfJ969P2yYLQkE09+KlFCegPzDj30f5xHemWYOznsx4kXFeOHMx/81bbGDbYD7Cq8OVIwzzD5HdWyKf4y8irwEwrHZGM88F59W67ZNCpysYxDJBXm+xZhPHqfYjNxpccOPJL4VEGUQYsYvF+CS2waXQheiQvRzJo2oaBtwfXOtAENPCdmzARcxUcZ64DQCRAvsbpURZouhVOLYt67NdqAFRb0JicEZESNkdGM0NEy94O+4wrmK2va3P55GtQtENHmPf8DNePAHtVzbPlif0f+vR6cIjt8qNKmAUc8Z5EmJxy7nxsdntjxeAiAiwNUl71yL7LfSZOngz0RtH4h5+ihFqrSJAiMfRThKK898IVKNPhM5o6f0e+UpPl7T63EzwjahOzRsAEoWVT2e3olrsoO1BEi07UbGJEcVdqDbv1upzjp+4SK2ZOC9T9PnBfK43ecwCdP+crfGlQDdMMoOZBmBLgBgWCo4IvM3EmtVVqJtFWdXapdV2450JTZzspIYM4+WZ03Uge/ERwXx3VjVn7f+Df9WJQbyDibumuRTdBEpoYzFawSPGOatmsF/SFCaaYKx2913rZ98d4dK9jr4rpiNO1c4Sv1ASTXr5gKlVW1ZEN7/HFNJwP+ktLxPDVOK6SZ5PyNxmt7KCWSd2T0nYHP2RMA8P92O1TJufk58MplJacd6fdJCRK6Lzsv4ww1jVC9bYdMGg8vhHtAtTBp4oV9Tts1+3GTFIyhi9E0tD21elt776uED X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 839cb527-22d8-4cc8-b394-08db4d905a04 X-MS-Exchange-CrossTenant-AuthSource: SN6PR10MB3022.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 May 2023 17:44:18.5093 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: LKizUnttVTJFJjckjIQIzSqfyc/G3oFIUzzMB0zNeqCnJDUaCRCRQOd3bzrCfs+bJRbbCGkg5BQgRUmfHNKrWw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL3PR10MB6089 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-05-05_24,2023-05-05_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 mlxlogscore=999 spamscore=0 phishscore=0 adultscore=0 mlxscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303200000 definitions=main-2305050146 X-Proofpoint-GUID: Sf1wnS3f9QUWX7JseDho1HaWH8LxLdhk X-Proofpoint-ORIG-GUID: Sf1wnS3f9QUWX7JseDho1HaWH8LxLdhk X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Rename mte_pivots() to mas_pivots() and pass through the ma_state to set the error code to -EIO when the offset is out of range for the node type. Change the WARN_ON() to MAS_WARN_ON() to log the maple state. Signed-off-by: Liam R. Howlett Reviewed-by: Peng Zhang --- lib/maple_tree.c | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/lib/maple_tree.c b/lib/maple_tree.c index d7809a7000c58..9f3784f4a5b7c 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -663,22 +663,22 @@ static inline unsigned long *ma_gaps(struct maple_node *node, } /* - * mte_pivot() - Get the pivot at @piv of the maple encoded node. - * @mn: The maple encoded node. + * mas_pivot() - Get the pivot at @piv of the maple encoded node. + * @mas: The maple state. * @piv: The pivot. * * Return: the pivot at @piv of @mn. */ -static inline unsigned long mte_pivot(const struct maple_enode *mn, - unsigned char piv) +static inline unsigned long mas_pivot(struct ma_state *mas, unsigned char piv) { - struct maple_node *node = mte_to_node(mn); - enum maple_type type = mte_node_type(mn); + struct maple_node *node = mas_mn(mas); + enum maple_type type = mte_node_type(mas->node); - if (piv >= mt_pivots[type]) { - WARN_ON(1); + if (MAS_WARN_ON(mas, piv >= mt_pivots[type])) { + mas_set_err(mas, -EIO); return 0; } + switch (type) { case maple_arange_64: return node->ma64.pivot[piv]; @@ -5399,8 +5399,8 @@ static inline int mas_alloc(struct ma_state *mas, void *entry, return xa_err(mas->node); if (!mas->index) - return mte_pivot(mas->node, 0); - return mte_pivot(mas->node, 1); + return mas_pivot(mas, 0); + return mas_pivot(mas, 1); } /* Must be walking a tree. */ @@ -5417,7 +5417,10 @@ static inline int mas_alloc(struct ma_state *mas, void *entry, */ min = mas->min; if (mas->offset) - min = mte_pivot(mas->node, mas->offset - 1) + 1; + min = mas_pivot(mas, mas->offset - 1) + 1; + + if (mas_is_err(mas)) + return xa_err(mas->node); if (mas->index < min) mas->index = min; From patchwork Fri May 5 17:41:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Liam R. Howlett" X-Patchwork-Id: 13232897 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 34F0AC77B7C for ; Fri, 5 May 2023 17:44:25 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C5E086B008C; Fri, 5 May 2023 13:44:24 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C0ED36B0093; Fri, 5 May 2023 13:44:24 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A87DF6B0095; Fri, 5 May 2023 13:44:24 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by kanga.kvack.org (Postfix) with ESMTP id 884306B008C for ; Fri, 5 May 2023 13:44:24 -0400 (EDT) Received: from pps.filterd (m0246632.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 345HhOrn003090; Fri, 5 May 2023 17:44:24 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=vsLFD4dVDOFW21XGcSvKmJrAPSFOY+0Jw3IhJz6RmFw=; b=svqagWH6hJ7v01xGAAPpo/MCfbtDqoa8lfcsEgAJaDiyH9Ncj3K1n/VcfXn3DpjMhM88 0QcwTcY8E1sxbwqHYEc5N+btfN0SBmxUpoclK4ACcpUe6tcKNvXxzTPRMH/gj0Wg5UCT f5zKIyhRCgjbKctyERo5C1SAv3EftiRwJiBtwAep4s1K+mj7Bmc76KRhDhPgoyV19GRZ AghxW9cDO8IIT0pC+1FpTW4Fv/Xb8byKfieflc0sfacc5rkOtnMPcWNSn/910RySSmeh HDgIV7Uig8j/LFXhvSF0otKM+ULVC1AH/GfHym8W7xY5/pDnpDV/Hik2+wyWozNx/HQ7 4A== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3qburgdkd2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 05 May 2023 17:44:23 +0000 Received: from pps.filterd (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 345G9u6k010002; Fri, 5 May 2023 17:44:23 GMT Received: from nam12-dm6-obe.outbound.protection.outlook.com (mail-dm6nam12lp2174.outbound.protection.outlook.com [104.47.59.174]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3q8spank6u-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 05 May 2023 17:44:23 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ILGJ9SeYCsKbRPQDym99yPwkmBY6yx/PAIRgkb6fjxbHNB4bIqGJ0kSAcAUJ7gGQUUe9tcmrhlcug5xIcg8mJmV97G0rBs2Rr8Nf0rLSzYGYQeWinzdBxOcgEU9Vw37IIliPEFOxM98N3LOlxaho0VOsv6/id4biiZmMoOy+dKrmmtwPwauYiud/2fSR2H5JG/aouSeufNzcGTSP0gtJRKMo5jZx5kGDpKaoQtsDtzJwVFlHDmz3B7GXPbQdrR8etFHrrW7EHH9ILJ22JapTAsQHT10846s2ALagGHQ6EVNBnnplhuZAXn/7EEG47Q8FhK0dFsRMBmxNT9ZPUGROCA== 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=vsLFD4dVDOFW21XGcSvKmJrAPSFOY+0Jw3IhJz6RmFw=; b=Gwmmkq7rRdeWHTzWTIPJAOBxAqIHIItuQUJ0LurHJ8Uvu+Psg4vFCg/3G+AE3mNcEMqTVdMe62/uWvdrayGu1o2lCb8XVRSXeiBK5xhCnW45hbuJN2bny4nGadoHhhmkYaGE3Gkcn/DUcfmDd+IvX3kxQFScePRliofyOUBbSGazIYdLei9JSBM8n/Pp8J3y97ft3gxJA4yeY0obMmU29hsxqmDu/orjeZ2aRqu6a4kM0Smn3IvULazE2vrJxoecAcZxAfTceWha/hfJvKQmLqQl5ItVHL7JcEz46HNcomfXWxKjkZosl02eQYAZnXapo54LRoh4ZED24Pc8Yv+KQg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=vsLFD4dVDOFW21XGcSvKmJrAPSFOY+0Jw3IhJz6RmFw=; b=bsXDo//RRxsMqdDlpj73arzSEW+s/Q5LaRn8zgBLCMPEXiJy4ge5yQx5ISmOHhkjPAgdsqn4oMRl/k+3TdWnMZymfnpb2eymcO+oN+mCfXW0crLH+wXtIUpFo2lq5bzdabVXM25wMQr24ReulOZ+q+3Us3p7pT7RihXSUlNyEps= Received: from SN6PR10MB3022.namprd10.prod.outlook.com (2603:10b6:805:d8::25) by BL3PR10MB6089.namprd10.prod.outlook.com (2603:10b6:208:3b5::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6363.27; Fri, 5 May 2023 17:44:21 +0000 Received: from SN6PR10MB3022.namprd10.prod.outlook.com ([fe80::8bb9:2bb7:3930:b5da]) by SN6PR10MB3022.namprd10.prod.outlook.com ([fe80::8bb9:2bb7:3930:b5da%7]) with mapi id 15.20.6363.022; Fri, 5 May 2023 17:44:20 +0000 From: "Liam R. Howlett" To: Andrew Morton Cc: maple-tree@lists.infradead.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, "Liam R. Howlett" Subject: [PATCH v2 16/36] maple_tree: Make test code work without debug enabled Date: Fri, 5 May 2023 13:41:44 -0400 Message-Id: <20230505174204.2665599-17-Liam.Howlett@oracle.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230505174204.2665599-1-Liam.Howlett@oracle.com> References: <20230505174204.2665599-1-Liam.Howlett@oracle.com> X-ClientProxiedBy: YT3PR01CA0063.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:84::28) To SN6PR10MB3022.namprd10.prod.outlook.com (2603:10b6:805:d8::25) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN6PR10MB3022:EE_|BL3PR10MB6089:EE_ X-MS-Office365-Filtering-Correlation-Id: 2670660a-b603-48b2-7531-08db4d905b71 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: G8TGdmnkzIRsSFNkPqJNGpVn0bfO+k/vgQ8jnY3vbZu3QUOIeQxLloZuu56dA1UUCnpDhg/3M1jcy4Hl3Wy4AdnDcEISQzRdApPvHKmHVdVyOaWXzggrn1SzUmGw+RVhUclK2YCooSajirrCbv6Fiffes3HKRpisHIPsWWDsNhPXi7+zGQMDmGTJCq+4xUj4tJPCGbthSHXlffnARk72IFN/eoePMesmDTVmmBZudbF6HOvPEkh/S3ZdYfO2vi77FtTG069nkc85Tt92UEzPhyQkBzh9hHZSEBdKQpaRPfINbgzUlPu8lzY8d1wk6fg0E9w68YRRCVacAqhvqhx2u1nuyx7hHPyASeqWXZa2Ry8lBaVzq8MfC04imsb8ADSfKBrrvXSh+kyiEwOehIAr+WN+9uBhiXkNG2E/svbLqblVV5bOcGl60dGZIR6+nkDbJuUpUXEWG2EGqWv9Yf6XQ6w+Fbd6nLfeLxkuBKw7xBjTuPZnKfCECc4esXXgVAG7NpVfkQGBA7yfzDjjO3SWtjjeu+r5fadwNPRcgKZ/a42RWKO5KGOxj0OK8J3sjkGW X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SN6PR10MB3022.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(396003)(346002)(366004)(39860400002)(376002)(136003)(451199021)(66476007)(6916009)(4326008)(66946007)(66556008)(6666004)(478600001)(6486002)(316002)(36756003)(86362001)(83380400001)(107886003)(2616005)(6506007)(1076003)(26005)(6512007)(8936002)(5660300002)(8676002)(2906002)(41300700001)(186003)(38100700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: c2MOHj8wuPtnb6hy4CQ0Xf82O6ZqmJ9XJghZitue/6GYV3EfTt7aeVcERLU2FYDa1SE0ek8GiekrcV5SVKfBbYSsdwzzOVtKzlyFqpzys5sYvvCG3GGDeCsBPFuscM9Bq+v8s+TUNGTsOGnDgwIFGUsW2yz4hPSd6ZOb109K3oP0MGMHSa9wQXN0me9csIssxaT5WdZD0DmdgpFvuuhPe7fW+jxAUprFZU+1uP1aJQR699QL+J8Hfh7II2eBfC84vXuOz7TR9TM709cxrmMy1LfjFPoCavbcfUPwF43QhqP6gBCBpSEdxwPWQx99dfb97dLiQOuuMsyCrYYkvKhvKDBHLt4g7TZOocFi3DZvlpb4BuPqvRJkv7RuL3xQUtp7U2poQW+5hYpaGSoiJdJRCLHINqiX6N6vQvzUttl+fPvlyqUYTyqfPmB/aABexoRP6tIWAovTdr0B7UEUXTwMgC1fAUkrGx+NlO4eZ01wanTDbV8xQIfCVALpAVfx+hCDyoZWx0kEOg8e+a95F56WLIG5+3xxutqd3PU3Eadya4/BnUQsI8P2JNSux3K7BYMKp7Y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ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: zBRyU4HVJjiXzmA5Rj5NNDApjMgvjWETgWJwtn1J0WXHGP7h6TNbIpvxpMI1VR5kpLBnjbvItfdQbaCkvURiHQgmC2JSK8xc9A8hpWOD8kyqCZ+/wKaUVT15TLwNFyVD5VwFjn4h50LP5tgKCIq8kxdVsNEK88n3i4Uig2tHOKqt5caGcwnqxaHMCwkgltq3RZY8NERryf2a0havd5YvNgdPkImYyF0ZbrXxfbiO9njQyDqk3iQV0pF2J4Xs0NcLaQPJPa5LlnzM9VHOujV9LQxO1qVoHZjkj/F5Kx8+6u7j1sDJImcXn3U8qZUEzx3kH5dHyZfFDGDh4qEh1XD30LiOnBwURPuZ8430CVz+tzdJcOHuvHXWId3PKb4i4RJ4Hia5Wn+ptVN7GFW40EdBjVnMl3+0P2hw9LLa93OrfS7quaxjLVL+dGW7++z9kCo27K6y2UdM/lHJvELzTCuLmGOSOSF26Ht/iEl8hPgluPLTCaanniS8B6ZO5W8yXpZ1px8I/Sucj3bkqgEBAAOZzMA0e3BwvulvBngviFCoOEU8amqoR4UkawwEyFrvcrAXHWGGfxerR5z6AzWZVAFPivl8NY0V7DorEyz8mE0Og58JQGsXLoVEwtEetsNXB/Z/6cUJyIeWjiIJTwwumToTKUEiS9cq4HlTgRrgPB4PMmFFp6cJlvrd6EA/RIp8Qc4j90cNfYejASzPsjmeeJdCY5fIUIJb+heDc9aFktRhZ0uB0OQlzNAXaf3RJlmOx3gfv5DxL+Qauuk6V0hiG4qyStmCglB87PU3r/jpR2oMwaMrilLEEKCRCywhJvHyXSpF8s003M+rGzbgXG5fegGV4bfg6/7doGj/su4Wft8LV+KaoaOQdpMYIEjAhuUMoakLf1+c87fZlKvIo19L1flPzg== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2670660a-b603-48b2-7531-08db4d905b71 X-MS-Exchange-CrossTenant-AuthSource: SN6PR10MB3022.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 May 2023 17:44:20.8945 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: TXa4InUvnLumFw1a6PPqjmIGovt7FZ0qPhaFUGJrraOJEjyqRT3pXJCLvPgEnpa+eDPS08/66DMWzAGHnMQrwA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL3PR10MB6089 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-05-05_24,2023-05-05_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 phishscore=0 spamscore=0 mlxlogscore=999 bulkscore=0 suspectscore=0 mlxscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303200000 definitions=main-2305050146 X-Proofpoint-GUID: bjqzePQZIItG1aC03WhxDSled2RIkHjh X-Proofpoint-ORIG-GUID: bjqzePQZIItG1aC03WhxDSled2RIkHjh X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: The test code is less useful without debug, but can still do general validations. Define mt_dump(), mas_dump() and mas_wr_dump() as a noop if debug is not enabled and document it in the test module information that more information can be obtained with another kernel config option. MT_BUG_ON() will report a failures without tree dumps, and the output will be less useful. Signed-off-by: Liam R. Howlett --- lib/Kconfig.debug | 10 +++++++--- lib/test_maple_tree.c | 27 ++++++++++++++++++++++++--- tools/testing/radix-tree/maple.c | 1 - 3 files changed, 31 insertions(+), 7 deletions(-) diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug index be272aa2fc0a4..17ba96a3c7bfe 100644 --- a/lib/Kconfig.debug +++ b/lib/Kconfig.debug @@ -2293,9 +2293,13 @@ config TEST_XARRAY tristate "Test the XArray code at runtime" config TEST_MAPLE_TREE - depends on DEBUG_KERNEL - select DEBUG_MAPLE_TREE - tristate "Test the Maple Tree code at runtime" + tristate "Test the Maple Tree code at runtime or module load" + help + Enable this option to test the maple tree code functions at boot, or + when the module is loaded. Enable "Debug Maple Trees" will enable + more verbose output on failures. + + If unsure, say N. config TEST_RHASHTABLE tristate "Perform selftest on resizable hash table" diff --git a/lib/test_maple_tree.c b/lib/test_maple_tree.c index d6929270dd36a..93b40a78c4f55 100644 --- a/lib/test_maple_tree.c +++ b/lib/test_maple_tree.c @@ -11,12 +11,33 @@ #include #define MTREE_ALLOC_MAX 0x2000000000000Ul -#ifndef CONFIG_DEBUG_MAPLE_TREE -#define CONFIG_DEBUG_MAPLE_TREE -#endif #define CONFIG_MAPLE_SEARCH #define MAPLE_32BIT (MAPLE_NODE_SLOTS > 31) +#ifndef CONFIG_DEBUG_MAPLE_TREE +#define mt_dump(mt, fmt) do {} while (0) +#define mt_validate(mt) do {} while (0) +#define mt_cache_shrink() do {} while (0) +#define mas_dump(mas) do {} while (0) +#define mas_wr_dump(mas) do {} while (0) +atomic_t maple_tree_tests_run; +atomic_t maple_tree_tests_passed; +#undef MT_BUG_ON + +#define MT_BUG_ON(__tree, __x) do { \ + atomic_inc(&maple_tree_tests_run); \ + if (__x) { \ + pr_info("BUG at %s:%d (%u)\n", \ + __func__, __LINE__, __x); \ + pr_info("Pass: %u Run:%u\n", \ + atomic_read(&maple_tree_tests_passed), \ + atomic_read(&maple_tree_tests_run)); \ + } else { \ + atomic_inc(&maple_tree_tests_passed); \ + } \ +} while (0) +#endif + /* #define BENCH_SLOT_STORE */ /* #define BENCH_NODE_STORE */ /* #define BENCH_AWALK */ diff --git a/tools/testing/radix-tree/maple.c b/tools/testing/radix-tree/maple.c index ebcb3faf85ea9..cf37ed9ab6c4d 100644 --- a/tools/testing/radix-tree/maple.c +++ b/tools/testing/radix-tree/maple.c @@ -22,7 +22,6 @@ #define dump_stack() assert(0) #include "../../../lib/maple_tree.c" -#undef CONFIG_DEBUG_MAPLE_TREE #include "../../../lib/test_maple_tree.c" #define RCU_RANGE_COUNT 1000 From patchwork Fri May 5 17:41:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Liam R. Howlett" X-Patchwork-Id: 13232898 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5D892C77B7F for ; Fri, 5 May 2023 17:44:27 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E821C6B0092; Fri, 5 May 2023 13:44:26 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E34666B0095; Fri, 5 May 2023 13:44:26 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C10136B0096; Fri, 5 May 2023 13:44:26 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by kanga.kvack.org (Postfix) with ESMTP id 9F0C96B0092 for ; Fri, 5 May 2023 13:44:26 -0400 (EDT) Received: from pps.filterd (m0246630.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 345HhK1k014772; Fri, 5 May 2023 17:44:26 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=7MLcv1G8LkaXK+scWyvzIEbLLyWLzRFzfze5eok9DRY=; b=IK4PLajCpJL91RsHVIlHBl4U0yo7jk6WT55K2/ajXC3jCsnFKABSxVwaDdTLB4TMgBG9 C1Wj/pF84nyxJBoUXeXUWsb9La3k7+5JkkEQOWXIpLVwsSa8By2lTw+LdA5BzwSjYdgQ r2rk83gH7zBNbQUsGxsAe00qx0cRjuG14fg3q4PY0Y/DDXUvHcPlpFCe+mJ2i62YAwb+ zxPaEZ5wT+O369WKx3BYLCBspCCUEgTIkYru2/V3GBaO7VURetSOyloZZow7bA+5RmmD gjv12OOTO6CFWCy35gsc4v1lWSmxLSYQ13RkEXTTiRSSiT5FOr1aW3ormOs79krFlIEW IA== Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3q8sneddyg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 05 May 2023 17:44:26 +0000 Received: from pps.filterd (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 345GjJFG027445; Fri, 5 May 2023 17:44:25 GMT Received: from nam12-dm6-obe.outbound.protection.outlook.com (mail-dm6nam12lp2171.outbound.protection.outlook.com [104.47.59.171]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3q8spgetgn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 05 May 2023 17:44:25 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Xe4kzE00OXGSPcKOLb0oyx2IzfGyCRInMHugbYBC6zQAoyHg6mGkl+pTa953gyKjKFm8glzkMVNPq9MuOtTpssSA63KcSOh5KWf+13L+6APU6oj3/8kEKlFQ7zn2GVnPdWHJUYCMbzof6I+9+TTgLIa/GkhX4EgYufIIa0uBaXP/EemnTivA22Bz8FZiAaeudjDzbrQUscjYAUm+TKOTExyNfeiUqRJRbX2Ab0RzBNigF/fAowWNcWEW+fcpU3p+6DUTPkHtN6Yxav+UVyHs4CdRdx1a+Ancqqg7cKYwuaaPLnKfLC4pSPbmHeG2ZZt6BM347wtPQXK+yUsu+XWing== 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=7MLcv1G8LkaXK+scWyvzIEbLLyWLzRFzfze5eok9DRY=; b=g9yQonYfMQDhlbbUN9asWRGs7qFbPUGsqslGUs7ZJQhK1mI3dMcl5AO/WcA8CJeTnoBf4q8E95KZ2Rf/QsbVpdigSq/Vds4hdDLVE8DOrkWHgCfPsJZx8i0AIEQlzKJgvPiAMk2lXjbsZOviHqFa94zRUu8Z8QH+667nLpJxoXVb6z3K5YDIhmfx7aghMgjk0wbARuWD7XZGgSBstJO5UBjo0wAx3YMGIFM0zSNj2rxwBS/DvJTCo3oT8ONFwFkmgeS2VDToep/W7hRLTD3BU6FKmAzH8hfx8ayZGuto1BuCYt4/Eh83LRkBnOhGR1Fv/1MWbcyWPULKkBAsZfO1MQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=7MLcv1G8LkaXK+scWyvzIEbLLyWLzRFzfze5eok9DRY=; b=iWsfLkWzSbo3RaijkPv3emGWAGcOiTXiVYrezna96yWAnmnn3QyB4mhFJqJVu3ZxlBneiNI9P5Mo/3V0om/bW9W4u2dRtkqELDFQRqWi9Xs6BzKQYlV5A8BLMGq51XPN5G/1bXFLbZ+87uqtps+KSUx8jX8tHU9hm4R3+UO4hSA= Received: from SN6PR10MB3022.namprd10.prod.outlook.com (2603:10b6:805:d8::25) by BL3PR10MB6089.namprd10.prod.outlook.com (2603:10b6:208:3b5::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6363.27; Fri, 5 May 2023 17:44:23 +0000 Received: from SN6PR10MB3022.namprd10.prod.outlook.com ([fe80::8bb9:2bb7:3930:b5da]) by SN6PR10MB3022.namprd10.prod.outlook.com ([fe80::8bb9:2bb7:3930:b5da%7]) with mapi id 15.20.6363.022; Fri, 5 May 2023 17:44:23 +0000 From: "Liam R. Howlett" To: Andrew Morton Cc: maple-tree@lists.infradead.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, "Liam R. Howlett" Subject: [PATCH v2 17/36] mm: Update validate_mm() to use vma iterator Date: Fri, 5 May 2023 13:41:45 -0400 Message-Id: <20230505174204.2665599-18-Liam.Howlett@oracle.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230505174204.2665599-1-Liam.Howlett@oracle.com> References: <20230505174204.2665599-1-Liam.Howlett@oracle.com> X-ClientProxiedBy: YT4PR01CA0372.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:fd::21) To SN6PR10MB3022.namprd10.prod.outlook.com (2603:10b6:805:d8::25) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN6PR10MB3022:EE_|BL3PR10MB6089:EE_ X-MS-Office365-Filtering-Correlation-Id: 985bd068-71f0-4c64-4d33-08db4d905cb3 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: jzPugKicla7cEoEzG6NWd3pAAbfKx2whgZT4op6dxqCBp2xojaMw5//VcglPbBrp/MYQ6M6plR6nc7vVbuwwOqvuPwhZ0Pnf2bR5X9z5K0hDWygLGtsFkub7+PZ4zZ0Bk+13OJKGq2MIJJ5mGryxyE73kzp5fHa6VXEMplL1CTQ5ma6dUtRarlbN9VfNIrEpsoDfuiQvfW9uXV4BbDcb4vZOYfMHz6fz+CLSGTFV/Z9lGhoBLE+AcO6dyjQNx8NQW1D7P9IUD8l4YS+ws+0D2U2gFjApUPpkIUgyH2tbiwMoJHM7fkmfXUmXt3Si2I0+9VJUVRAYqhFs+Vaw2NGJ/ZQ450fj/QR6tElUbp7SseNy4E3in5uXVYbPOa4pDZ6blVkUhfWsLS7K5Zhatk0KR8uQL77BPciicyOD/TCOM/GVvM8fq2aK4Cw8tLfcuhK0/b6seuM8ID20gGHb4xV/2idmTqUTRxWWRMCBlloxEngn7Yco8hrA9MFtZun6Y5Roenf77qm9uLHNtg1E+gxlp35VyLjOBUfD8TXFRYgdI3+mIeo4yZ6hKVeS0xR/D0Ko X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SN6PR10MB3022.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(396003)(346002)(366004)(39860400002)(376002)(136003)(451199021)(66476007)(6916009)(4326008)(66946007)(66556008)(6666004)(478600001)(6486002)(316002)(36756003)(86362001)(83380400001)(107886003)(2616005)(6506007)(1076003)(26005)(6512007)(8936002)(5660300002)(8676002)(2906002)(15650500001)(41300700001)(186003)(38100700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: GwuGktClWtrqY6+oTulpWbKIarn0laHAGNzY0fdblizLTR4jKYqSdBNsqCatOxdY6UHM1lB+0+dGtCjA5V6UOdexO73OdRE+Oulvcu6zAlD5w9oqZZVrbUo+7UNwsqO1+Zn9RFuL8Hy3dS4tMzxpjWAH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bw+a4bMX7+Myt7d8pdRquXY7/nEWKN6FGGBB5TfN9BaPXuY3Z67SqgTgKEu6/mkF3QZnE9Banw/bRdlHmMzzCKzuSgwPz4YmY6/dfoWRrU1e6zqkw6p/7Nazu35KZdRipAc2BCZFWEQrdpTnKYG974fq6Z4TZeBsRexQNHv/Ka6KzSMqRDGfIp305b2pIN1JhG+y9c42Ws4RHHiEAq0cgEHwG2GRVKaFiBL9VE24wtPN2lWLAGapBQd/KNffhMIxQ1fQuBEORfAQ/O7U5Q+iBD4kmqGoWtRT4P4ULzGBljKlqkGy5ZA== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 985bd068-71f0-4c64-4d33-08db4d905cb3 X-MS-Exchange-CrossTenant-AuthSource: SN6PR10MB3022.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 May 2023 17:44:23.1620 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 2eJofWdbZMBAXytJSw3gAKTTn/mqOLrlLAmTZGUwzk6+T2USHHpAh+bbimQnnPTUHcVMngx1c+yAGfCoJ3VSww== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL3PR10MB6089 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-05-05_24,2023-05-05_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 malwarescore=0 adultscore=0 suspectscore=0 mlxlogscore=999 phishscore=0 mlxscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303200000 definitions=main-2305050146 X-Proofpoint-GUID: mMZUJBDvHYfMZPsuDnJdGC0vq6T1RIAO X-Proofpoint-ORIG-GUID: mMZUJBDvHYfMZPsuDnJdGC0vq6T1RIAO X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Use the vma iterator in the validation code and combine the code to check the maple tree into the main validate_mm() function. Introduce a new function vma_iter_dump_tree() to dump the maple tree in hex layout. Replace all calls to validate_mm_mt() with validate_mm(). Signed-off-by: Liam R. Howlett --- include/linux/mmdebug.h | 14 ++++++ mm/debug.c | 9 ++++ mm/internal.h | 3 +- mm/mmap.c | 101 ++++++++++++++++------------------------ 4 files changed, 66 insertions(+), 61 deletions(-) diff --git a/include/linux/mmdebug.h b/include/linux/mmdebug.h index b8728d11c9490..7c3e7b0b0e8fd 100644 --- a/include/linux/mmdebug.h +++ b/include/linux/mmdebug.h @@ -8,10 +8,12 @@ struct page; struct vm_area_struct; struct mm_struct; +struct vma_iterator; void dump_page(struct page *page, const char *reason); void dump_vma(const struct vm_area_struct *vma); void dump_mm(const struct mm_struct *mm); +void vma_iter_dump_tree(const struct vma_iterator *vmi); #ifdef CONFIG_DEBUG_VM #define VM_BUG_ON(cond) BUG_ON(cond) @@ -74,6 +76,17 @@ void dump_mm(const struct mm_struct *mm); } \ unlikely(__ret_warn_once); \ }) +#define VM_WARN_ON_ONCE_MM(cond, mm) ({ \ + static bool __section(".data.once") __warned; \ + int __ret_warn_once = !!(cond); \ + \ + if (unlikely(__ret_warn_once && !__warned)) { \ + dump_mm(mm); \ + __warned = true; \ + WARN_ON(1); \ + } \ + unlikely(__ret_warn_once); \ +}) #define VM_WARN_ON(cond) (void)WARN_ON(cond) #define VM_WARN_ON_ONCE(cond) (void)WARN_ON_ONCE(cond) @@ -90,6 +103,7 @@ void dump_mm(const struct mm_struct *mm); #define VM_WARN_ON_ONCE_PAGE(cond, page) BUILD_BUG_ON_INVALID(cond) #define VM_WARN_ON_FOLIO(cond, folio) BUILD_BUG_ON_INVALID(cond) #define VM_WARN_ON_ONCE_FOLIO(cond, folio) BUILD_BUG_ON_INVALID(cond) +#define VM_WARN_ON_ONCE_MM(cond, mm) BUILD_BUG_ON_INVALID(cond) #define VM_WARN_ONCE(cond, format...) BUILD_BUG_ON_INVALID(cond) #define VM_WARN(cond, format...) BUILD_BUG_ON_INVALID(cond) #endif diff --git a/mm/debug.c b/mm/debug.c index c7b228097bd98..ee533a5ceb79d 100644 --- a/mm/debug.c +++ b/mm/debug.c @@ -268,4 +268,13 @@ void page_init_poison(struct page *page, size_t size) if (page_init_poisoning) memset(page, PAGE_POISON_PATTERN, size); } + +void vma_iter_dump_tree(const struct vma_iterator *vmi) +{ +#if defined(CONFIG_DEBUG_VM_MAPLE_TREE) + mas_dump(&vmi->mas); + mt_dump(vmi->mas.tree, mt_dump_hex); +#endif /* CONFIG_DEBUG_VM_MAPLE_TREE */ +} + #endif /* CONFIG_DEBUG_VM */ diff --git a/mm/internal.h b/mm/internal.h index 4c195920f5656..8d1a8bd001247 100644 --- a/mm/internal.h +++ b/mm/internal.h @@ -1051,13 +1051,14 @@ static inline void vma_iter_store(struct vma_iterator *vmi, printk("%lu > %lu\n", vmi->mas.index, vma->vm_start); printk("store of vma %lu-%lu", vma->vm_start, vma->vm_end); printk("into slot %lu-%lu", vmi->mas.index, vmi->mas.last); - mt_dump(vmi->mas.tree, mt_dump_hex); + vma_iter_dump_tree(vmi); } if (WARN_ON(vmi->mas.node != MAS_START && vmi->mas.last < vma->vm_start)) { printk("%lu < %lu\n", vmi->mas.last, vma->vm_start); printk("store of vma %lu-%lu", vma->vm_start, vma->vm_end); printk("into slot %lu-%lu", vmi->mas.index, vmi->mas.last); mt_dump(vmi->mas.tree, mt_dump_hex); + vma_iter_dump_tree(vmi); } #endif diff --git a/mm/mmap.c b/mm/mmap.c index 76eaf12f13903..bcebfd9266324 100644 --- a/mm/mmap.c +++ b/mm/mmap.c @@ -299,62 +299,44 @@ SYSCALL_DEFINE1(brk, unsigned long, brk) return origbrk; } -#if defined(CONFIG_DEBUG_VM_MAPLE_TREE) -extern void mt_validate(struct maple_tree *mt); -extern void mt_dump(const struct maple_tree *mt, enum mt_dump_format fmt); - -/* Validate the maple tree */ -static void validate_mm_mt(struct mm_struct *mm) -{ - struct maple_tree *mt = &mm->mm_mt; - struct vm_area_struct *vma_mt; - - MA_STATE(mas, mt, 0, 0); - - mt_validate(&mm->mm_mt); - mas_for_each(&mas, vma_mt, ULONG_MAX) { - if ((vma_mt->vm_start != mas.index) || - (vma_mt->vm_end - 1 != mas.last)) { - pr_emerg("issue in %s\n", current->comm); - dump_stack(); - dump_vma(vma_mt); - pr_emerg("mt piv: %p %lu - %lu\n", vma_mt, - mas.index, mas.last); - pr_emerg("mt vma: %p %lu - %lu\n", vma_mt, - vma_mt->vm_start, vma_mt->vm_end); - - mt_dump(mas.tree, mt_dump_hex); - if (vma_mt->vm_end != mas.last + 1) { - pr_err("vma: %p vma_mt %lu-%lu\tmt %lu-%lu\n", - mm, vma_mt->vm_start, vma_mt->vm_end, - mas.index, mas.last); - mt_dump(mas.tree, mt_dump_hex); - } - VM_BUG_ON_MM(vma_mt->vm_end != mas.last + 1, mm); - if (vma_mt->vm_start != mas.index) { - pr_err("vma: %p vma_mt %p %lu - %lu doesn't match\n", - mm, vma_mt, vma_mt->vm_start, vma_mt->vm_end); - mt_dump(mas.tree, mt_dump_hex); - } - VM_BUG_ON_MM(vma_mt->vm_start != mas.index, mm); - } - } -} - +#if defined(CONFIG_DEBUG_VM) static void validate_mm(struct mm_struct *mm) { int bug = 0; int i = 0; struct vm_area_struct *vma; - MA_STATE(mas, &mm->mm_mt, 0, 0); + VMA_ITERATOR(vmi, mm, 0); - validate_mm_mt(mm); +#if defined(CONFIG_DEBUG_VM_MAPLE_TREE) + mt_validate(&mm->mm_mt); +#endif - mas_for_each(&mas, vma, ULONG_MAX) { + for_each_vma(vmi, vma) { #ifdef CONFIG_DEBUG_VM_RB struct anon_vma *anon_vma = vma->anon_vma; struct anon_vma_chain *avc; +#endif + unsigned long vmi_start, vmi_end; + bool warn = 0; + + vmi_start = vma_iter_addr(&vmi); + vmi_end = vma_iter_end(&vmi); + if (VM_WARN_ON_ONCE_MM(vma->vm_end != vmi_end, mm)) + warn = 1; + + if (VM_WARN_ON_ONCE_MM(vma->vm_start != vmi_start, mm)) + warn = 1; + + if (warn) { + pr_emerg("issue in %s\n", current->comm); + dump_stack(); + dump_vma(vma); + pr_emerg("tree range: %px start %lx end %lx\n", vma, + vmi_start, vmi_end - 1); + vma_iter_dump_tree(&vmi); + } +#ifdef CONFIG_DEBUG_VM_RB if (anon_vma) { anon_vma_lock_read(anon_vma); list_for_each_entry(avc, &vma->anon_vma_chain, same_vma) @@ -365,16 +347,15 @@ static void validate_mm(struct mm_struct *mm) i++; } if (i != mm->map_count) { - pr_emerg("map_count %d mas_for_each %d\n", mm->map_count, i); + pr_emerg("map_count %d vma iterator %d\n", mm->map_count, i); bug = 1; } VM_BUG_ON_MM(bug, mm); } -#else /* !CONFIG_DEBUG_VM_MAPLE_TREE */ -#define validate_mm_mt(root) do { } while (0) +#else /* !CONFIG_DEBUG_VM */ #define validate_mm(mm) do { } while (0) -#endif /* CONFIG_DEBUG_VM_MAPLE_TREE */ +#endif /* CONFIG_DEBUG_VM */ /* * vma has some anon_vma assigned, and is already inserted on that @@ -2261,7 +2242,7 @@ int __split_vma(struct vma_iterator *vmi, struct vm_area_struct *vma, struct vm_area_struct *new; int err; - validate_mm_mt(vma->vm_mm); + validate_mm(vma->vm_mm); WARN_ON(vma->vm_start >= addr); WARN_ON(vma->vm_end <= addr); @@ -2319,7 +2300,7 @@ int __split_vma(struct vma_iterator *vmi, struct vm_area_struct *vma, /* Success. */ if (new_below) vma_next(vmi); - validate_mm_mt(vma->vm_mm); + validate_mm(vma->vm_mm); return 0; out_free_mpol: @@ -2328,7 +2309,7 @@ int __split_vma(struct vma_iterator *vmi, struct vm_area_struct *vma, vma_iter_free(vmi); out_free_vma: vm_area_free(new); - validate_mm_mt(vma->vm_mm); + validate_mm(vma->vm_mm); return err; } @@ -2963,7 +2944,7 @@ int do_vma_munmap(struct vma_iterator *vmi, struct vm_area_struct *vma, arch_unmap(mm, start, end); ret = do_vmi_align_munmap(vmi, vma, mm, start, end, uf, downgrade); - validate_mm_mt(mm); + validate_mm(mm); return ret; } @@ -2985,7 +2966,7 @@ static int do_brk_flags(struct vma_iterator *vmi, struct vm_area_struct *vma, struct mm_struct *mm = current->mm; struct vma_prepare vp; - validate_mm_mt(mm); + validate_mm(mm); /* * Check against address space limits by the changed size * Note: This happens *after* clearing old mappings in some code paths. @@ -3226,7 +3207,7 @@ struct vm_area_struct *copy_vma(struct vm_area_struct **vmap, bool faulted_in_anon_vma = true; VMA_ITERATOR(vmi, mm, addr); - validate_mm_mt(mm); + validate_mm(mm); /* * If anonymous vma has not yet been faulted, update new pgoff * to match new location, to increase its chance of merging. @@ -3285,7 +3266,7 @@ struct vm_area_struct *copy_vma(struct vm_area_struct **vmap, goto out_vma_link; *need_rmap_locks = false; } - validate_mm_mt(mm); + validate_mm(mm); return new_vma; out_vma_link: @@ -3301,7 +3282,7 @@ struct vm_area_struct *copy_vma(struct vm_area_struct **vmap, out_free_vma: vm_area_free(new_vma); out: - validate_mm_mt(mm); + validate_mm(mm); return NULL; } @@ -3438,7 +3419,7 @@ static struct vm_area_struct *__install_special_mapping( int ret; struct vm_area_struct *vma; - validate_mm_mt(mm); + validate_mm(mm); vma = vm_area_alloc(mm); if (unlikely(vma == NULL)) return ERR_PTR(-ENOMEM); @@ -3461,12 +3442,12 @@ static struct vm_area_struct *__install_special_mapping( perf_event_mmap(vma); - validate_mm_mt(mm); + validate_mm(mm); return vma; out: vm_area_free(vma); - validate_mm_mt(mm); + validate_mm(mm); return ERR_PTR(ret); } From patchwork Fri May 5 17:41:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Liam R. Howlett" X-Patchwork-Id: 13232899 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id C09AFC77B7C for ; Fri, 5 May 2023 17:44:29 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 532766B0093; Fri, 5 May 2023 13:44:29 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 4E3B36B0095; Fri, 5 May 2023 13:44:29 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 335526B0096; Fri, 5 May 2023 13:44:29 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by kanga.kvack.org (Postfix) with ESMTP id 11A2F6B0093 for ; Fri, 5 May 2023 13:44:29 -0400 (EDT) Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 345HhLXI028060; Fri, 5 May 2023 17:44:28 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=NuHwCjXvI30g9aIE3crnZm6Jgpwz65O34xwD74RRmY0=; b=DeYKuHFxfWwGKXYBNq49kiafpDJw5aseeYODeRVAKCeopBZrfJnbSAFAOi1HxFJ2L8uZ I+XpWetrNhGZHM5ALJxX/ExXCnOzZTtFd9NUuZbt7Cogmvp4sfahebSbolaSraqTZg9L TyDZs5uHXvsTv5xa2c8+mxx6rmBLYj19zp5QZUOZ47UWRd5Bap1+IsRAdYIB6ZAXaJSs /nzutXHyuEeOtd6hh6ncunip6seJS30CGNlR+vrxizeZTM7GcfdEX7bNrX2IstH4Yh8m 9XQs52kJtQHfuglTCuP0RU3UbOwdj5rh+ofkx7Vn+ogi5XGkiiC1Zrkq2nGaxx5cevbn Rg== Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3q8t145jd3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 05 May 2023 17:44:28 +0000 Received: from pps.filterd (iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 345HcUfm040467; Fri, 5 May 2023 17:44:27 GMT Received: from nam12-dm6-obe.outbound.protection.outlook.com (mail-dm6nam12lp2173.outbound.protection.outlook.com [104.47.59.173]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3q8spa74bw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 05 May 2023 17:44:27 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hZVzvCqkEB/07IKAmAhqBFhXRx84JnNq3r6HtMkU+8l/tgl/LvtdikZblxj34fwy38UgwA93m5ENWTykYHdVWVpTU7duzjk5TncjDOZIKvNbCdaPffcSryVzXcslg3LKLbRAkh6Hzi/sovf6tGeV1ZKwSYujVGpqhqPViQQKkcYOdR9WdSpPGgB5UtjiD06JQDureZWEhbyVScXuGFzBBJmmc/ncL5J3I0i5ZEyODix+RPHlOdjCURRfVwb7eqUv3MkI5ixUEKaZGDsg1X3x5SGC400xEua1kNToM38h06TIG8e/0qDhnKzv+M+H7Am8dY9LXtqY2LZvXVDs5yZJPQ== 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=NuHwCjXvI30g9aIE3crnZm6Jgpwz65O34xwD74RRmY0=; b=Cmok8GzGYZ1moaifGre0gyrUSwH+8btF8sXjncqbClp0wK0ACMO2fOlHPdmGBnNq49wQsS5f+ADkFkamtQ5b/v7v0FDfAf/lyuHURDWl0D09cQcDJ9smuw2Do9UQ0+99+aZKFqWWpCuMOTVgiZ7EMSQ3Dnn4gsOPBWFo8kvJSOgnGQhDZaoV8eU/00sE9dBSD4xYep4yYZqfLVWhkrZLrr3bX0poUQHLw6T2iIUDt8xdhKpHaRRPv+eVqyMpBv1mEZy0e3dCvAA5SStoE3L0ZmIyJ1gba9iFaF8rXfw7pSTIk9bny9DUnt3TUaYkCc5WjnB7qFC/DCc+78xOaorLPA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=NuHwCjXvI30g9aIE3crnZm6Jgpwz65O34xwD74RRmY0=; b=px1QxLzIdzvpqWkhkLjGEidJy2xnIISmtQcKDa8fXPr8/FKNJ2Q7dHyXxUkvNyEs/AbTPR2PV3F5DdYuLd/O8S5AjyNgCPIb+k0yCZ2/C19KTnS2expfQMmhHUhr90ebQe7Feahb1VAky2MSaC7PI9Zs7Kfjs8ElrMkVe7MDvOI= Received: from SN6PR10MB3022.namprd10.prod.outlook.com (2603:10b6:805:d8::25) by BL3PR10MB6089.namprd10.prod.outlook.com (2603:10b6:208:3b5::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6363.27; Fri, 5 May 2023 17:44:25 +0000 Received: from SN6PR10MB3022.namprd10.prod.outlook.com ([fe80::8bb9:2bb7:3930:b5da]) by SN6PR10MB3022.namprd10.prod.outlook.com ([fe80::8bb9:2bb7:3930:b5da%7]) with mapi id 15.20.6363.022; Fri, 5 May 2023 17:44:25 +0000 From: "Liam R. Howlett" To: Andrew Morton Cc: maple-tree@lists.infradead.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, "Liam R. Howlett" , Sergey Senozhatsky Subject: [PATCH v2 18/36] mm: Update vma_iter_store() to use MAS_WARN_ON() Date: Fri, 5 May 2023 13:41:46 -0400 Message-Id: <20230505174204.2665599-19-Liam.Howlett@oracle.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230505174204.2665599-1-Liam.Howlett@oracle.com> References: <20230505174204.2665599-1-Liam.Howlett@oracle.com> X-ClientProxiedBy: YT4P288CA0042.CANP288.PROD.OUTLOOK.COM (2603:10b6:b01:d3::23) To SN6PR10MB3022.namprd10.prod.outlook.com (2603:10b6:805:d8::25) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN6PR10MB3022:EE_|BL3PR10MB6089:EE_ X-MS-Office365-Filtering-Correlation-Id: e0b6c3a5-82f9-454d-beec-08db4d905e30 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: G8rtO0jO3/RpZyXLp+3jlyeJgG7BffmoUI+qVvlCiWfn7Fh1dtUHPYFLp9olvCxPNCttT1l7p41kdOHYoHWboWCTv6miMZ8Tz0uWh5EgfCvXF+u8mh0Mti/6JMD/6vimWJa1pv+Ba6U+3iUdyW/eRm7A9fBC9Mtrc/LNv/E7iyaE0m1hbto7mghaEV8sllQ4+f1fjarRwLnkW0Zh2qN3+PDrZNSwHreXHxsFRcpvAiSoUyE3uWRajXL4RwkarlXZwKcZBpWfQHDPcsI1KYqTNCvhEvspBMz/YTvFpF3D0aSzYWqgJKbwCa7rwlD6pF6fgN7H6rl375w2tgAxGqfgHO2nFfmlkshcYJ2A8zwACv07oXeX6iiYn7HRaANmzbotn4xCUJMSGtYbGGMYwEFm40UPfApV+rfJpsLXBy4Co+VhGSC3OKJs+WZUTi3i4mn6naP3TXp4YLdSpOXdgW7BzCD69z/IsEBkQ1C1QZRJvughMLw0y4d7lT7cXX05ZrAHdFUKzxYkeNv/vNVlkLaO8DTfkDdcnpDXnIDtcqYMHbYGJ4vZGIxMEQQeHtNipQmK X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SN6PR10MB3022.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(396003)(346002)(366004)(39860400002)(376002)(136003)(451199021)(66476007)(6916009)(4326008)(66946007)(66556008)(6666004)(478600001)(6486002)(316002)(54906003)(36756003)(86362001)(83380400001)(2616005)(6506007)(1076003)(26005)(6512007)(8936002)(5660300002)(8676002)(2906002)(15650500001)(41300700001)(186003)(38100700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: VjvI3exbFocWp9BQ+jNQbnwtCyJgwAsk+2mYFBUfPb1hs11rLutSdclD/TWaBuuajlX9axD+QuYLbXLUQIP1mD6GGWL5o6JHKCryUDDYCmZ1vT2Eug5CEd40nrMC+CD/9FnvuKfKV3PtReT9CNJljBdBK12WCzrgB1twkIz6MDWSUdpmKOGf7g8wq6cCPaQNFSLQ7SnEf5g6XmYO4AayvqYzcwiwLMG4hWL7LyzAAMk0GhWBTy+Z4IBs+eAC0NU5dfVyNV6plRf0kMw9Gf15NvOiVBJSAi5TVNdRUmRk/+NNAqNNHryj3i3xM1xgpbOW2GTDiTLG0sRnD5TRnpgXOrCvuMtAJ3pirvtqcqugSyjMokKCu0TCnCbo9vgIVPTzCfgkhfWeJ6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wbUtoMd/U7Rj0Uo4nJDJ4ClrwDTpOFMPreaIjP6GEGQCGjipRBtqrDLT7zRXJ/yQzMDR15E6csEJ1F+MVCGtdQJ9lg5LnhfLYHqVbFeFE= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: e0b6c3a5-82f9-454d-beec-08db4d905e30 X-MS-Exchange-CrossTenant-AuthSource: SN6PR10MB3022.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 May 2023 17:44:25.5238 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 2GD9rHRB++dw+p/+70OvpC7WF2dXX+8Rd+SmtdweOVaPv0n+sd6SYzIgHkJs7hlrinrGOleoUodVnqxyMTMGMQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL3PR10MB6089 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-05-05_24,2023-05-05_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 mlxlogscore=999 phishscore=0 bulkscore=0 suspectscore=0 mlxscore=0 spamscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303200000 definitions=main-2305050146 X-Proofpoint-GUID: doIPoNrvrcjG4tLVKVDZwZsGvm7XjGIN X-Proofpoint-ORIG-GUID: doIPoNrvrcjG4tLVKVDZwZsGvm7XjGIN X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: MAS_WARN_ON() will provide more information on the maple state and can be more useful for debugging. Use this version of WARN_ON() in the debugging code when storing to the tree. Update the printk to a pr_warn(), but this will only be printed when maple tree debug is enabled anyways. Making all print statements into one will keep them together on a busy terminal. Cc: Sergey Senozhatsky Signed-off-by: Liam R. Howlett Reviewed-by: Sergey Senozhatsky --- mm/internal.h | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/mm/internal.h b/mm/internal.h index 8d1a8bd001247..6112108322461 100644 --- a/mm/internal.h +++ b/mm/internal.h @@ -1047,18 +1047,23 @@ static inline void vma_iter_store(struct vma_iterator *vmi, { #if defined(CONFIG_DEBUG_VM_MAPLE_TREE) - if (WARN_ON(vmi->mas.node != MAS_START && vmi->mas.index > vma->vm_start)) { - printk("%lu > %lu\n", vmi->mas.index, vma->vm_start); - printk("store of vma %lu-%lu", vma->vm_start, vma->vm_end); - printk("into slot %lu-%lu", vmi->mas.index, vmi->mas.last); - vma_iter_dump_tree(vmi); + if (MAS_WARN_ON(&vmi->mas, vmi->mas.node != MAS_START && + vmi->mas.index > vma->vm_start)) { + pr_warn("%lx > %lx\n" + "store of vma %lx-%lx\n" + "into slot %lx-%lx\n", + vmi->mas.index, vma->vm_start, + vma->vm_start, vma->vm_end, + vmi->mas.index, vmi->mas.last); } - if (WARN_ON(vmi->mas.node != MAS_START && vmi->mas.last < vma->vm_start)) { - printk("%lu < %lu\n", vmi->mas.last, vma->vm_start); - printk("store of vma %lu-%lu", vma->vm_start, vma->vm_end); - printk("into slot %lu-%lu", vmi->mas.index, vmi->mas.last); - mt_dump(vmi->mas.tree, mt_dump_hex); - vma_iter_dump_tree(vmi); + if (MAS_WARN_ON(&vmi->mas, vmi->mas.node != MAS_START && + vmi->mas.last < vma->vm_start)) { + pr_warn("%lx < %lx\n" + "store of vma %lx-%lx\n" + "into slot %lx-%lx\n", + vmi->mas.last, vma->vm_start, + vma->vm_start, vma->vm_end, + vmi->mas.index, vmi->mas.last); } #endif From patchwork Fri May 5 17:41:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Liam R. Howlett" X-Patchwork-Id: 13232900 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id CCA7BC77B7C for ; Fri, 5 May 2023 17:44:32 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 644146B0095; Fri, 5 May 2023 13:44:32 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5F3696B0096; Fri, 5 May 2023 13:44:32 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 41F746B0098; Fri, 5 May 2023 13:44:32 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by kanga.kvack.org (Postfix) with ESMTP id 13F2D6B0095 for ; Fri, 5 May 2023 13:44:32 -0400 (EDT) Received: from pps.filterd (m0246632.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 345HhIUa002987; Fri, 5 May 2023 17:44:31 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=PW5eX7vH7gHjRX0FYYq80BUyJ8oQwCendk+71PT1yxg=; b=0wGPXV46MMZAe8zFEhDbhSevT1r/C484nC6IaZKoBhpxE4kRHomeisCA2qaaL25csyQb zW7JZXbKMWThNuZ6spNp4ccoDZeYhISEH3bwWlQN3SO6An62507+eV9vNeKjZS+TLmYX Jk6W2rCACOHLhK5cUsMjMDe+U0NYdVda2Fm0zxeA36minYqa/sbD6rHIYl2yG5R8Wa/+ eceZr2zXdqWhI/2Az37VgXIwFVnrrcWK5OfmRJUVwbHkw7VslBvpoX/1E2S5PrBschCD VgqSBxJPjlorYd1MLZvsBtkLz+1unBcwoSgvJa0FpEN5GMjONrGXoEvPc9DgAuJ72o9K 0w== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3qburgdkd8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 05 May 2023 17:44:31 +0000 Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 345HfGjC027240; Fri, 5 May 2023 17:44:30 GMT Received: from nam12-dm6-obe.outbound.protection.outlook.com (mail-dm6nam12lp2176.outbound.protection.outlook.com [104.47.59.176]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3q8spgf01c-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 05 May 2023 17:44:30 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=c8/TzMMSmm1RRmkYCc0d/Jd77Bm6th9D3QNDK6hAt9ailJ/zMTvff/IbcfGe1xIGv8TP6vv2Iu9JmESkEwEHcPnAkCJZax1ZgGXbMOUmMDk5Nr1rNDP+iJjyNOdbjKPcZZm2qamEOwq4w8u0jJTOU25hLd4oTgqYCAMncztMwwOKKSEbcjR8CLYgDKAYizeFQMm7+SdDlVit1WeydeXlaxuRnbNNf+ZcK2PCJ6PX4/mA835oZXlrI7+Q3pc0t3CL7D+zZURBJp9uSvaDNjAJYlpEfYdfjG/igwmCFgOJ6dIpqPEtUYFPHdTIjX2lULUbGh2aOFcSb3d54K45zNr1Fw== 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=PW5eX7vH7gHjRX0FYYq80BUyJ8oQwCendk+71PT1yxg=; b=LFIdIxsFEy68e2BC/6xhGdrveYLCuL85feByPpSLENkSdtUT0hzMg+SnuICjaHMwscAdjjTSudu6KMQQohFuChoN3TdqWp0jDFY6AvSloqoSF+RzCES6/466qL/aT9Sxdu2O6k4DHd1hJVFJZ1tWvUcLcESGN8pcfhEYt0IFHmRNFyO3/ZqNPL6L6exowHDRDGncJ2IvlKLf6xW+Ag4S4N0W6FjjUcqtVzccOGVbR1ConLZ3vgLCQiQ5TmfhtGAl3nSI9grXOvIMxOeMVkwOiogHQHRp70FwwSmcbhfWBckAftpBlQD06gRsufFxlTqufrDYixL+vE4dc670gHgVnQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=PW5eX7vH7gHjRX0FYYq80BUyJ8oQwCendk+71PT1yxg=; b=i8d1BGMKGrhq/A7D/sN7cAVqo0cbySZwUPhYYqZH9kJoOnEF505MM+BJdMi5+jy4uK/SKMIVwHKvcGOUyCKl+SXwpd2MPefu0JoB0aGfhPsEvN5Y+rGNJMctSslgVLnVbgdGrDp85wkxNN0W0EUqj9D+ZTWbKtDjEyaiiNlhBoU= Received: from SN6PR10MB3022.namprd10.prod.outlook.com (2603:10b6:805:d8::25) by BL3PR10MB6089.namprd10.prod.outlook.com (2603:10b6:208:3b5::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6363.27; Fri, 5 May 2023 17:44:27 +0000 Received: from SN6PR10MB3022.namprd10.prod.outlook.com ([fe80::8bb9:2bb7:3930:b5da]) by SN6PR10MB3022.namprd10.prod.outlook.com ([fe80::8bb9:2bb7:3930:b5da%7]) with mapi id 15.20.6363.022; Fri, 5 May 2023 17:44:27 +0000 From: "Liam R. Howlett" To: Andrew Morton Cc: maple-tree@lists.infradead.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, "Liam R. Howlett" Subject: [PATCH v2 19/36] maple_tree: Add __init and __exit to test module Date: Fri, 5 May 2023 13:41:47 -0400 Message-Id: <20230505174204.2665599-20-Liam.Howlett@oracle.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230505174204.2665599-1-Liam.Howlett@oracle.com> References: <20230505174204.2665599-1-Liam.Howlett@oracle.com> X-ClientProxiedBy: YT4P288CA0025.CANP288.PROD.OUTLOOK.COM (2603:10b6:b01:d3::10) To SN6PR10MB3022.namprd10.prod.outlook.com (2603:10b6:805:d8::25) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN6PR10MB3022:EE_|BL3PR10MB6089:EE_ X-MS-Office365-Filtering-Correlation-Id: 52865adb-e4b8-4db3-349e-08db4d905f70 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: kIqw+XVXS9Q3WFu5CUPsJjzSOkDjwx/pNuoJRRG/gtXLGvVjIrE1PDTOivWIBvy/NQSU2pQ45DyYTp2lMYduacjjJLpat1F+qqnkqm8DE+UgH8w8N+Ry4Ivod8MW5dBRCiZAyuEtU4+ogJsaXGPSwd8QLUepaugeQmRk6eQrns6SEiNRdEs02GTjfwKD3Da/ftq6QM6pP2CbjVWwN7ZdIk2AF//ZNY6nNemeuw93OLiAKZOApXZcK+y5NR7wv/mif1wA1qD3HBIi3RVIy3hhZAynky1JXztPBqxILCFT1Thn7DrFMSXFq3R1Zru+SllxXwv0THoXgt4IvXgFovP6wNlrI78EfdKuFYkKXwVmgGMsJl5YijbUx47ifOFXoFpL0AF83szfx2EvS+dzcd+b7XgsrKbxrPUZQwiOpEpUalFGYrbpeVY+ZWvtm5dCzQNr6x9yQKp+Y87X8YZNR4LfSubE0Bd86PHfkF8iBCK/lzF3nEH4fI7uXWc10CARn/fxEUlw/ZghiEQl7vxmwIOvfE94ad/igwoYp8oF3OUDSYZAEd2ra44ygoI38Eck7bS/ X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SN6PR10MB3022.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(396003)(346002)(366004)(39860400002)(376002)(136003)(451199021)(66476007)(6916009)(4326008)(66946007)(66556008)(6666004)(478600001)(6486002)(316002)(36756003)(86362001)(40140700001)(83380400001)(107886003)(2616005)(6506007)(1076003)(26005)(6512007)(8936002)(5660300002)(8676002)(2906002)(41300700001)(30864003)(186003)(38100700002)(579004);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: lJkO0d4AdAwTCf7ROBkKSq/+9vA+Rd8CirGdtTTD/7HdA8DcVRSZWVIK3UEuG90vb4fFNHoySaIZMGj7FvyanjA0hCk3H3I+oT/ulpxM+wgc4mqTvBPKaPb4NSZm9H9XcX0kVaWr+9/9EPR8L8BbJEEp23pexhOExdLk87CzJQIpssC3ZADKMacfbRMD8PZuWvXe5bKsxl/OCM+YALzTsfITQ6MZDvPrHsnUFI8DJ+KkeReUWnh2esVIYtW5VMrRktyoqC3iU2Ox/WXVBjYTq+xWywRtngceP0phdirz2Fbri7MiZnvsxAWjuzKJOU0xaKmydarTV64CVMJ6Z1b/k9U0h1i5XSnKQjLnRmU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ajEe8eOEQBTzo29HcyeoAj8Z9KYJoHhTO2HB3GhdjLpE0WHMQrurVyXEVy81mFp81pdaArpa6vKujJvjKOKoE9i2/4btPQ== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 52865adb-e4b8-4db3-349e-08db4d905f70 X-MS-Exchange-CrossTenant-AuthSource: SN6PR10MB3022.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 May 2023 17:44:27.6423 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: ScagpqOdwyQRGrD5S8844fBcIQrt4I5oGW+UXi0hXL1156ieS6tAj1JZ32UPpzp301rYbCAKxVShh1RQlpGW9w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL3PR10MB6089 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-05-05_24,2023-05-05_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 bulkscore=0 spamscore=0 mlxlogscore=999 mlxscore=0 adultscore=0 phishscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303200000 definitions=main-2305050146 X-Proofpoint-GUID: bmhKVOKXy0vVrmTLxUlQsIUAQmxxJRrs X-Proofpoint-ORIG-GUID: bmhKVOKXy0vVrmTLxUlQsIUAQmxxJRrs X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: The test functions are not needed after the module is removed, so mark them as such. Add __exit to the module removal function. Some other variables have been marked as const static as well. Suggested-by: Andrew Morton Signed-off-by: Liam R. Howlett --- lib/test_maple_tree.c | 158 +++++++++++++------------- tools/testing/radix-tree/linux/init.h | 1 + tools/testing/radix-tree/maple.c | 147 ++++++++++++------------ 3 files changed, 155 insertions(+), 151 deletions(-) diff --git a/lib/test_maple_tree.c b/lib/test_maple_tree.c index 93b40a78c4f55..19b130c9dddea 100644 --- a/lib/test_maple_tree.c +++ b/lib/test_maple_tree.c @@ -51,54 +51,54 @@ atomic_t maple_tree_tests_passed; #else #define cond_resched() do {} while (0) #endif -static -int mtree_insert_index(struct maple_tree *mt, unsigned long index, gfp_t gfp) +static int __init mtree_insert_index(struct maple_tree *mt, + unsigned long index, gfp_t gfp) { return mtree_insert(mt, index, xa_mk_value(index & LONG_MAX), gfp); } -static void mtree_erase_index(struct maple_tree *mt, unsigned long index) +static void __init mtree_erase_index(struct maple_tree *mt, unsigned long index) { MT_BUG_ON(mt, mtree_erase(mt, index) != xa_mk_value(index & LONG_MAX)); MT_BUG_ON(mt, mtree_load(mt, index) != NULL); } -static int mtree_test_insert(struct maple_tree *mt, unsigned long index, +static int __init mtree_test_insert(struct maple_tree *mt, unsigned long index, void *ptr) { return mtree_insert(mt, index, ptr, GFP_KERNEL); } -static int mtree_test_store_range(struct maple_tree *mt, unsigned long start, - unsigned long end, void *ptr) +static int __init mtree_test_store_range(struct maple_tree *mt, + unsigned long start, unsigned long end, void *ptr) { return mtree_store_range(mt, start, end, ptr, GFP_KERNEL); } -static int mtree_test_store(struct maple_tree *mt, unsigned long start, +static int __init mtree_test_store(struct maple_tree *mt, unsigned long start, void *ptr) { return mtree_test_store_range(mt, start, start, ptr); } -static int mtree_test_insert_range(struct maple_tree *mt, unsigned long start, - unsigned long end, void *ptr) +static int __init mtree_test_insert_range(struct maple_tree *mt, + unsigned long start, unsigned long end, void *ptr) { return mtree_insert_range(mt, start, end, ptr, GFP_KERNEL); } -static void *mtree_test_load(struct maple_tree *mt, unsigned long index) +static void __init *mtree_test_load(struct maple_tree *mt, unsigned long index) { return mtree_load(mt, index); } -static void *mtree_test_erase(struct maple_tree *mt, unsigned long index) +static void __init *mtree_test_erase(struct maple_tree *mt, unsigned long index) { return mtree_erase(mt, index); } #if defined(CONFIG_64BIT) -static noinline void check_mtree_alloc_range(struct maple_tree *mt, +static noinline void __init check_mtree_alloc_range(struct maple_tree *mt, unsigned long start, unsigned long end, unsigned long size, unsigned long expected, int eret, void *ptr) { @@ -115,7 +115,7 @@ static noinline void check_mtree_alloc_range(struct maple_tree *mt, MT_BUG_ON(mt, result != expected); } -static noinline void check_mtree_alloc_rrange(struct maple_tree *mt, +static noinline void __init check_mtree_alloc_rrange(struct maple_tree *mt, unsigned long start, unsigned long end, unsigned long size, unsigned long expected, int eret, void *ptr) { @@ -133,8 +133,8 @@ static noinline void check_mtree_alloc_rrange(struct maple_tree *mt, } #endif -static noinline void check_load(struct maple_tree *mt, unsigned long index, - void *ptr) +static noinline void __init check_load(struct maple_tree *mt, + unsigned long index, void *ptr) { void *ret = mtree_test_load(mt, index); @@ -143,7 +143,7 @@ static noinline void check_load(struct maple_tree *mt, unsigned long index, MT_BUG_ON(mt, ret != ptr); } -static noinline void check_store_range(struct maple_tree *mt, +static noinline void __init check_store_range(struct maple_tree *mt, unsigned long start, unsigned long end, void *ptr, int expected) { int ret = -EINVAL; @@ -159,7 +159,7 @@ static noinline void check_store_range(struct maple_tree *mt, check_load(mt, i, ptr); } -static noinline void check_insert_range(struct maple_tree *mt, +static noinline void __init check_insert_range(struct maple_tree *mt, unsigned long start, unsigned long end, void *ptr, int expected) { int ret = -EINVAL; @@ -175,8 +175,8 @@ static noinline void check_insert_range(struct maple_tree *mt, check_load(mt, i, ptr); } -static noinline void check_insert(struct maple_tree *mt, unsigned long index, - void *ptr) +static noinline void __init check_insert(struct maple_tree *mt, + unsigned long index, void *ptr) { int ret = -EINVAL; @@ -184,7 +184,7 @@ static noinline void check_insert(struct maple_tree *mt, unsigned long index, MT_BUG_ON(mt, ret != 0); } -static noinline void check_dup_insert(struct maple_tree *mt, +static noinline void __init check_dup_insert(struct maple_tree *mt, unsigned long index, void *ptr) { int ret = -EINVAL; @@ -194,13 +194,13 @@ static noinline void check_dup_insert(struct maple_tree *mt, } -static noinline -void check_index_load(struct maple_tree *mt, unsigned long index) +static noinline void __init check_index_load(struct maple_tree *mt, + unsigned long index) { return check_load(mt, index, xa_mk_value(index & LONG_MAX)); } -static inline int not_empty(struct maple_node *node) +static inline __init int not_empty(struct maple_node *node) { int i; @@ -215,8 +215,8 @@ static inline int not_empty(struct maple_node *node) } -static noinline void check_rev_seq(struct maple_tree *mt, unsigned long max, - bool verbose) +static noinline void __init check_rev_seq(struct maple_tree *mt, + unsigned long max, bool verbose) { unsigned long i = max, j; @@ -248,7 +248,7 @@ static noinline void check_rev_seq(struct maple_tree *mt, unsigned long max, #endif } -static noinline void check_seq(struct maple_tree *mt, unsigned long max, +static noinline void __init check_seq(struct maple_tree *mt, unsigned long max, bool verbose) { unsigned long i, j; @@ -277,7 +277,7 @@ static noinline void check_seq(struct maple_tree *mt, unsigned long max, #endif } -static noinline void check_lb_not_empty(struct maple_tree *mt) +static noinline void __init check_lb_not_empty(struct maple_tree *mt) { unsigned long i, j; unsigned long huge = 4000UL * 1000 * 1000; @@ -296,13 +296,13 @@ static noinline void check_lb_not_empty(struct maple_tree *mt) mtree_destroy(mt); } -static noinline void check_lower_bound_split(struct maple_tree *mt) +static noinline void __init check_lower_bound_split(struct maple_tree *mt) { MT_BUG_ON(mt, !mtree_empty(mt)); check_lb_not_empty(mt); } -static noinline void check_upper_bound_split(struct maple_tree *mt) +static noinline void __init check_upper_bound_split(struct maple_tree *mt) { unsigned long i, j; unsigned long huge; @@ -327,7 +327,7 @@ static noinline void check_upper_bound_split(struct maple_tree *mt) mtree_destroy(mt); } -static noinline void check_mid_split(struct maple_tree *mt) +static noinline void __init check_mid_split(struct maple_tree *mt) { unsigned long huge = 8000UL * 1000 * 1000; @@ -336,7 +336,7 @@ static noinline void check_mid_split(struct maple_tree *mt) check_lb_not_empty(mt); } -static noinline void check_rev_find(struct maple_tree *mt) +static noinline void __init check_rev_find(struct maple_tree *mt) { int i, nr_entries = 200; void *val; @@ -375,7 +375,7 @@ static noinline void check_rev_find(struct maple_tree *mt) rcu_read_unlock(); } -static noinline void check_find(struct maple_tree *mt) +static noinline void __init check_find(struct maple_tree *mt) { unsigned long val = 0; unsigned long count; @@ -592,7 +592,7 @@ static noinline void check_find(struct maple_tree *mt) mtree_destroy(mt); } -static noinline void check_find_2(struct maple_tree *mt) +static noinline void __init check_find_2(struct maple_tree *mt) { unsigned long i, j; void *entry; @@ -637,7 +637,7 @@ static noinline void check_find_2(struct maple_tree *mt) #if defined(CONFIG_64BIT) -static noinline void check_alloc_rev_range(struct maple_tree *mt) +static noinline void __init check_alloc_rev_range(struct maple_tree *mt) { /* * Generated by: @@ -645,7 +645,7 @@ static noinline void check_alloc_rev_range(struct maple_tree *mt) * awk -F "-" '{printf "0x%s, 0x%s, ", $1, $2}' */ - unsigned long range[] = { + static const unsigned long range[] = { /* Inclusive , Exclusive. */ 0x565234af2000, 0x565234af4000, 0x565234af4000, 0x565234af9000, @@ -673,7 +673,7 @@ static noinline void check_alloc_rev_range(struct maple_tree *mt) 0x7fff58791000, 0x7fff58793000, }; - unsigned long holes[] = { + static const unsigned long holes[] = { /* * Note: start of hole is INCLUSIVE * end of hole is EXCLUSIVE @@ -693,7 +693,7 @@ static noinline void check_alloc_rev_range(struct maple_tree *mt) * 4. number that should be returned. * 5. return value */ - unsigned long req_range[] = { + static const unsigned long req_range[] = { 0x565234af9000, /* Min */ 0x7fff58791000, /* Max */ 0x1000, /* Size */ @@ -804,7 +804,7 @@ static noinline void check_alloc_rev_range(struct maple_tree *mt) mtree_destroy(mt); } -static noinline void check_alloc_range(struct maple_tree *mt) +static noinline void __init check_alloc_range(struct maple_tree *mt) { /* * Generated by: @@ -812,7 +812,7 @@ static noinline void check_alloc_range(struct maple_tree *mt) * awk -F "-" '{printf "0x%s, 0x%s, ", $1, $2}' */ - unsigned long range[] = { + static const unsigned long range[] = { /* Inclusive , Exclusive. */ 0x565234af2000, 0x565234af4000, 0x565234af4000, 0x565234af9000, @@ -839,7 +839,7 @@ static noinline void check_alloc_range(struct maple_tree *mt) 0x7fff5878e000, 0x7fff58791000, 0x7fff58791000, 0x7fff58793000, }; - unsigned long holes[] = { + static const unsigned long holes[] = { /* Start of hole, end of hole, size of hole (+1) */ 0x565234afb000, 0x565234afc000, 0x1000, 0x565234afe000, 0x565235def000, 0x12F1000, @@ -854,7 +854,7 @@ static noinline void check_alloc_range(struct maple_tree *mt) * 4. number that should be returned. * 5. return value */ - unsigned long req_range[] = { + static const unsigned long req_range[] = { 0x565234af9000, /* Min */ 0x7fff58791000, /* Max */ 0x1000, /* Size */ @@ -963,10 +963,10 @@ static noinline void check_alloc_range(struct maple_tree *mt) } #endif -static noinline void check_ranges(struct maple_tree *mt) +static noinline void __init check_ranges(struct maple_tree *mt) { int i, val, val2; - unsigned long r[] = { + static const unsigned long r[] = { 10, 15, 20, 25, 17, 22, /* Overlaps previous range. */ @@ -1231,7 +1231,7 @@ static noinline void check_ranges(struct maple_tree *mt) MT_BUG_ON(mt, mt_height(mt) != 4); } -static noinline void check_next_entry(struct maple_tree *mt) +static noinline void __init check_next_entry(struct maple_tree *mt) { void *entry = NULL; unsigned long limit = 30, i = 0; @@ -1255,7 +1255,7 @@ static noinline void check_next_entry(struct maple_tree *mt) mtree_destroy(mt); } -static noinline void check_prev_entry(struct maple_tree *mt) +static noinline void __init check_prev_entry(struct maple_tree *mt) { unsigned long index = 16; void *value; @@ -1299,7 +1299,7 @@ static noinline void check_prev_entry(struct maple_tree *mt) mas_unlock(&mas); } -static noinline void check_root_expand(struct maple_tree *mt) +static noinline void __init check_root_expand(struct maple_tree *mt) { MA_STATE(mas, mt, 0, 0); void *ptr; @@ -1388,13 +1388,13 @@ static noinline void check_root_expand(struct maple_tree *mt) mas_unlock(&mas); } -static noinline void check_gap_combining(struct maple_tree *mt) +static noinline void __init check_gap_combining(struct maple_tree *mt) { struct maple_enode *mn1, *mn2; void *entry; unsigned long singletons = 100; - unsigned long *seq100; - unsigned long seq100_64[] = { + static const unsigned long *seq100; + static const unsigned long seq100_64[] = { /* 0-5 */ 74, 75, 76, 50, 100, 2, @@ -1408,7 +1408,7 @@ static noinline void check_gap_combining(struct maple_tree *mt) 76, 2, 79, 85, 4, }; - unsigned long seq100_32[] = { + static const unsigned long seq100_32[] = { /* 0-5 */ 61, 62, 63, 50, 100, 2, @@ -1422,11 +1422,11 @@ static noinline void check_gap_combining(struct maple_tree *mt) 76, 2, 79, 85, 4, }; - unsigned long seq2000[] = { + static const unsigned long seq2000[] = { 1152, 1151, 1100, 1200, 2, }; - unsigned long seq400[] = { + static const unsigned long seq400[] = { 286, 318, 256, 260, 266, 270, 275, 280, 290, 398, 286, 310, @@ -1585,7 +1585,7 @@ static noinline void check_gap_combining(struct maple_tree *mt) mt_set_non_kernel(0); mtree_destroy(mt); } -static noinline void check_node_overwrite(struct maple_tree *mt) +static noinline void __init check_node_overwrite(struct maple_tree *mt) { int i, max = 4000; @@ -1598,7 +1598,7 @@ static noinline void check_node_overwrite(struct maple_tree *mt) } #if defined(BENCH_SLOT_STORE) -static noinline void bench_slot_store(struct maple_tree *mt) +static noinline void __init bench_slot_store(struct maple_tree *mt) { int i, brk = 105, max = 1040, brk_start = 100, count = 20000000; @@ -1614,7 +1614,7 @@ static noinline void bench_slot_store(struct maple_tree *mt) #endif #if defined(BENCH_NODE_STORE) -static noinline void bench_node_store(struct maple_tree *mt) +static noinline void __init bench_node_store(struct maple_tree *mt) { int i, overwrite = 76, max = 240, count = 20000000; @@ -1633,7 +1633,7 @@ static noinline void bench_node_store(struct maple_tree *mt) #endif #if defined(BENCH_AWALK) -static noinline void bench_awalk(struct maple_tree *mt) +static noinline void __init bench_awalk(struct maple_tree *mt) { int i, max = 2500, count = 50000000; MA_STATE(mas, mt, 1470, 1470); @@ -1650,7 +1650,7 @@ static noinline void bench_awalk(struct maple_tree *mt) } #endif #if defined(BENCH_WALK) -static noinline void bench_walk(struct maple_tree *mt) +static noinline void __init bench_walk(struct maple_tree *mt) { int i, max = 2500, count = 550000000; MA_STATE(mas, mt, 1470, 1470); @@ -1667,7 +1667,7 @@ static noinline void bench_walk(struct maple_tree *mt) #endif #if defined(BENCH_MT_FOR_EACH) -static noinline void bench_mt_for_each(struct maple_tree *mt) +static noinline void __init bench_mt_for_each(struct maple_tree *mt) { int i, count = 1000000; unsigned long max = 2500, index = 0; @@ -1691,7 +1691,7 @@ static noinline void bench_mt_for_each(struct maple_tree *mt) #endif /* check_forking - simulate the kernel forking sequence with the tree. */ -static noinline void check_forking(struct maple_tree *mt) +static noinline void __init check_forking(struct maple_tree *mt) { struct maple_tree newmt; @@ -1730,7 +1730,7 @@ static noinline void check_forking(struct maple_tree *mt) mtree_destroy(&newmt); } -static noinline void check_iteration(struct maple_tree *mt) +static noinline void __init check_iteration(struct maple_tree *mt) { int i, nr_entries = 125; void *val; @@ -1798,7 +1798,7 @@ static noinline void check_iteration(struct maple_tree *mt) mt_set_non_kernel(0); } -static noinline void check_mas_store_gfp(struct maple_tree *mt) +static noinline void __init check_mas_store_gfp(struct maple_tree *mt) { struct maple_tree newmt; @@ -1831,7 +1831,7 @@ static noinline void check_mas_store_gfp(struct maple_tree *mt) } #if defined(BENCH_FORK) -static noinline void bench_forking(struct maple_tree *mt) +static noinline void __init bench_forking(struct maple_tree *mt) { struct maple_tree newmt; @@ -1873,15 +1873,17 @@ static noinline void bench_forking(struct maple_tree *mt) } #endif -static noinline void next_prev_test(struct maple_tree *mt) +static noinline void __init next_prev_test(struct maple_tree *mt) { int i, nr_entries; void *val; MA_STATE(mas, mt, 0, 0); struct maple_enode *mn; - unsigned long *level2; - unsigned long level2_64[] = {707, 1000, 710, 715, 720, 725}; - unsigned long level2_32[] = {1747, 2000, 1750, 1755, 1760, 1765}; + static const unsigned long *level2; + static const unsigned long level2_64[] = { 707, 1000, 710, 715, 720, + 725}; + static const unsigned long level2_32[] = { 1747, 2000, 1750, 1755, + 1760, 1765}; if (MAPLE_32BIT) { nr_entries = 500; @@ -2049,7 +2051,7 @@ static noinline void next_prev_test(struct maple_tree *mt) /* Test spanning writes that require balancing right sibling or right cousin */ -static noinline void check_spanning_relatives(struct maple_tree *mt) +static noinline void __init check_spanning_relatives(struct maple_tree *mt) { unsigned long i, nr_entries = 1000; @@ -2062,7 +2064,7 @@ static noinline void check_spanning_relatives(struct maple_tree *mt) mtree_store_range(mt, 9365, 9955, NULL, GFP_KERNEL); } -static noinline void check_fuzzer(struct maple_tree *mt) +static noinline void __init check_fuzzer(struct maple_tree *mt) { /* * 1. Causes a spanning rebalance of a single root node. @@ -2459,7 +2461,7 @@ static noinline void check_fuzzer(struct maple_tree *mt) } /* duplicate the tree with a specific gap */ -static noinline void check_dup_gaps(struct maple_tree *mt, +static noinline void __init check_dup_gaps(struct maple_tree *mt, unsigned long nr_entries, bool zero_start, unsigned long gap) { @@ -2499,7 +2501,7 @@ static noinline void check_dup_gaps(struct maple_tree *mt, } /* Duplicate many sizes of trees. Mainly to test expected entry values */ -static noinline void check_dup(struct maple_tree *mt) +static noinline void __init check_dup(struct maple_tree *mt) { int i; int big_start = 100010; @@ -2587,7 +2589,7 @@ static noinline void check_dup(struct maple_tree *mt) } } -static noinline void check_bnode_min_spanning(struct maple_tree *mt) +static noinline void __init check_bnode_min_spanning(struct maple_tree *mt) { int i = 50; MA_STATE(mas, mt, 0, 0); @@ -2606,7 +2608,7 @@ static noinline void check_bnode_min_spanning(struct maple_tree *mt) mt_set_non_kernel(0); } -static noinline void check_empty_area_window(struct maple_tree *mt) +static noinline void __init check_empty_area_window(struct maple_tree *mt) { unsigned long i, nr_entries = 20; MA_STATE(mas, mt, 0, 0); @@ -2691,7 +2693,7 @@ static noinline void check_empty_area_window(struct maple_tree *mt) rcu_read_unlock(); } -static noinline void check_empty_area_fill(struct maple_tree *mt) +static noinline void __init check_empty_area_fill(struct maple_tree *mt) { const unsigned long max = 0x25D78000; unsigned long size; @@ -2735,11 +2737,11 @@ static noinline void check_empty_area_fill(struct maple_tree *mt) } static DEFINE_MTREE(tree); -static int maple_tree_seed(void) +static int __init maple_tree_seed(void) { - unsigned long set[] = {5015, 5014, 5017, 25, 1000, - 1001, 1002, 1003, 1005, 0, - 5003, 5002}; + unsigned long set[] = { 5015, 5014, 5017, 25, 1000, + 1001, 1002, 1003, 1005, 0, + 5003, 5002}; void *ptr = &set; pr_info("\nTEST STARTING\n\n"); @@ -3009,7 +3011,7 @@ static int maple_tree_seed(void) return -EINVAL; } -static void maple_tree_harvest(void) +static void __exit maple_tree_harvest(void) { } diff --git a/tools/testing/radix-tree/linux/init.h b/tools/testing/radix-tree/linux/init.h index 1bb0afc213099..81563c3dfce79 100644 --- a/tools/testing/radix-tree/linux/init.h +++ b/tools/testing/radix-tree/linux/init.h @@ -1 +1,2 @@ #define __init +#define __exit diff --git a/tools/testing/radix-tree/maple.c b/tools/testing/radix-tree/maple.c index cf37ed9ab6c4d..03539d86cdf0f 100644 --- a/tools/testing/radix-tree/maple.c +++ b/tools/testing/radix-tree/maple.c @@ -14,6 +14,7 @@ #include "test.h" #include #include +#include "linux/init.h" #define module_init(x) #define module_exit(x) @@ -80,7 +81,7 @@ static void check_mas_alloc_node_count(struct ma_state *mas) * check_new_node() - Check the creation of new nodes and error path * verification. */ -static noinline void check_new_node(struct maple_tree *mt) +static noinline void __init check_new_node(struct maple_tree *mt) { struct maple_node *mn, *mn2, *mn3; @@ -454,7 +455,7 @@ static noinline void check_new_node(struct maple_tree *mt) /* * Check erasing including RCU. */ -static noinline void check_erase(struct maple_tree *mt, unsigned long index, +static noinline void __init check_erase(struct maple_tree *mt, unsigned long index, void *ptr) { MT_BUG_ON(mt, mtree_test_erase(mt, index) != ptr); @@ -464,24 +465,24 @@ static noinline void check_erase(struct maple_tree *mt, unsigned long index, #define erase_check_insert(mt, i) check_insert(mt, set[i], entry[i%2]) #define erase_check_erase(mt, i) check_erase(mt, set[i], entry[i%2]) -static noinline void check_erase_testset(struct maple_tree *mt) +static noinline void __init check_erase_testset(struct maple_tree *mt) { - unsigned long set[] = { 5015, 5014, 5017, 25, 1000, - 1001, 1002, 1003, 1005, 0, - 6003, 6002, 6008, 6012, 6015, - 7003, 7002, 7008, 7012, 7015, - 8003, 8002, 8008, 8012, 8015, - 9003, 9002, 9008, 9012, 9015, - 10003, 10002, 10008, 10012, 10015, - 11003, 11002, 11008, 11012, 11015, - 12003, 12002, 12008, 12012, 12015, - 13003, 13002, 13008, 13012, 13015, - 14003, 14002, 14008, 14012, 14015, - 15003, 15002, 15008, 15012, 15015, - }; - - - void *ptr = &set; + static const unsigned long set[] = { 5015, 5014, 5017, 25, 1000, + 1001, 1002, 1003, 1005, 0, + 6003, 6002, 6008, 6012, 6015, + 7003, 7002, 7008, 7012, 7015, + 8003, 8002, 8008, 8012, 8015, + 9003, 9002, 9008, 9012, 9015, + 10003, 10002, 10008, 10012, 10015, + 11003, 11002, 11008, 11012, 11015, + 12003, 12002, 12008, 12012, 12015, + 13003, 13002, 13008, 13012, 13015, + 14003, 14002, 14008, 14012, 14015, + 15003, 15002, 15008, 15012, 15015, + }; + + + void *ptr = &check_erase_testset; void *entry[2] = { ptr, mt }; void *root_node; @@ -738,7 +739,7 @@ static noinline void check_erase_testset(struct maple_tree *mt) int mas_ce2_over_count(struct ma_state *mas_start, struct ma_state *mas_end, void *s_entry, unsigned long s_min, void *e_entry, unsigned long e_max, - unsigned long *set, int i, bool null_entry) + const unsigned long *set, int i, bool null_entry) { int count = 0, span = 0; unsigned long retry = 0; @@ -968,8 +969,8 @@ static inline void *mas_range_load(struct ma_state *mas, } #if defined(CONFIG_64BIT) -static noinline void check_erase2_testset(struct maple_tree *mt, - unsigned long *set, unsigned long size) +static noinline void __init check_erase2_testset(struct maple_tree *mt, + const unsigned long *set, unsigned long size) { int entry_count = 0; int check = 0; @@ -1113,11 +1114,11 @@ static noinline void check_erase2_testset(struct maple_tree *mt, /* These tests were pulled from KVM tree modifications which failed. */ -static noinline void check_erase2_sets(struct maple_tree *mt) +static noinline void __init check_erase2_sets(struct maple_tree *mt) { void *entry; unsigned long start = 0; - unsigned long set[] = { + static const unsigned long set[] = { STORE, 140737488347136, 140737488351231, STORE, 140721266458624, 140737488351231, ERASE, 140721266458624, 140737488351231, @@ -1135,7 +1136,7 @@ ERASE, 140253902692352, 140253902864383, STORE, 140253902692352, 140253902696447, STORE, 140253902696448, 140253902864383, }; - unsigned long set2[] = { + static const unsigned long set2[] = { STORE, 140737488347136, 140737488351231, STORE, 140735933583360, 140737488351231, ERASE, 140735933583360, 140737488351231, @@ -1159,7 +1160,7 @@ STORE, 140277094813696, 140277094821887, STORE, 140277094821888, 140277094825983, STORE, 140735933906944, 140735933911039, }; - unsigned long set3[] = { + static const unsigned long set3[] = { STORE, 140737488347136, 140737488351231, STORE, 140735790264320, 140737488351231, ERASE, 140735790264320, 140737488351231, @@ -1202,7 +1203,7 @@ STORE, 47135835840512, 47135835885567, STORE, 47135835885568, 47135835893759, }; - unsigned long set4[] = { + static const unsigned long set4[] = { STORE, 140737488347136, 140737488351231, STORE, 140728251703296, 140737488351231, ERASE, 140728251703296, 140737488351231, @@ -1223,7 +1224,7 @@ ERASE, 47646523277312, 47646523445247, STORE, 47646523277312, 47646523400191, }; - unsigned long set5[] = { + static const unsigned long set5[] = { STORE, 140737488347136, 140737488351231, STORE, 140726874062848, 140737488351231, ERASE, 140726874062848, 140737488351231, @@ -1356,7 +1357,7 @@ STORE, 47884791619584, 47884791623679, STORE, 47884791623680, 47884791627775, }; - unsigned long set6[] = { + static const unsigned long set6[] = { STORE, 140737488347136, 140737488351231, STORE, 140722999021568, 140737488351231, ERASE, 140722999021568, 140737488351231, @@ -1488,7 +1489,7 @@ ERASE, 47430432014336, 47430432022527, STORE, 47430432014336, 47430432018431, STORE, 47430432018432, 47430432022527, }; - unsigned long set7[] = { + static const unsigned long set7[] = { STORE, 140737488347136, 140737488351231, STORE, 140729808330752, 140737488351231, ERASE, 140729808330752, 140737488351231, @@ -1620,7 +1621,7 @@ ERASE, 47439987130368, 47439987138559, STORE, 47439987130368, 47439987134463, STORE, 47439987134464, 47439987138559, }; - unsigned long set8[] = { + static const unsigned long set8[] = { STORE, 140737488347136, 140737488351231, STORE, 140722482974720, 140737488351231, ERASE, 140722482974720, 140737488351231, @@ -1753,7 +1754,7 @@ STORE, 47708488638464, 47708488642559, STORE, 47708488642560, 47708488646655, }; - unsigned long set9[] = { + static const unsigned long set9[] = { STORE, 140737488347136, 140737488351231, STORE, 140736427839488, 140737488351231, ERASE, 140736427839488, 140736427839488, @@ -5619,7 +5620,7 @@ ERASE, 47906195480576, 47906195480576, STORE, 94641242615808, 94641242750975, }; - unsigned long set10[] = { + static const unsigned long set10[] = { STORE, 140737488347136, 140737488351231, STORE, 140736427839488, 140737488351231, ERASE, 140736427839488, 140736427839488, @@ -9483,7 +9484,7 @@ STORE, 139726599680000, 139726599684095, ERASE, 47906195480576, 47906195480576, STORE, 94641242615808, 94641242750975, }; - unsigned long set11[] = { + static const unsigned long set11[] = { STORE, 140737488347136, 140737488351231, STORE, 140732658499584, 140737488351231, ERASE, 140732658499584, 140732658499584, @@ -9509,7 +9510,7 @@ STORE, 140732658565120, 140732658569215, STORE, 140732658552832, 140732658565119, }; - unsigned long set12[] = { /* contains 12 values. */ + static const unsigned long set12[] = { /* contains 12 values. */ STORE, 140737488347136, 140737488351231, STORE, 140732658499584, 140737488351231, ERASE, 140732658499584, 140732658499584, @@ -9536,7 +9537,7 @@ STORE, 140732658552832, 140732658565119, STORE, 140014592741375, 140014592741375, /* contrived */ STORE, 140014592733184, 140014592741376, /* creates first entry retry. */ }; - unsigned long set13[] = { + static const unsigned long set13[] = { STORE, 140373516247040, 140373516251135,/*: ffffa2e7b0e10d80 */ STORE, 140373516251136, 140373516255231,/*: ffffa2e7b1195d80 */ STORE, 140373516255232, 140373516443647,/*: ffffa2e7b0e109c0 */ @@ -9549,7 +9550,7 @@ STORE, 140373518684160, 140373518688254,/*: ffffa2e7b05fec00 */ STORE, 140373518688256, 140373518692351,/*: ffffa2e7bfbdcd80 */ STORE, 140373518692352, 140373518696447,/*: ffffa2e7b0749e40 */ }; - unsigned long set14[] = { + static const unsigned long set14[] = { STORE, 140737488347136, 140737488351231, STORE, 140731667996672, 140737488351231, SNULL, 140731668000767, 140737488351231, @@ -9833,7 +9834,7 @@ SNULL, 139826136543232, 139826136809471, STORE, 139826136809472, 139826136842239, STORE, 139826136543232, 139826136809471, }; - unsigned long set15[] = { + static const unsigned long set15[] = { STORE, 140737488347136, 140737488351231, STORE, 140722061451264, 140737488351231, SNULL, 140722061455359, 140737488351231, @@ -10118,7 +10119,7 @@ STORE, 139906808958976, 139906808991743, STORE, 139906808692736, 139906808958975, }; - unsigned long set16[] = { + static const unsigned long set16[] = { STORE, 94174808662016, 94174809321471, STORE, 94174811414528, 94174811426815, STORE, 94174811426816, 94174811430911, @@ -10329,7 +10330,7 @@ STORE, 139921865613312, 139921865617407, STORE, 139921865547776, 139921865564159, }; - unsigned long set17[] = { + static const unsigned long set17[] = { STORE, 94397057224704, 94397057646591, STORE, 94397057650688, 94397057691647, STORE, 94397057691648, 94397057695743, @@ -10391,7 +10392,7 @@ STORE, 140720477511680, 140720477646847, STORE, 140720478302208, 140720478314495, STORE, 140720478314496, 140720478318591, }; - unsigned long set18[] = { + static const unsigned long set18[] = { STORE, 140737488347136, 140737488351231, STORE, 140724953673728, 140737488351231, SNULL, 140724953677823, 140737488351231, @@ -10424,7 +10425,7 @@ STORE, 140222970597376, 140222970605567, ERASE, 140222970597376, 140222970605567, STORE, 140222970597376, 140222970605567, }; - unsigned long set19[] = { + static const unsigned long set19[] = { STORE, 140737488347136, 140737488351231, STORE, 140725182459904, 140737488351231, SNULL, 140725182463999, 140737488351231, @@ -10693,7 +10694,7 @@ STORE, 140656836775936, 140656836780031, STORE, 140656787476480, 140656791920639, ERASE, 140656774639616, 140656779083775, }; - unsigned long set20[] = { + static const unsigned long set20[] = { STORE, 140737488347136, 140737488351231, STORE, 140735952392192, 140737488351231, SNULL, 140735952396287, 140737488351231, @@ -10849,7 +10850,7 @@ STORE, 140590386819072, 140590386823167, STORE, 140590386823168, 140590386827263, SNULL, 140590376591359, 140590376595455, }; - unsigned long set21[] = { + static const unsigned long set21[] = { STORE, 93874710941696, 93874711363583, STORE, 93874711367680, 93874711408639, STORE, 93874711408640, 93874711412735, @@ -10919,7 +10920,7 @@ ERASE, 140708393312256, 140708393316351, ERASE, 140708393308160, 140708393312255, ERASE, 140708393291776, 140708393308159, }; - unsigned long set22[] = { + static const unsigned long set22[] = { STORE, 93951397134336, 93951397183487, STORE, 93951397183488, 93951397728255, STORE, 93951397728256, 93951397826559, @@ -11046,7 +11047,7 @@ STORE, 140551361253376, 140551361519615, ERASE, 140551361253376, 140551361519615, }; - unsigned long set23[] = { + static const unsigned long set23[] = { STORE, 94014447943680, 94014448156671, STORE, 94014450253824, 94014450257919, STORE, 94014450257920, 94014450266111, @@ -14370,7 +14371,7 @@ SNULL, 140175956627455, 140175985139711, STORE, 140175927242752, 140175956627455, STORE, 140175956627456, 140175985139711, }; - unsigned long set24[] = { + static const unsigned long set24[] = { STORE, 140737488347136, 140737488351231, STORE, 140735281639424, 140737488351231, SNULL, 140735281643519, 140737488351231, @@ -15532,7 +15533,7 @@ ERASE, 139635393024000, 139635401412607, ERASE, 139635384627200, 139635384631295, ERASE, 139635384631296, 139635393019903, }; - unsigned long set25[] = { + static const unsigned long set25[] = { STORE, 140737488347136, 140737488351231, STORE, 140737488343040, 140737488351231, STORE, 140722547441664, 140737488351231, @@ -22320,7 +22321,7 @@ STORE, 140249652703232, 140249682087935, STORE, 140249682087936, 140249710600191, }; - unsigned long set26[] = { + static const unsigned long set26[] = { STORE, 140737488347136, 140737488351231, STORE, 140729464770560, 140737488351231, SNULL, 140729464774655, 140737488351231, @@ -22344,7 +22345,7 @@ ERASE, 140109040951296, 140109040959487, STORE, 140109040955392, 140109040959487, ERASE, 140109040955392, 140109040959487, }; - unsigned long set27[] = { + static const unsigned long set27[] = { STORE, 140737488347136, 140737488351231, STORE, 140726128070656, 140737488351231, SNULL, 140726128074751, 140737488351231, @@ -22740,7 +22741,7 @@ STORE, 140415509696512, 140415535910911, ERASE, 140415537422336, 140415562588159, STORE, 140415482433536, 140415509696511, }; - unsigned long set28[] = { + static const unsigned long set28[] = { STORE, 140737488347136, 140737488351231, STORE, 140722475622400, 140737488351231, SNULL, 140722475626495, 140737488351231, @@ -22808,7 +22809,7 @@ STORE, 139918413348864, 139918413352959, ERASE, 139918413316096, 139918413344767, STORE, 93865848528896, 93865848664063, }; - unsigned long set29[] = { + static const unsigned long set29[] = { STORE, 140737488347136, 140737488351231, STORE, 140734467944448, 140737488351231, SNULL, 140734467948543, 140737488351231, @@ -23683,7 +23684,7 @@ ERASE, 140143079972864, 140143088361471, ERASE, 140143205793792, 140143205797887, ERASE, 140143205797888, 140143214186495, }; - unsigned long set30[] = { + static const unsigned long set30[] = { STORE, 140737488347136, 140737488351231, STORE, 140733436743680, 140737488351231, SNULL, 140733436747775, 140737488351231, @@ -24565,7 +24566,7 @@ ERASE, 140165225893888, 140165225897983, ERASE, 140165225897984, 140165234286591, ERASE, 140165058105344, 140165058109439, }; - unsigned long set31[] = { + static const unsigned long set31[] = { STORE, 140737488347136, 140737488351231, STORE, 140730890784768, 140737488351231, SNULL, 140730890788863, 140737488351231, @@ -25378,7 +25379,7 @@ ERASE, 140623906590720, 140623914979327, ERASE, 140622950277120, 140622950281215, ERASE, 140622950281216, 140622958669823, }; - unsigned long set32[] = { + static const unsigned long set32[] = { STORE, 140737488347136, 140737488351231, STORE, 140731244212224, 140737488351231, SNULL, 140731244216319, 140737488351231, @@ -26174,7 +26175,7 @@ ERASE, 140400417288192, 140400425676799, ERASE, 140400283066368, 140400283070463, ERASE, 140400283070464, 140400291459071, }; - unsigned long set33[] = { + static const unsigned long set33[] = { STORE, 140737488347136, 140737488351231, STORE, 140734562918400, 140737488351231, SNULL, 140734562922495, 140737488351231, @@ -26316,7 +26317,7 @@ STORE, 140582961786880, 140583003750399, ERASE, 140582961786880, 140583003750399, }; - unsigned long set34[] = { + static const unsigned long set34[] = { STORE, 140737488347136, 140737488351231, STORE, 140731327180800, 140737488351231, SNULL, 140731327184895, 140737488351231, @@ -27197,7 +27198,7 @@ ERASE, 140012522094592, 140012530483199, ERASE, 140012033142784, 140012033146879, ERASE, 140012033146880, 140012041535487, }; - unsigned long set35[] = { + static const unsigned long set35[] = { STORE, 140737488347136, 140737488351231, STORE, 140730536939520, 140737488351231, SNULL, 140730536943615, 140737488351231, @@ -27954,7 +27955,7 @@ ERASE, 140474471936000, 140474480324607, ERASE, 140474396430336, 140474396434431, ERASE, 140474396434432, 140474404823039, }; - unsigned long set36[] = { + static const unsigned long set36[] = { STORE, 140737488347136, 140737488351231, STORE, 140723893125120, 140737488351231, SNULL, 140723893129215, 140737488351231, @@ -28815,7 +28816,7 @@ ERASE, 140121890357248, 140121898745855, ERASE, 140121269587968, 140121269592063, ERASE, 140121269592064, 140121277980671, }; - unsigned long set37[] = { + static const unsigned long set37[] = { STORE, 140737488347136, 140737488351231, STORE, 140722404016128, 140737488351231, SNULL, 140722404020223, 140737488351231, @@ -28941,7 +28942,7 @@ STORE, 139759821246464, 139759888355327, ERASE, 139759821246464, 139759888355327, ERASE, 139759888355328, 139759955464191, }; - unsigned long set38[] = { + static const unsigned long set38[] = { STORE, 140737488347136, 140737488351231, STORE, 140730666221568, 140737488351231, SNULL, 140730666225663, 140737488351231, @@ -29751,7 +29752,7 @@ ERASE, 140613504712704, 140613504716799, ERASE, 140613504716800, 140613513105407, }; - unsigned long set39[] = { + static const unsigned long set39[] = { STORE, 140737488347136, 140737488351231, STORE, 140736271417344, 140737488351231, SNULL, 140736271421439, 140737488351231, @@ -30123,7 +30124,7 @@ STORE, 140325364428800, 140325372821503, STORE, 140325356036096, 140325364428799, SNULL, 140325364432895, 140325372821503, }; - unsigned long set40[] = { + static const unsigned long set40[] = { STORE, 140737488347136, 140737488351231, STORE, 140734309167104, 140737488351231, SNULL, 140734309171199, 140737488351231, @@ -30874,7 +30875,7 @@ ERASE, 140320289300480, 140320289304575, ERASE, 140320289304576, 140320297693183, ERASE, 140320163409920, 140320163414015, }; - unsigned long set41[] = { + static const unsigned long set41[] = { STORE, 140737488347136, 140737488351231, STORE, 140728157171712, 140737488351231, SNULL, 140728157175807, 140737488351231, @@ -31184,7 +31185,7 @@ STORE, 94376135090176, 94376135094271, STORE, 94376135094272, 94376135098367, SNULL, 94376135094272, 94377208836095, }; - unsigned long set42[] = { + static const unsigned long set42[] = { STORE, 314572800, 1388314623, STORE, 1462157312, 1462169599, STORE, 1462169600, 1462185983, @@ -33861,7 +33862,7 @@ SNULL, 3798999040, 3799101439, */ }; - unsigned long set43[] = { + static const unsigned long set43[] = { STORE, 140737488347136, 140737488351231, STORE, 140734187720704, 140737488351231, SNULL, 140734187724800, 140737488351231, @@ -34995,7 +34996,7 @@ void run_check_rcu_slowread(struct maple_tree *mt, struct rcu_test_struct *vals) MT_BUG_ON(mt, !vals->seen_entry3); MT_BUG_ON(mt, !vals->seen_both); } -static noinline void check_rcu_simulated(struct maple_tree *mt) +static noinline void __init check_rcu_simulated(struct maple_tree *mt) { unsigned long i, nr_entries = 1000; unsigned long target = 4320; @@ -35156,7 +35157,7 @@ static noinline void check_rcu_simulated(struct maple_tree *mt) rcu_unregister_thread(); } -static noinline void check_rcu_threaded(struct maple_tree *mt) +static noinline void __init check_rcu_threaded(struct maple_tree *mt) { unsigned long i, nr_entries = 1000; struct rcu_test_struct vals; @@ -35369,7 +35370,7 @@ static void check_dfs_preorder(struct maple_tree *mt) /* End of depth first search tests */ /* Preallocation testing */ -static noinline void check_prealloc(struct maple_tree *mt) +static noinline void __init check_prealloc(struct maple_tree *mt) { unsigned long i, max = 100; unsigned long allocated; @@ -35497,7 +35498,7 @@ static noinline void check_prealloc(struct maple_tree *mt) /* End of preallocation testing */ /* Spanning writes, writes that span nodes and layers of the tree */ -static noinline void check_spanning_write(struct maple_tree *mt) +static noinline void __init check_spanning_write(struct maple_tree *mt) { unsigned long i, max = 5000; MA_STATE(mas, mt, 1200, 2380); @@ -35665,7 +35666,7 @@ static noinline void check_spanning_write(struct maple_tree *mt) /* End of spanning write testing */ /* Writes to a NULL area that are adjacent to other NULLs */ -static noinline void check_null_expand(struct maple_tree *mt) +static noinline void __init check_null_expand(struct maple_tree *mt) { unsigned long i, max = 100; unsigned char data_end; @@ -35726,7 +35727,7 @@ static noinline void check_null_expand(struct maple_tree *mt) /* End of NULL area expansions */ /* Checking for no memory is best done outside the kernel */ -static noinline void check_nomem(struct maple_tree *mt) +static noinline void __init check_nomem(struct maple_tree *mt) { MA_STATE(ms, mt, 1, 1); @@ -35761,7 +35762,7 @@ static noinline void check_nomem(struct maple_tree *mt) mtree_destroy(mt); } -static noinline void check_locky(struct maple_tree *mt) +static noinline void __init check_locky(struct maple_tree *mt) { MA_STATE(ms, mt, 2, 2); MA_STATE(reader, mt, 2, 2); From patchwork Fri May 5 17:41:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Liam R. Howlett" X-Patchwork-Id: 13232904 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id D8BC4C77B7C for ; Fri, 5 May 2023 17:44:43 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id CFB676B0099; Fri, 5 May 2023 13:44:42 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C37576B009A; Fri, 5 May 2023 13:44:42 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A88B96B009B; Fri, 5 May 2023 13:44:42 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by kanga.kvack.org (Postfix) with ESMTP id 86CE06B0099 for ; Fri, 5 May 2023 13:44:42 -0400 (EDT) Received: from pps.filterd (m0246630.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 345HhL6u014783; Fri, 5 May 2023 17:44:33 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=1Q7wqf4ijKrU09WVtajX7KD9NtJGhpTDiMYTNaVpvaY=; b=ZkWmL4wWmD1i7I6lhnFOTr8+xoRB1WVwIIwnLOoMVrs0Z0NtVn8N2aE4m+IMzR13ZvqJ cyqxOtHFGXT6Hm1hj/Ln7e/rFVJaytMFFDkWDZrNDOdQqZWxQu1giHS2TOUw1Nz7Mo47 jeBlYervV8t88QBvdWBs+jbVN0Dr271VqcELDE8RRn1X7a8YVN9oEEf5hUV8joHjBYZB Xam0oSrO+9RdnPus3iD1wO0PjIlmY0mg2WpJpFpBjmwXXzgMF8ICksP9I4RaBNp4DtQU p8iDmlqXH6plzrm7YHLqIDrtma6J1Gnkzr3TsFhdQ313Vfx+2lsfev5fivpv6kNijTEc BA== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3q8sneddyq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 05 May 2023 17:44:33 +0000 Received: from pps.filterd (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 345G9u6o010002; Fri, 5 May 2023 17:44:32 GMT Received: from nam10-dm6-obe.outbound.protection.outlook.com (mail-dm6nam10lp2103.outbound.protection.outlook.com [104.47.58.103]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3q8spankac-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 05 May 2023 17:44:32 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FyTF1/gOqHkT2quxxq47PPWSTy77nAKv15OSAwU3IlMAe4KhYEwiaIlSNFt29OkTuR0AvS9Eziuf4Dx0V6QinF9AfeIDAHklaGgEEgBTSoSF/+1JSzO/bZSgkXHiL1iBs0k1kTSGypq2CCfnrAoVqbVatBu9+IfWymIOB8wlV0snJW13oRS8HGRt5nYljH0PstdxrJaqWGHpylffpu4epBSsr9Kygg3cZqCzXg+sJB34lUTvnaKnT3pTiUgy1Gwsc+l5n5R6qdfrgOvuhk0BBFQbqXkDjADJRBas0SmIoqYfgO522JWIbLYvJ3tNEP1E+eGfIkx2QauJHyOsd24IjQ== 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=1Q7wqf4ijKrU09WVtajX7KD9NtJGhpTDiMYTNaVpvaY=; b=hdOhPQRvcGKAF/KRqwOuiv2n+yvbVMcjNj68qdVStrPVavJ9mFXI5Qgkwpj/bHj7P+pkDUqsn+uiaB6gXM5rNyYPkB+Ui8eDGdXalbLeeIwKcVVn7pldnFe4+ZrLVdjoYUDccJIFR2l0T8IHNS4u6rViuX2XFhdVQjLDBrOUQM5BmqeQZmIzQ/zI+Tqwm6bvWFdwZc6v4LfJzxuSVxfHmD0jEufmEdoN3ODvK+elHs4qixBPDnZ56g2rOoxAd1nflfpSR9KfWVmjKQrryRZ4KHn1Yo3QblPoO44KLi8mbBqIb1Ylnkp6+ti9qAuckIhMLWjmIYJgYnJEMHYqGYEc9w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=1Q7wqf4ijKrU09WVtajX7KD9NtJGhpTDiMYTNaVpvaY=; b=QQBL5Lmu4psYV3qeY3794QqZ6mAgKzgPDMfPGypxkbz9QxgCNn8/yrMETGNIcUNKgpMWzJAVNhKSqDvcYyLgLLqV+5lCaPdJm8kSG/8SrtpPaG3DZWFzh+BGEmhEkIYbFL5egb4eKEccanII6iAlgKM+8+sO4EH0s8/aLD9eKw0= Received: from SN6PR10MB3022.namprd10.prod.outlook.com (2603:10b6:805:d8::25) by DS0PR10MB6895.namprd10.prod.outlook.com (2603:10b6:8:134::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6363.27; Fri, 5 May 2023 17:44:30 +0000 Received: from SN6PR10MB3022.namprd10.prod.outlook.com ([fe80::8bb9:2bb7:3930:b5da]) by SN6PR10MB3022.namprd10.prod.outlook.com ([fe80::8bb9:2bb7:3930:b5da%7]) with mapi id 15.20.6363.022; Fri, 5 May 2023 17:44:29 +0000 From: "Liam R. Howlett" To: Andrew Morton Cc: maple-tree@lists.infradead.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, "Liam R. Howlett" , Peng Zhang Subject: [PATCH v2 20/36] maple_tree: Remove unnecessary check from mas_destroy() Date: Fri, 5 May 2023 13:41:48 -0400 Message-Id: <20230505174204.2665599-21-Liam.Howlett@oracle.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230505174204.2665599-1-Liam.Howlett@oracle.com> References: <20230505174204.2665599-1-Liam.Howlett@oracle.com> X-ClientProxiedBy: YT1PR01CA0052.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:2e::21) To SN6PR10MB3022.namprd10.prod.outlook.com (2603:10b6:805:d8::25) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN6PR10MB3022:EE_|DS0PR10MB6895:EE_ X-MS-Office365-Filtering-Correlation-Id: 7d311488-954c-43b0-95de-08db4d9060bb X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ALOyuUfn8+roYuDqNx4Y0Aec/UzSNNV6PtCJuIhUBS9Ks3+Y0VNTG7tWwO05JPoK3mr7HMiWUOkZl/mqZDTv4jUKd36i4AQLqbFR0MrG0gkd9i7dWyLcqAeswW6GATxQAg6/uz13rGoHZnzyA1FQK5YCwbPh/QBSYflN+CulhOEUHTyc3FvzdIvgZo2OuX9QQQbj3MgCMM+Vv6T5Ss/l8lYgj6w6bs97qvNdWa38L7iwiMTBxUhP8CB4MQ5b/fj/0iVu95IsHUcleB646GEGbsZTP1vYhzTBYv3gG8XF6uI1nqYg1vW0DncasQoXCOBWd/gmKIX4jG/CEQnkZ9HAutdvPKTJHnV2vq61uIKGE+5QgbyQYcOS9rHiufBAkvS1qvNR7nKEZbIBH6S+PjtvhY53QujmoLODFLovjakZJ37TdxqhpB1WLB1ZVAkeOela2aROfuCMN3erzxHwseFWPGlDQmNt/AykITl7+eWfjj0+mF/3nwQYasnIhz83uzULnbQ7eFyQgcHZsZ8/LfHFHcza/xS4939L7FnutlJhKULY+/PQ1yedPbKLBUo9kHNd X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SN6PR10MB3022.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(136003)(376002)(346002)(396003)(39860400002)(366004)(451199021)(4326008)(6916009)(66946007)(66476007)(66556008)(41300700001)(8936002)(5660300002)(8676002)(6512007)(26005)(6506007)(1076003)(54906003)(316002)(478600001)(6666004)(6486002)(2906002)(4744005)(186003)(2616005)(83380400001)(86362001)(36756003)(38100700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Ho1ZpQVFkR0Z1pgAVCuZ3BCUpWygbhpCZGaEFXaRDnW80QrUDnHOJl3hEVvigSZFQZS8ilW5HZJhElfaXExadbh28dSYV1/hfDD0J+3kQRc4BQKC8yBQW9ptW1cOuWJbYtar+DtoRkUXaQTXOZgKYw4sDtMFwSI8fsqzlxaEkK4CWJ1/dMPcCbX6sZAiCyUwwQFQFoeoZUiqMrHuOFV3rJr8r1Zvq130oCyqg+QXA3ZJNKFY+YNVNZMwyHZMQ84+W9u5/6IuAevl2EzK/SwJO/+/s3PQEyQHLiVfeLoEg4rZE/LZ2S+KpT+Hc0CHJGuCi8Xb6WMlRYWKXyJQv9Jy8OsUDK005OncyUQS6MkHF+qgAXLbf4uRDPwv4otEuZgMO2ig/1Iam9SqNL1dORJRXAkmNoeQA3ghK7VGDsrYQKGJ2MYryBmuoswFbzJoPKSPLz0O/VZPygwF+RBsWBlBSPsxasLsl9qGVxeBUPa/rKqIfIhpg2eBMxcpaLkW9DSVMvdrYm//3vKd2OcCrNaw6+NCPYu7To0odliTmot1bsIHij+7S/9ydkuNzbqNXkQZeZUoOFAJp0+cyOFobAXzFaemPBrT2H5/GKNYm7/50vLUn2Ldvyq1w8yNXQJlh3ltz4NjR2tshdq2cyCFO91StatQfYDL+hpQQaxKy6EizAotgP1pJm9BZu8iXG8qXr+ZNfUbfGg7k6RF/JYV2RLqR3tjMhEQvniv7NdCmFHBR93V4UJ46trz5r3iGQUFgEXLnWFoJDjYB+FkkAxtdldzitHARugJzbVGDNCURI+WiyK2bO0twPBBY4rMM16NxoO85F28qp5Ww69+TgXoKBcMbdF077CabKVS0KDGVdB6a4ZpStraYIG2QYGQm+H/uDqKayiC9tiDIZKBGbyuXM76MnSkCiEvVOkketSoG3pjDCVlsSVLLsznOEVt4nBqj+/okr2ig24WKmwnvkXJudwcEsNd591E8wBGG0jP8DnnlSssUqhjzy0+vXrDP0OTossL4Bn7iTzNsR75FCPUMuB09f1zKI/6FbUmw6wcN9h+OXMNPctVfBCjFPseb2r4uqpkFgbZvfT/uR3/oYh4mPD75XUMQWztAJd5W854NYyzGIUyH0PJ70XwJuvRoqmBV9M6a4+V+1cl+gtAF+fc7ijXyiHepuaCXH2ZtoOLJb8C1TZguHd96L2WzYho4yPBoYktLhBNmHDbdQUKAfRSvkwfEqky2rlAqQEOWnoro+ZGYWSrUx54gxxYnCy+flIUmfTJwXL/XhKLK58NgnnUtQtc3Yb51GQmlgo/1BirC+QWmcTWETO9df4UDzCI5Z6wuFzdcADcXC8HIawvqJNbDcFnD07ge32E9PpBsAXDCwCNJbbZW5RkEyOgfEz1h6oYlJvvuYVuP7MEziAHqakTQGI0gZ+DJuE97n7QItyRqltBclIOjYCU4X2gNB/TS7tdEsrBSgFKAbMEffunplaw8l1u8MFI3ZBY+8ZHd3pYAYocjlCVek0AOgLOzZrCnxmTileAzkcZRm8WqYq4mfYg71AkAV7GAZ0atzNqJHuWylbUzZzSs5i0brbzO9mlpA29PkCyc2ZIzgghb017M0PCvZYEcg== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: 79ydLZ+LhDsktje6fthWjr78SFFOcLvpiYjitBzKgSyOlvirSaMvrCKZm4APL04qby8cHDzd5wW7xauwySFpelUHpT6whYLt8QZ4udWpRuU1VkgBml6cprxUJyJCQil5Dr9dAtMoTcTczRcYpaPyv3FWRHSKNOXlJfBp+trNZysqk1TOFH25p1tIbv1ASMSWNyS6FQah/WZobk95BsvoyaGwhecnMFYA1D3lXohgLOaY1fAL3rPQMMNTNBMcATEcK1/HZoPwaxVi6N6HTxR5ffTf0AH5QLDiBL1iZOPaDa/U6Vs8XPSpJdG0qTUHL3UZ53kP4ju6j3u/1hkg8uSZ6V7oUlrsoqgBwZqA3ojBHLYl2SwquVz5ZQ9ACVjaV4yAVhAaMGRCCz5s+pqwjfVL/JqRc956hLOo9NnZdSNKJusZPhU4/osGRso48Q+oA+5fKiXFa7ybG98bbwu2JpE7pZUQL+dVzupPyz8e03mavt6AkOyeD+wDNvxHyr+xpUJofYqHhwGqyY5UZGe6pnTRlqSr+mRz8PZACl7RRshB/Tsa43MmEQmUPnyLcp/WjEUBTLP2rfTTs0RcNomRfSrWiK2+dZmH/qM0mj2VapM6QKhW0KjSJrNIi7tmFyO34qMnBAgqq8IfHr/arO4CAU3wHluA59anlHvypb1VfMMaSeUsguqCJ6MF8S+QCbltambefg3ngAoxLlEXW9Wwb7U0ezA2PIolFE7h/JrTODfS7eeN5TUKHpY9L64dwnZVu7D+TrU7L+/czi8kXYn4fX2CgKKxupLBouC2KwaPat0wyZG01cG24wzi0jgZgGueokbbvCxy2mfHtlfvl/r0gBAdB6A8909evMIpoE6OpWkeeM6WCobbG3jjxlULzz5ujppKDhEu0wUFpoIf4llUHeicG9VMnoXS1oPuAQAsYfGpsMURRE05bbShkJkuOVIG1g/5 X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7d311488-954c-43b0-95de-08db4d9060bb X-MS-Exchange-CrossTenant-AuthSource: SN6PR10MB3022.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 May 2023 17:44:29.7589 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 9d6KpbDSP0aEGjvdPiVjZKeMTDlL9eVbCPA+rcC3mi9mGM0oeCdltm2cs3mz/JZJG0tApeU6aBUsX1U7RLdewg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR10MB6895 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-05-05_24,2023-05-05_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 phishscore=0 spamscore=0 mlxlogscore=999 bulkscore=0 suspectscore=0 mlxscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303200000 definitions=main-2305050146 X-Proofpoint-GUID: SxBNqOKL3vG2YZUa9cQlUCztbLguSzmX X-Proofpoint-ORIG-GUID: SxBNqOKL3vG2YZUa9cQlUCztbLguSzmX X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: mas_destroy currently checks if mas->node is MAS_START prior to calling mas_start(), but this is unnecessary as mas_start() will do nothing if the node is anything but MAS_START. Signed-off-by: Liam R. Howlett Reviewed-by: Peng Zhang --- lib/maple_tree.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lib/maple_tree.c b/lib/maple_tree.c index 9f3784f4a5b7c..b3e5ae43ff8ff 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -5816,9 +5816,7 @@ void mas_destroy(struct ma_state *mas) if (mas->mas_flags & MA_STATE_REBALANCE) { unsigned char end; - if (mas_is_start(mas)) - mas_start(mas); - + mas_start(mas); mtree_range_walk(mas); end = mas_data_end(mas) + 1; if (end < mt_min_slot_count(mas->node) - 1) From patchwork Fri May 5 17:41:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Liam R. Howlett" X-Patchwork-Id: 13232908 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2E0BFC77B75 for ; Fri, 5 May 2023 17:44:52 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6454A6B0092; Fri, 5 May 2023 13:44:50 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5D1716B009E; Fri, 5 May 2023 13:44:50 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 30DC36B00A1; Fri, 5 May 2023 13:44:50 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by kanga.kvack.org (Postfix) with ESMTP id 040A26B009E for ; Fri, 5 May 2023 13:44:49 -0400 (EDT) Received: from pps.filterd (m0246632.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 345HhKn3002999; Fri, 5 May 2023 17:44:35 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=3J4pneHi36iA5e8D1W6Sbr1hFtHWPs0j8jYZRtGOe7s=; b=UlTnh84uRBjQOVFW3mKagKHbizZx00GFxhBHt+l2z1t240jj4Utl2i9PJqA11eIbujNO JHSvT7WoNhBHiTMq+daqPxxYs3oYhQptdExaaFKXCupgZAngfpQMrU7xgZqSid5mU8xn OP9t0fSDsiI5KNGPORdAKsw55yKTARaDsXGJ80H10YH1x12nch5WNED1PoZIPTgs/2kS 1SfARZyLedwMHh2mWkKzRsGsFLCtgwW0kqkgbs8rWzxMOgneEd86cTNmhf/O/ANToJJY ruzX1jJGRRedVn/1UCIPE6glswoj6cC7zJDqZ6f5uYOxRotk28wK+sBo81w+iI3KG5dg Uw== Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3qburgdkde-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 05 May 2023 17:44:35 +0000 Received: from pps.filterd (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 345H0e5C027533; Fri, 5 May 2023 17:44:34 GMT Received: from nam10-dm6-obe.outbound.protection.outlook.com (mail-dm6nam10lp2104.outbound.protection.outlook.com [104.47.58.104]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3q8spgetkq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 05 May 2023 17:44:34 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QBV83DcrWD8RIwXJbAUMpCdnv/qGABm/4+xYkyveCm6oFe5wkfoR4ExCAF8UN60gpyEw+0UmSIhyPX468tV3jrJTmEIZ7ZD3xqQPxO5sPUdXIS3o6SLGZMBJf6Y1/DwyBYv3qytdMDLFl7+KiUplWZPx6ZGUaUfuZ5Kly4SqRgRCmjAkifx4ptfHWdJLXzFatYLDvr3j1zh9X/1RZIe7JtwIyeebTLJo+eAjRvFFLQzeYv12MkIOWpLBU5/VKa5PmP1gGyIIOhNZhR9Xzau4MgLE12IvMX8jjmCATVhWIdZ+HnsUeC1Ymi8QT13IIpFi0NBo2u9D3Efb9F4rfAv7zw== 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=3J4pneHi36iA5e8D1W6Sbr1hFtHWPs0j8jYZRtGOe7s=; b=ZCsCPmlx7ZLSX+m4a1TRPTnukcJZis/68qRtsPx/r46ldRe7g2iMRZOYBDZoA0h+OkGE7z2JHtWc5w6LJKC8bwPsB9VdogAEercgKe4XAkFgwndudb+6gHS4fYquxWEsbVWZwJFzdo9AC677RG/Dii9Mx2g55dOtSLz+0p/sbINOISRu2pjAXn2BpWQWuZu5zpwLdAknCjEwW/rK9xOXtaXzvxJsBX6061WIURYuMNI0hqZmW9UD0lXoQiQdQLdmnfObQlYemZLgz0/0qMWylXBsbi+mKUe0sd7OqUrJki89ZkS9TMyDganjRuuWLk+b01g9yYmPPQ3Vnhejyy25qA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=3J4pneHi36iA5e8D1W6Sbr1hFtHWPs0j8jYZRtGOe7s=; b=KOQgVsqE2mtu9kjc9Yzv5sMupawSOSOv30FDGcX/oMtXRttwenkNcAk0O4KRsEOzXlSNCkRoNR/P+zsijuzf3rA21a6fB7ECQeLqIytsw4Zz2CRxbJGgXXWPTT7UpyOx3lpxEKXw7mA1ugsbBc0a88yPG5AOuUjv7MWec7fPLDE= Received: from SN6PR10MB3022.namprd10.prod.outlook.com (2603:10b6:805:d8::25) by DS0PR10MB6895.namprd10.prod.outlook.com (2603:10b6:8:134::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6363.27; Fri, 5 May 2023 17:44:32 +0000 Received: from SN6PR10MB3022.namprd10.prod.outlook.com ([fe80::8bb9:2bb7:3930:b5da]) by SN6PR10MB3022.namprd10.prod.outlook.com ([fe80::8bb9:2bb7:3930:b5da%7]) with mapi id 15.20.6363.022; Fri, 5 May 2023 17:44:32 +0000 From: "Liam R. Howlett" To: Andrew Morton Cc: maple-tree@lists.infradead.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, "Liam R. Howlett" , Peng Zhang Subject: [PATCH v2 21/36] maple_tree: mas_start() reset depth on dead node Date: Fri, 5 May 2023 13:41:49 -0400 Message-Id: <20230505174204.2665599-22-Liam.Howlett@oracle.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230505174204.2665599-1-Liam.Howlett@oracle.com> References: <20230505174204.2665599-1-Liam.Howlett@oracle.com> X-ClientProxiedBy: YT4PR01CA0213.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:ad::8) To SN6PR10MB3022.namprd10.prod.outlook.com (2603:10b6:805:d8::25) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN6PR10MB3022:EE_|DS0PR10MB6895:EE_ X-MS-Office365-Filtering-Correlation-Id: 6cb1f474-2832-4283-f13e-08db4d906263 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: cxFfq2MxGmQPBTkApwxoF052atfnoYYT+uvrX5ZiXyERd1yBye3z9SXB9ZiIpWdNUGqp/yB0kOlQUgzPxhywUiyEMv9JzRvyqMc5oI0ruC7k/dkN86t14DKR5So8lfPJ1AW7GiZEz5xXjoBdrd97tdz+Kw/c79j0ewdfLsowta59O6fEZRi4QvGZiscXY+5NwxCJ+zz23p/QBay3kvUtweNiq6WHSAqj9550fInuGYZRH2K+bWP3LaIt5BPVTtwK3APHKYN/AMii5iT/1QrBjCv3spI3MNrBSHc81uz9Q7Fjg5Kp94ucWXpShW/hhJdA3ur7O95GofChx3dnuHhI4ZgaK4ZUyV9zhkaht5OF6z8LTTZUnw02MmRnzFX5W/Va8wJ3w54Ovklh12U4wTL9pFjCM/JbuvleYLEzaDYSAo676NNTKM9AnetyeIv/QgMEDo6czAsv5yZuv1bp6KY65vT/eWC0QgeCT80ufH7vlqmOIz96fbUFTsJ0amMaD6jQRNvnvrRMgmfaP3hFYIbR8/HHJamQe/pK3H7yP3ABZh1f9M17yZ+Cdu48jzqZz+sC X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SN6PR10MB3022.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(136003)(376002)(346002)(396003)(39860400002)(366004)(451199021)(4326008)(6916009)(66946007)(66476007)(66556008)(41300700001)(8936002)(5660300002)(8676002)(6512007)(26005)(6506007)(1076003)(54906003)(316002)(478600001)(6666004)(6486002)(2906002)(4744005)(186003)(2616005)(83380400001)(86362001)(36756003)(38100700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: yTaainM5KLzYiNIfrPxhAhCem6Fw/AAgAmwPUezIH0E/4Te8olW0lpOtYQzRxtPO7Cxu/XjsaW6K+6jCzxnoFnxx15rqpUwGZhRJ1CSxoINzLEJaoPUDObqNiTU3JJrMmUccsGyJhi19pPl0a5qnGoVGgEHn81iWB10s3r3kYUL4LTUG2qWd/sI97IsYpsatdl3yrvUd7lWnDznx2RbJlo4jnlqZqagNxltrvWKn3C/MWO8U6wfcPqCY/NxZFBIOpJzuQZblft2WrqBMztodEkWvLh64pFa8loCLdVQGM1DowAYJ63hkIXScFeeL8WMPZjW/J5zHBH8faLMOcfNaAm3J/9sFf7ANGc47St/m8RtJXwit8Gcd5+Xcwa2v3OLPsFNkOyIpbXCgZbLHQiLvvGghfNKdu1pA6a/pCUkhg3xrL5AbtyDib6m+FzGGA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mweXH6qNXL157O8WErwsb5lXYeWlTSzPHvtLqzzcs8ADTsMDITmNtomjIpl3kY1mMcYt2bC X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6cb1f474-2832-4283-f13e-08db4d906263 X-MS-Exchange-CrossTenant-AuthSource: SN6PR10MB3022.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 May 2023 17:44:32.5477 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 7LLzzCBbtGD8d8LITEh2kOrPBgk2EzhC+Zzpsw5K2yeyXbBMEnhDpDA74Cmoca7nTW3DSb4EO+eFxDB2nI5vPw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR10MB6895 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-05-05_24,2023-05-05_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 malwarescore=0 adultscore=0 suspectscore=0 mlxlogscore=999 phishscore=0 mlxscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303200000 definitions=main-2305050146 X-Proofpoint-GUID: EQPxJIyXCQXaDzm9SAh1VwGjPvijKGRV X-Proofpoint-ORIG-GUID: EQPxJIyXCQXaDzm9SAh1VwGjPvijKGRV X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: When a dead node is detected, the depth has already been set to 1 so reset it to 0. Signed-off-by: Liam R. Howlett Reviewed-by: Peng Zhang --- lib/maple_tree.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/maple_tree.c b/lib/maple_tree.c index b3e5ae43ff8ff..e233f41ed4da2 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -1396,9 +1396,9 @@ static inline struct maple_enode *mas_start(struct ma_state *mas) mas->min = 0; mas->max = ULONG_MAX; - mas->depth = 0; retry: + mas->depth = 0; root = mas_root(mas); /* Tree with nodes */ if (likely(xa_is_node(root))) { From patchwork Fri May 5 17:41:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Liam R. Howlett" X-Patchwork-Id: 13232902 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id CFBD7C77B7C for ; Fri, 5 May 2023 17:44:39 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3ADD06B0096; Fri, 5 May 2023 13:44:39 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 30E526B0098; Fri, 5 May 2023 13:44:39 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 161896B0099; Fri, 5 May 2023 13:44:39 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by kanga.kvack.org (Postfix) with ESMTP id E29A66B0096 for ; Fri, 5 May 2023 13:44:38 -0400 (EDT) Received: from pps.filterd (m0333520.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 345HhQ8Y031799; Fri, 5 May 2023 17:44:38 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=MMuXGwzfr8FrXvMOM1JZ8fiBmFIW5agQMabZbUAl1DY=; b=i/tnCyNtjr4ykPY6+rCds6o5+DOeqfcKE4T+D06KzNbH7LOGLYZ9OIMp6uUJhFXbL7Hf Ynl/fjpH2rIj6RzQWJJn06FjakI45spuI2ZnM37ov1HPpooxf6h5Ca0SrqdfL+k79Gp6 soS4fSoHnKiDQgNxY4okVOnsqJ5JNTU617BExQnPblBAG8WXfjKOILXZznCGkxJxr9Mz Qpn/e0BdZnuZnJUpbyhpo3V6OJFvlVbuhWN5GalhmnoPOrwgxjH3hURsJfbfUdt+AJuA a/AVSUG9P6sSYHOlpYZAGgKHPioEDsFaUYfSMu+5iOl4Wqv2hmfJvVc3mxgdc/rO8kdf jw== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3q8u9d5net-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 05 May 2023 17:44:38 +0000 Received: from pps.filterd (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 345G4kiO020786; Fri, 5 May 2023 17:44:37 GMT Received: from nam11-dm6-obe.outbound.protection.outlook.com (mail-dm6nam11lp2177.outbound.protection.outlook.com [104.47.57.177]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3q8spa5fkm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 05 May 2023 17:44:37 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AH+P/Igq3lFtZ0O0GiYnzWCxv3nwfBGKdNaTqWgjx6dRrTQlxauZTXm3wodGHieAG9T6yDexK2mrgzxthfjPcyFVdTbpK9w39Hn1TSQYwej/BFiRWJ6JAyR+tSPhA55TOLXKffyFDuYwfVspqT9bnj7y5tnjeQVmg4245lzKhbXDd/VDFgjg3RLSxMAR1V2ZSwl/z5mKynM7q6CCsq2ku9kzRTSnczv0IjJQEFYOlaczEfsfGD36l/3uFrImGHChyZlcnyu6o17TZa7liEBaYDI34bmUatx+pkIuFW+a9LZ5nwCw81ceHKf2WvSZCZTWchDyo2FI+NAQYktCIkvsTA== 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=MMuXGwzfr8FrXvMOM1JZ8fiBmFIW5agQMabZbUAl1DY=; b=C+NQc4a0G59ltkHyvv1g3pzxgW2c4HlgE6ubXun2OwYczTfxlKKL8c6LBfFAUfilz/yvCIfteL3p+mykjk+ygDnkruPtNi48KA0mgoUFcE4+WvM/cSGsIPGCWf7XZOrchkq50QyDRXByp3UGDlb7e1jXZgfjIyLt4Ohb7Co6pR+/3opP0nqDIUuGo3/8nSoaF7LoXoMPz8xXmrl82hHbMOLjjl9MjvGXiLx6sLbn26CR/5EqzI7Khko3jx93sxg+kz6BcYWvxIKYHHyeBm+qUvwQtH+hKBWU//lEQa4jcXYXrMcme0iLxNe3m9R6dO5Hn4TgO/IhDrRAJ+bTL9vutA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=MMuXGwzfr8FrXvMOM1JZ8fiBmFIW5agQMabZbUAl1DY=; b=dArBrOQklZ56KX+wc5QXNDv4c/vddk8TELJCP1oNMOaWTRGsAROJ3UAFAXuyc0ndsVyNx2lMhXC6y8TzjaAp0sHPd27gXZ+dAATcdNnXc3y2ZXN+Smh4m8sAG4s/1c53/TrQ9/8Agxk+A8JA9b0SNo+xFe2F36RXiB6ZW9Oys/M= Received: from SN6PR10MB3022.namprd10.prod.outlook.com (2603:10b6:805:d8::25) by DS0PR10MB6895.namprd10.prod.outlook.com (2603:10b6:8:134::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6363.27; Fri, 5 May 2023 17:44:35 +0000 Received: from SN6PR10MB3022.namprd10.prod.outlook.com ([fe80::8bb9:2bb7:3930:b5da]) by SN6PR10MB3022.namprd10.prod.outlook.com ([fe80::8bb9:2bb7:3930:b5da%7]) with mapi id 15.20.6363.022; Fri, 5 May 2023 17:44:35 +0000 From: "Liam R. Howlett" To: Andrew Morton Cc: maple-tree@lists.infradead.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, "Liam R. Howlett" Subject: [PATCH v2 22/36] mm/mmap: Change do_vmi_align_munmap() for maple tree iterator changes Date: Fri, 5 May 2023 13:41:50 -0400 Message-Id: <20230505174204.2665599-23-Liam.Howlett@oracle.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230505174204.2665599-1-Liam.Howlett@oracle.com> References: <20230505174204.2665599-1-Liam.Howlett@oracle.com> X-ClientProxiedBy: YT3PR01CA0005.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:86::25) To SN6PR10MB3022.namprd10.prod.outlook.com (2603:10b6:805:d8::25) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN6PR10MB3022:EE_|DS0PR10MB6895:EE_ X-MS-Office365-Filtering-Correlation-Id: 9d70230a-d0c1-4412-d9d4-08db4d9063d7 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: XGtp06hLuIOkKsm+bxPDffCBzIVPWEjHaJmrnJLDorJ6B6CYvhvQlkrmtFNMVNiwELr7SQsmFsjGsW09e6o1KP4MauwWvUVGcZOq9hMbER1iywfyCASUHO7zhZwSA2iSZc6QFIrrwG5mN/BJhVBolwgSUdJdBV27kJb5ZQAYk6+0Qri3+Z/aE1RCf6hvrws29U1SJR5/7yB7IFMKz9iYvWazcxkLC12LY0nQRUyOgbtbL3iiPKnr3x4W/O3C5518vjdeg1Sq4z692C89/RvGqZnAXQeOi5sRKH2KxlranZAKg+l7XdGPKAtPyiu//MA/jrEMi/QUl4Q9ZI4/jJcGQA9cjhtAV9TLqRJ217g42IrxchwpXjFylFliFkBUmeGXnNcQsccX2dQrbyYe6Nz4NdVBtFGSA8HWmS85/CmTxnl75gzpoCKOpwMaHEJBYYNi/42NpKWT0jdvyqoC6+Hp6jvTLefuBv1+mcRfGtp0jQoALZZsz4qix+Mm/OyvyTQpiVFh2ktMxpETJnk7E7nI63/GhAleyHT2kkvHw0l4F1ijS1B/MZshcaQTVc3LgH4j X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SN6PR10MB3022.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(136003)(376002)(346002)(396003)(39860400002)(366004)(451199021)(4326008)(6916009)(66946007)(66476007)(66556008)(41300700001)(8936002)(5660300002)(8676002)(6512007)(26005)(6506007)(1076003)(316002)(478600001)(6666004)(6486002)(107886003)(2906002)(4744005)(186003)(2616005)(83380400001)(86362001)(36756003)(38100700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: jjnhliEqt5Z95QlRJfFNcuqn1frnleBM9Umv24xq95sF3qYa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EYClfkqftN+q8ggrYVH7I/T7QesJp8kiRorAJ+QdF1D9nK9kF1S6MQILHzjM0HaRiM2PxyQvCa2g99xzmpwimQsjYXfEe+0dHVuD/cEBU2MzHWdjxOlg4kRxAx8akGqagcvay2iKknvIhowotc/gwme2GXzBzP1S6X/1pfxTeMELZoA+QnQAIH6/k5kgLVP1etxGYcLLptCrulfuNAH0e6P1HOX966VBXSQNCMIhXjqVLBU+9alIjH/za1iJ3jKZ6gcxf4S/aekgzv2Mkjs7UX2olEk4k1h1ZWM6LgTT+RuF2lbDRUpV0hGW1q2rPBN6BlXGxmxQhmCIwLcV70zFXmGqG9zEaG8yFCbK5LXpM1VOa3rhTIn2QHCcgPaOBbf9tzI3am4hqPUIqyqorRZ0V9MA/CjRYVr26BQ== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9d70230a-d0c1-4412-d9d4-08db4d9063d7 X-MS-Exchange-CrossTenant-AuthSource: SN6PR10MB3022.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 May 2023 17:44:35.0017 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: iEFMpF6pbkTzZGl0ku2ojV7+cqXcKKt1u5qloQwjrJ2XTTtV/4Oh5Ao0CAGzhdHS+MoSBlm6c/+F/qjL1vc2FQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR10MB6895 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-05-05_24,2023-05-05_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 mlxscore=0 spamscore=0 mlxlogscore=999 phishscore=0 malwarescore=0 adultscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303200000 definitions=main-2305050146 X-Proofpoint-GUID: OjPz1oIn4gmgVkkXeLOlFTGQDdWdKwJA X-Proofpoint-ORIG-GUID: OjPz1oIn4gmgVkkXeLOlFTGQDdWdKwJA X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: The maple tree iterator clean up is incompatible with the way do_vmi_align_munmap() expects it to behave. Update the expected behaviour to map now since the change will work currently. Signed-off-by: Liam R. Howlett --- mm/mmap.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/mm/mmap.c b/mm/mmap.c index bcebfd9266324..1602c854133a4 100644 --- a/mm/mmap.c +++ b/mm/mmap.c @@ -2418,7 +2418,12 @@ do_vmi_align_munmap(struct vma_iterator *vmi, struct vm_area_struct *vma, #endif } - next = vma_next(vmi); + if (vma_iter_end(vmi) > end) + next = vma_iter_load(vmi); + + if (!next) + next = vma_next(vmi); + if (unlikely(uf)) { /* * If userfaultfd_unmap_prep returns an error the vmas From patchwork Fri May 5 17:41:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Liam R. Howlett" X-Patchwork-Id: 13232903 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id B765AC77B75 for ; Fri, 5 May 2023 17:44:41 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3FBF76B0075; Fri, 5 May 2023 13:44:41 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 3AC526B0098; Fri, 5 May 2023 13:44:41 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1D60E6B0099; Fri, 5 May 2023 13:44:41 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by kanga.kvack.org (Postfix) with ESMTP id E0B9B6B0075 for ; Fri, 5 May 2023 13:44:40 -0400 (EDT) Received: from pps.filterd (m0246617.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 345HhDHo020188; Fri, 5 May 2023 17:44:40 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=3YIlBAFzfGCQ5M2VHn0qgaBT5Vs2S2TInPApujgd1e4=; b=WXjlu9uMeSOSmUzAG4GK6/MNdm3aXPZZCfpRu9OXpMK+OY6zvkQd5LQNE6zkIWKq3bAs 04DYkwC6NXxgYECn9SCnT2HxcU9LgBDl+tUz0+lodL/rmJfpACrG6CpFErbWvbwyyeol QheSTnVCdsu04PRWGCmsDKil90EkV83/Lzm3+7q+LO3gTcIWI5A2E56x20ybeyOUJJv5 X7J2Wrmw7L5ybkzrdG/bQacR/xfMyh7D5FXRu3KEE3a5W1u2n30vmfr1EcqrpUwRyyQb oRchG5vf5EfQYy6w6rwwGl01/tgZBcMhnUhckOMkhRcX/GmTAaCnFETG7W2bKmgIcMN5 IA== Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3q8usv5cte-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 05 May 2023 17:44:40 +0000 Received: from pps.filterd (phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 345He9fm024982; Fri, 5 May 2023 17:44:39 GMT Received: from nam11-dm6-obe.outbound.protection.outlook.com (mail-dm6nam11lp2169.outbound.protection.outlook.com [104.47.57.169]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3q8spacjj5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 05 May 2023 17:44:39 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=emcPb/U5l7Q3PL0DUjrZXpSSUgqd/E+oP8k6gsQMrnuUDGNIURB1s4XtjPsIKS7KLYILWtGloghBhz3T8RGe9dsxp0zgrxdRt9aOLZ67bBpaGiBSeWUq6fybPojltxEv3ro4qz+29o+WCT2moPE9+WLOu1QUp8UnyRo5C1SS24v6JbMDoPTET44Xjuw4Cea7oE7WiV//hz/92gq5BFg2TbaU2bPUs32tQohCNUW8LJFUPt0uWW4PaY+hvJYUvSHhwTwHLl3iYzAOibEsRUZBhMwhFS1nTsepTbPzmX5zXqmF19WDWwYnOUYAFfb7CQg3ndmZgL79tp3CocF8yoroRg== 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=3YIlBAFzfGCQ5M2VHn0qgaBT5Vs2S2TInPApujgd1e4=; b=g/thMbfBZPBvdSd4UKsqoLRk3nwuTWxxEsq40PY/r3qRhd3bC2ts5sQQ6GeNzNWoKkjkhACpMtSJGNx8fFbib48o1ZIyc3NtGn4HWsIflXR4SLYIzgCyT8reMjzNJiPqwijH6laVzMknMRTWmthM4vA/wM/+05iK02+n4buIOnqIIWSD+j2gql6mKKC1i5r78l81fg5Dxs4wVJ/b8LWda/7ZcYtKmoDc7lhFzMtqIp6ucoET0iXe0ykpLGeQHq7UV2JOgZVHo7X7/sz1s8fDmZFPnUzL6xUWmN/x2jEqMI69f4AEUMczKUvl5DFx8xcD5pxTBSDRQiIFL881gj1Oug== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=3YIlBAFzfGCQ5M2VHn0qgaBT5Vs2S2TInPApujgd1e4=; b=TqiSiAQgQ2DBOJk5yLxssWZN5uBLyqtM2ZHw/2AZcUSKOm+Y4CCy0c/XnUDWgjp9FjncsqGzuo8NqTT8TZwOzSlZVdX34M/JPEAza0Ba/tei8dMLpHT3suKe4S7WCCc7trJtWbu3jHP+twWnVsFATULQKRHwd+bpxuJCOmCxHhA= Received: from SN6PR10MB3022.namprd10.prod.outlook.com (2603:10b6:805:d8::25) by DS0PR10MB6895.namprd10.prod.outlook.com (2603:10b6:8:134::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6363.27; Fri, 5 May 2023 17:44:37 +0000 Received: from SN6PR10MB3022.namprd10.prod.outlook.com ([fe80::8bb9:2bb7:3930:b5da]) by SN6PR10MB3022.namprd10.prod.outlook.com ([fe80::8bb9:2bb7:3930:b5da%7]) with mapi id 15.20.6363.022; Fri, 5 May 2023 17:44:37 +0000 From: "Liam R. Howlett" To: Andrew Morton Cc: maple-tree@lists.infradead.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, "Liam R. Howlett" Subject: [PATCH v2 23/36] maple_tree: Try harder to keep active node after mas_next() Date: Fri, 5 May 2023 13:41:51 -0400 Message-Id: <20230505174204.2665599-24-Liam.Howlett@oracle.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230505174204.2665599-1-Liam.Howlett@oracle.com> References: <20230505174204.2665599-1-Liam.Howlett@oracle.com> X-ClientProxiedBy: YT3PR01CA0028.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:86::34) To SN6PR10MB3022.namprd10.prod.outlook.com (2603:10b6:805:d8::25) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN6PR10MB3022:EE_|DS0PR10MB6895:EE_ X-MS-Office365-Filtering-Correlation-Id: 799597b9-a160-4fcb-2491-08db4d90654e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: gDLo46c0cajU9fskw7mJm4Eo2vRITcLK4QNiRU1EiAwt19rOuxMcJZdJIYNPiGFGMYMBeLJRHDCnZfwl6BbtND6iI1m1b7cLyJfrsj9YL1XiN1tB6S6gu9WldgDOabai2vvJ8M+zg+vH3k0y8iLBZfKc3Bihl+AfgVXKGSpd5F9NlEqUVtz1RVVKqEszp3kZjO3Zq2QnSqMkikkm/UfPRZguAsF6UlpCpxz/EmVTJUZg1CM0D6yP0W7YLSHRiBZs1Ofou1kt5du1WKWjBgbEhbYHR80HwpcqgRgxuYsb2a/cGp22Ty2uxgfnfKp1ONEK1msXsIZIdbEDMIuWUK4S39KC6/G55Cb6iO3URpbeLf79ENQjvluf7wUhFYmdN1vsrDZW5fLTmtMwcrs6534wuNmFRXqk4vTkGXXs/EVa7lBeRbTKXPiz5vGGvTzRwGVulbA7uKXUKLupIFLeFYynHaXcyZ+tKQH802r9deifyW+j7ZexQdrYTkuS71P9rZJHuvmPvVSfklH+1VnxPQaszfGT9Ouy0/9ciM+vmsnox8qDq9CW27eDRf/7UVyuquoLC12RjhQoNSFYN07B6YERU9X/5tjO4VAERcoRCj+4G3Bz7X2CQfrmlRvYTifFhv2msBTC0w/r0WVENonpIfGi+A== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SN6PR10MB3022.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(136003)(376002)(346002)(396003)(39860400002)(366004)(451199021)(4326008)(6916009)(66946007)(66476007)(66556008)(41300700001)(8936002)(5660300002)(8676002)(6512007)(26005)(6506007)(1076003)(316002)(478600001)(6666004)(6486002)(107886003)(2906002)(186003)(2616005)(83380400001)(86362001)(36756003)(38100700002)(34023003)(148693002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: WYZJfQdVIN0maX1ErVWb/X+T0r/ju8raQwAmLpdfQBvV188OhcmCCenCgCx5hjdxBdSJ0+35L9jQKLMc4uhX9/pOFu84BnMB0jwsZ7Xxkw859KYqNlDTeVEe/LWyjA7mQC6MXBke+JMx0omdbkTbXmVHVeLZFg83b7hg0xqe8hKE2IW2Uggb+oIEVQT/MXwH/uqQS3Jaedz0NgAyDSoiW2QorzWVJ90EljwJ75supxhcVjWOjL0y6YDr7gGyhwFgTtAUfMxDuo6CmVOAfqU1Yt2sCNToaQ13wh8gAPmvUoFI7pTqQrH5fg2QeUx8Ropz768dx+TbU2GaTdjkpLE/4j5zhv23yl+L5Px1RwGhxxbT4jEuzc/OkgOLKLhVOLLC6Nem/4BiZyZrSn06nKwYiWHHHgtzdkciSMOgs3ok7t2+LLCD/0Evu0RbzSg9Q90rPPRHaQG7TzxjI4ch3/LenirXQJyoaXeDWH5In9lZgLHz9zeldkwz2LGVfIRWbQKrj3gCecbGNFAZ90J1D6ObILHkn6FEdyiJ2u883Fl+iuXoGKrZXuqwI3QaSDFMNK4jEY1y/AbKtgNffrFqJDrjKm6BGBLtruYf4k12qAv0wK+ROhzxvzPhogI9ru974BBdqXnfinUi2WwdbOeX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T0xcz6+q1mAhxMEK6SbYUPu5UC8Ag+u7nLhM9MLJO0NYLFlpuXe1RudQUtW8YWJLu5b0Fs0AdRTGEISiYyOorkKW1jbG2SWcTuEdCuk0Xk7dBr5kM6o1L6Bv7wLbIW/OTYQmtnPkA2THigDREcK0KYaSg80vMeOd4J9/Ia4eF6uSTXiQ/TjwJ8ri06cVBR1qvocz8uGe6U8sOH+FZVeyLBOxDrTIl//TJZFXoG1oJWNUNJsfBLcEVwMLkv8ogx6UILzDb1h3mOSs3LBXULnzoZT5t/rr2SNkXNWHpEBlD+YPqyLsGTD8gvX9Orf9YYsi/+wm1GRBVHuO9L+6SHCCeHu8i6rzDjMjQW6CAKFGBgm36MmUq+GloJQIFlo0kTuMKT4cMyLUWQIrxY7UBOiJeqxo8rYifCir0i3FMBaUj1ltjA5oLdbAMsd97DByTWvyJglmUZZFHybS5Mc0F4eVKuALiyZgpK0tkq7W/GhrmxCebuGb51UclniZUAzpid5LO1DtfHRM34x8WbaP2ZjWFkWL+pYPxtuH75eeF/3k4Z8v6NZfulhHfEiJxwKTEm5B9t9i5EkyjC0TACuV91wULk83VvL8KOSxWGnGgNSWSfKfjfqwOmU9YFBptyTDLWtYxEvytzhfEcR7w2c8FL90hV/LIpmSfELRMYnIIBQS5elOea9UtWXjVuFE3R9NNiEH2rwITDwwaOsRa2HCusFz9ExFGzNqRhAO2ss1S6Y3GgUohrE2D6LvcqPb196BRwVxy9TPY4thlmGp5nY76+5hjvVdFQTW6QOM/tPujuEpwwEmh0fy6J//RFgc+Q8zsB3gn5BMwAVxKgVHsb6FryZLFpkLp2CmoJrQsbYU1KUPqWl54Bw== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 799597b9-a160-4fcb-2491-08db4d90654e X-MS-Exchange-CrossTenant-AuthSource: SN6PR10MB3022.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 May 2023 17:44:37.4267 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: PFVV3opXPcfXRIjx4hslrAPziwPQkvzZh+pRuFEWAE676HgIK7053Hn44zA/inKmwG8Hxe6Jc/on8yXeU5X1+Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR10MB6895 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-05-05_24,2023-05-05_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 mlxlogscore=999 spamscore=0 phishscore=0 adultscore=0 mlxscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303200000 definitions=main-2305050146 X-Proofpoint-ORIG-GUID: Pycvzo22Uy-PVKVCspYzE5pAH9MIW_pJ X-Proofpoint-GUID: Pycvzo22Uy-PVKVCspYzE5pAH9MIW_pJ X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Clean up the mas_next() call to try and keep a node reference when possible. This will avoid re-walking the tree in most cases. Also clean up the single entry tree handling to ensure index/last are consistent with what one would expect. (returning NULL with limit of 1-oo). Signed-off-by: Liam R. Howlett --- lib/maple_tree.c | 89 +++++++++++++++++++++++++----------------------- 1 file changed, 47 insertions(+), 42 deletions(-) diff --git a/lib/maple_tree.c b/lib/maple_tree.c index e233f41ed4da2..09142af082148 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -4726,33 +4726,25 @@ static inline void *mas_next_nentry(struct ma_state *mas, if (ma_dead_node(node)) return NULL; + mas->last = pivot; if (entry) - goto found; + return entry; if (pivot >= max) return NULL; + if (pivot >= mas->max) + return NULL; + mas->index = pivot + 1; mas->offset++; } - if (mas->index > mas->max) { - mas->index = mas->last; - return NULL; - } - - pivot = mas_safe_pivot(mas, pivots, mas->offset, type); + pivot = mas_logical_pivot(mas, pivots, mas->offset, type); entry = mas_slot(mas, slots, mas->offset); if (ma_dead_node(node)) return NULL; - if (!pivot) - return NULL; - - if (!entry) - return NULL; - -found: mas->last = pivot; return entry; } @@ -4781,21 +4773,15 @@ static inline void mas_rewalk(struct ma_state *mas, unsigned long index) static inline void *mas_next_entry(struct ma_state *mas, unsigned long limit) { void *entry = NULL; - struct maple_enode *prev_node; struct maple_node *node; - unsigned char offset; unsigned long last; enum maple_type mt; - if (mas->index > limit) { - mas->index = mas->last = limit; - mas_pause(mas); + if (mas->last >= limit) return NULL; - } + last = mas->last; retry: - offset = mas->offset; - prev_node = mas->node; node = mas_mn(mas); mt = mte_node_type(mas->node); mas->offset++; @@ -4814,12 +4800,10 @@ static inline void *mas_next_entry(struct ma_state *mas, unsigned long limit) if (likely(entry)) return entry; - if (unlikely((mas->index > limit))) - break; + if (unlikely((mas->last >= limit))) + return NULL; next_node: - prev_node = mas->node; - offset = mas->offset; if (unlikely(mas_next_node(mas, node, limit))) { mas_rewalk(mas, last); goto retry; @@ -4829,9 +4813,6 @@ static inline void *mas_next_entry(struct ma_state *mas, unsigned long limit) mt = mte_node_type(mas->node); } - mas->index = mas->last = limit; - mas->offset = offset; - mas->node = prev_node; return NULL; } @@ -5919,6 +5900,8 @@ EXPORT_SYMBOL_GPL(mas_expected_entries); */ void *mas_next(struct ma_state *mas, unsigned long max) { + bool was_none = mas_is_none(mas); + if (mas_is_none(mas) || mas_is_paused(mas)) mas->node = MAS_START; @@ -5926,16 +5909,16 @@ void *mas_next(struct ma_state *mas, unsigned long max) mas_walk(mas); /* Retries on dead nodes handled by mas_walk */ if (mas_is_ptr(mas)) { - if (!mas->index) { - mas->index = 1; - mas->last = ULONG_MAX; + if (was_none && mas->index == 0) { + mas->index = mas->last = 0; + return mas_root(mas); } + mas->index = 1; + mas->last = ULONG_MAX; + mas->node = MAS_NONE; return NULL; } - if (mas->last == ULONG_MAX) - return NULL; - /* Retries on dead nodes handled by mas_next_entry */ return mas_next_entry(mas, max); } @@ -6059,17 +6042,25 @@ EXPORT_SYMBOL_GPL(mas_pause); */ void *mas_find(struct ma_state *mas, unsigned long max) { + if (unlikely(mas_is_none(mas))) { + if (unlikely(mas->last >= max)) + return NULL; + + mas->index = mas->last; + mas->node = MAS_START; + } + if (unlikely(mas_is_paused(mas))) { - if (unlikely(mas->last == ULONG_MAX)) { - mas->node = MAS_NONE; + if (unlikely(mas->last >= max)) return NULL; - } + mas->node = MAS_START; mas->index = ++mas->last; } - if (unlikely(mas_is_none(mas))) - mas->node = MAS_START; + + if (unlikely(mas_is_ptr(mas))) + goto ptr_out_of_range; if (unlikely(mas_is_start(mas))) { /* First run or continue */ @@ -6081,13 +6072,27 @@ void *mas_find(struct ma_state *mas, unsigned long max) entry = mas_walk(mas); if (entry) return entry; + } - if (unlikely(!mas_searchable(mas))) + if (unlikely(!mas_searchable(mas))) { + if (unlikely(mas_is_ptr(mas))) + goto ptr_out_of_range; + + return NULL; + } + + if (mas->index == max) return NULL; /* Retries on dead nodes handled by mas_next_entry */ return mas_next_entry(mas, max); + +ptr_out_of_range: + mas->node = MAS_NONE; + mas->index = 1; + mas->last = ULONG_MAX; + return NULL; } EXPORT_SYMBOL_GPL(mas_find); @@ -6518,7 +6523,7 @@ void *mt_find(struct maple_tree *mt, unsigned long *index, unsigned long max) if (entry) goto unlock; - while (mas_searchable(&mas) && (mas.index < max)) { + while (mas_searchable(&mas) && (mas.last < max)) { entry = mas_next_entry(&mas, max); if (likely(entry && !xa_is_zero(entry))) break; From patchwork Fri May 5 17:41:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Liam R. Howlett" X-Patchwork-Id: 13232905 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id BDA4EC77B7F for ; Fri, 5 May 2023 17:44:45 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 50B8A6B009B; Fri, 5 May 2023 13:44:45 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 4952B900002; Fri, 5 May 2023 13:44:45 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 30F1C6B009D; Fri, 5 May 2023 13:44:45 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by kanga.kvack.org (Postfix) with ESMTP id 0CD156B009B for ; Fri, 5 May 2023 13:44:45 -0400 (EDT) Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 345HhOIF028094; Fri, 5 May 2023 17:44:44 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=NfmDzbq7UFamW91OO64jYrReNxQsH1mzQQLxfjxVg/Q=; b=ZP8+ZhSJAXbTJdciB+8oJSVgUccLls70CKMsCcOwOsxgAY3QyKSNDAjEcZ6eTYyC2LyS ctLnWxVunVm0GZ4WbkBrKU3eD21czEimCXdKDDkWNQqNqaqvBBh/qDAvr9Cn4PZGweU2 Z1mxZ6LL5M2HGGVwpUOvVkexoT4XQC3//u4bSRPQCjitRvoOE5q43cP1L9gfIBVmRFcr 5CuGDIC/2P/5u+FqjHAB97sl8kT/gZZmojEXdOc1TMYvtMl2rh9Rqq/Tge3pUDOjYQLZ qWfYUA2R82tFrkSUgEravMH7UGndj6hIVUZIpzjQs1uuUqZLlY9kMVHQ1U8WQQQa1fFM 1A== Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3q8t145jdg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 05 May 2023 17:44:44 +0000 Received: from pps.filterd (phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 345He9fo024982; Fri, 5 May 2023 17:44:43 GMT Received: from nam11-dm6-obe.outbound.protection.outlook.com (mail-dm6nam11lp2171.outbound.protection.outlook.com [104.47.57.171]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3q8spacjk1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 05 May 2023 17:44:43 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=aLNKJgCTcHin+uAAMeAyagptF3y8OP+ZMz6rNlr91HauKRZHtDB8F8IdeWPwoCFUEu4bcefBOhCmZqMWiBb9UVAt00zbNKf8sPngkySC76EB9JOvByDR4sIhAkKMFgPwIotGGhvDaqPvCxW6KCO6Aeo/FS0WUgIltTmxrjWhBBrg51qaGIdGwesoj2e7JnQGOWSg2oSoNfISG/JnsM8urau4iT77s/BiQ8oFQWwyO7o90/5ULVFsT2r6TDr0Iw0XsqRtgEZIdlRoPQf8POZ232L5GQ+FOYPBUlAGjSlp9ll8U+giNsqKlUppQPdIsuJWTmEo7afjtr8yrZB1W7OP+A== 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=NfmDzbq7UFamW91OO64jYrReNxQsH1mzQQLxfjxVg/Q=; b=DmckErDdwWXhvyo+ZC2o/RGlKDxyp7yOzd7O5f/EorXyHjmt+fedV7rex0aCwYaTV3q+ovH2DOvaQJTrR6lgbvtg2Qr+t0U9lzxFf/L4iAhtbGWuep/OTQSgNwaCFfK0BHUaeiVUmPA251rR0QLa0ViA5I+5HEOikg4ffSktlBXBw08Oz2xsKAuW59dAFLJkPJ5JdHAKpzWlEzqiFbxwD9mK+H+noHzT1T4ATss8ikKy4lJESDU/lNyDSna8vIq9NGxB8fp3wFFqBcpNMEu9+VAUi3/L+OMoh/U3nPMasExCZF559UvBcRv1tyCMlselH9/g/oerVQTHVTVV9KqjOg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=NfmDzbq7UFamW91OO64jYrReNxQsH1mzQQLxfjxVg/Q=; b=Xg6L1qf+tAA2pC7xfDExii3mxlVixd2II//7ApiDYlOIk4As4vidkhgYIJj6VgzPnmOHL3NlelflBoQyg93J1S/MXmkGfYWYRVA9tGjW7qPA4usghinCVLXVvujpWjNQDJWAbDFAuXjk3vbbGY+UysmuDz3SY1UBh5YZtoBFOtU= Received: from SN6PR10MB3022.namprd10.prod.outlook.com (2603:10b6:805:d8::25) by DS0PR10MB6895.namprd10.prod.outlook.com (2603:10b6:8:134::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6363.27; Fri, 5 May 2023 17:44:39 +0000 Received: from SN6PR10MB3022.namprd10.prod.outlook.com ([fe80::8bb9:2bb7:3930:b5da]) by SN6PR10MB3022.namprd10.prod.outlook.com ([fe80::8bb9:2bb7:3930:b5da%7]) with mapi id 15.20.6363.022; Fri, 5 May 2023 17:44:39 +0000 From: "Liam R. Howlett" To: Andrew Morton Cc: maple-tree@lists.infradead.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, "Liam R. Howlett" Subject: [PATCH v2 24/36] maple_tree: Try harder to keep active node with mas_prev() Date: Fri, 5 May 2023 13:41:52 -0400 Message-Id: <20230505174204.2665599-25-Liam.Howlett@oracle.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230505174204.2665599-1-Liam.Howlett@oracle.com> References: <20230505174204.2665599-1-Liam.Howlett@oracle.com> X-ClientProxiedBy: YT4PR01CA0204.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:ad::12) To SN6PR10MB3022.namprd10.prod.outlook.com (2603:10b6:805:d8::25) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN6PR10MB3022:EE_|DS0PR10MB6895:EE_ X-MS-Office365-Filtering-Correlation-Id: e98f8859-a07e-4207-fc95-08db4d90668f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: AllDO3Cf6kwbtN/LGAbo5DFcbXYwpLuUXxNaohMvXWyFhdQ7P0g4zl6O9Cw3d5Q4CxT7OZLkuyd5p3xh6YBO2LS8sl5dxszlg0BcRfEGFKBvsSing8YXvsndGC2/XQoX1cZVQC5vTK684Xqz55eHG9TBZv46kgaytHvobbLxGq5y1n5kTZToH11Go+ttDOX3ZV0n2FNLb+5B6rca0l5e+lLQ19lMY1S1ptStbLhyIYMimpS3Z9WWbHyqCvzokHBGHiY+/tX//lEK1FGnGjdTpqXK+VVUinfPzq+NoVMKk4moXQvDldULQ7oFfldA0bQo0NgcKtoxbXJqT05TFKNqW5UAWuZbXuTRNj67k2kFAikOw419Udzk3LE5+jiD+rf599mn/1YC00Il2Vi78q5jbme2GFtLn2SLMwvIyHclM64Gt3nFfEsQs9aXUM8C2Was/sR9JpWSIYRDvZOKKP/DkndkgpUcDa5JIuGggsH25aKFQgmABCUIrlnvACyY4disT7uibkzxjICEzuIQ2IDenv8fO9TVm58Jkjm70VvNq5bKgdFmZt8wecmD8wWyU/45J3lirMxxcrCOnJfLAz9AuciuaALowEVjWZqZqiqSwI3fr0BpTOAnf+toTg5Z5ikvI8Bf8PPUiMIkKU/4w0ZHLQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SN6PR10MB3022.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(136003)(376002)(346002)(396003)(39860400002)(366004)(451199021)(4326008)(6916009)(66946007)(66476007)(66556008)(41300700001)(8936002)(5660300002)(8676002)(6512007)(26005)(6506007)(1076003)(316002)(478600001)(6666004)(6486002)(107886003)(2906002)(186003)(2616005)(83380400001)(86362001)(36756003)(38100700002)(34023003)(148693002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: yK7d1lFEF9R14JuPmOJrDxPAhvd4RFmtDC8p5NuzTOHuaSPb2w9mxPAkyVWKbJhPMtkMavarFr9QHJOzWFwc7sm8W1TJJxXKo/P2qNyanP/EEJQf8Wuv0ajF2mudcXxzF1b+wYFtBbDOQSmz4WU+ifj9CWR1/1N1FKjjjbQAZ2/G0gUpnfSSiBl6IXLXwrIMuGbH79JCbMB5KwYT+9cfeCGVXunspEqe4Cjc/yAVEl1av+h7mzcMrN4ULrYTZJ3QzKrJQs6qlGUwweOPEyzMEjJqG3NzF8wmBcy3Do+0j9hlTmgenS3RHLrjlEEbHH4W4Lrvfnd9Ah2MJidimdY4ghkGuZzJnU1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en55bcpDh7c6WRzQj/188Pb0J1X8VrVdSrrcNZxa0SaQWfIQrAVIBnfHp+5l2faK7XCnVHiky2ZdhnETJUT/rmylHxL55jWj9g== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: e98f8859-a07e-4207-fc95-08db4d90668f X-MS-Exchange-CrossTenant-AuthSource: SN6PR10MB3022.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 May 2023 17:44:39.5521 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 33TBx5Ni2UX6cQzCreNTfO524nPkl8K5m7RDzFKVqSQbpOOw2+h20IG7nIzKcJB1BTND7+hQadZKu+OXOQ5mOw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR10MB6895 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-05-05_24,2023-05-05_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 mlxlogscore=999 spamscore=0 phishscore=0 adultscore=0 mlxscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303200000 definitions=main-2305050146 X-Proofpoint-GUID: GT13RXUlT69iASCxQKMF734_Hxs1eGIU X-Proofpoint-ORIG-GUID: GT13RXUlT69iASCxQKMF734_Hxs1eGIU X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Keep a reference to the node when possible with mas_prev(). This will avoid re-walking the tree. In keeping a reference to the node, keep the last/index accurate to the range being referenced. This means the limit may be within the range, but the range may extend outside of the limit. Also fix the single entry tree to respect the range (of 0), or set the node to MAS_NONE in the case of shifting beyond 0. Signed-off-by: Liam R. Howlett --- lib/maple_tree.c | 125 +++++++++++++++++++++++++++++++---------------- 1 file changed, 83 insertions(+), 42 deletions(-) diff --git a/lib/maple_tree.c b/lib/maple_tree.c index 09142af082148..425ad922bb2d6 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -4827,7 +4827,7 @@ static inline void *mas_prev_nentry(struct ma_state *mas, unsigned long limit, unsigned long index) { unsigned long pivot, min; - unsigned char offset; + unsigned char offset, count; struct maple_node *mn; enum maple_type mt; unsigned long *pivots; @@ -4841,29 +4841,42 @@ static inline void *mas_prev_nentry(struct ma_state *mas, unsigned long limit, mn = mas_mn(mas); mt = mte_node_type(mas->node); offset = mas->offset - 1; - if (offset >= mt_slots[mt]) - offset = mt_slots[mt] - 1; - slots = ma_slots(mn, mt); pivots = ma_pivots(mn, mt); + count = ma_data_end(mn, mt, pivots, mas->max); if (unlikely(ma_dead_node(mn))) { mas_rewalk(mas, index); goto retry; } - if (offset == mt_pivots[mt]) + offset = mas->offset - 1; + if (offset >= mt_slots[mt]) + offset = mt_slots[mt] - 1; + + if (offset >= count) { pivot = mas->max; - else + offset = count; + } else { pivot = pivots[offset]; + } if (unlikely(ma_dead_node(mn))) { mas_rewalk(mas, index); goto retry; } - while (offset && ((!mas_slot(mas, slots, offset) && pivot >= limit) || - !pivot)) + while (offset && !mas_slot(mas, slots, offset)) { pivot = pivots[--offset]; + if (pivot >= limit) + break; + } + + /* + * If the slot was null but we've shifted outside the limits, then set + * the range to the last NULL. + */ + if (unlikely((pivot < limit) && (offset < mas->offset))) + pivot = pivots[++offset]; min = mas_safe_min(mas, pivots, offset); entry = mas_slot(mas, slots, offset); @@ -4872,32 +4885,33 @@ static inline void *mas_prev_nentry(struct ma_state *mas, unsigned long limit, goto retry; } - if (likely(entry)) { - mas->offset = offset; - mas->last = pivot; - mas->index = min; - } + mas->offset = offset; + mas->last = pivot; + mas->index = min; return entry; } static inline void *mas_prev_entry(struct ma_state *mas, unsigned long min) { void *entry; + struct maple_enode *prev_enode; + unsigned char prev_offset; - if (mas->index < min) { - mas->index = mas->last = min; - mas->node = MAS_NONE; + if (mas->index < min) return NULL; - } + retry: + prev_enode = mas->node; + prev_offset = mas->offset; while (likely(!mas_is_none(mas))) { entry = mas_prev_nentry(mas, min, mas->index); - if (unlikely(mas->last < min)) - goto not_found; if (likely(entry)) return entry; + if (unlikely(mas->index <= min)) + return NULL; + if (unlikely(mas_prev_node(mas, min))) { mas_rewalk(mas, mas->index); goto retry; @@ -4906,9 +4920,8 @@ static inline void *mas_prev_entry(struct ma_state *mas, unsigned long min) mas->offset++; } - mas->offset--; -not_found: - mas->index = mas->last = min; + mas->node = prev_enode; + mas->offset = prev_offset; return NULL; } @@ -5957,15 +5970,8 @@ EXPORT_SYMBOL_GPL(mt_next); */ void *mas_prev(struct ma_state *mas, unsigned long min) { - if (!mas->index) { - /* Nothing comes before 0 */ - mas->last = 0; - mas->node = MAS_NONE; - return NULL; - } - - if (unlikely(mas_is_ptr(mas))) - return NULL; + if (mas->index <= min) + goto none; if (mas_is_none(mas) || mas_is_paused(mas)) mas->node = MAS_START; @@ -5973,19 +5979,30 @@ void *mas_prev(struct ma_state *mas, unsigned long min) if (mas_is_start(mas)) { mas_walk(mas); if (!mas->index) - return NULL; + goto none; } - if (mas_is_ptr(mas)) { - if (!mas->index) { - mas->last = 0; - return NULL; - } - + if (unlikely(mas_is_ptr(mas))) { + if (!mas->index) + goto none; mas->index = mas->last = 0; - return mas_root_locked(mas); + return mas_root(mas); + } + + if (mas_is_none(mas)) { + if (mas->index) { + /* Walked to out-of-range pointer? */ + mas->index = mas->last = 0; + mas->node = MAS_ROOT; + return mas_root(mas); + } + return NULL; } return mas_prev_entry(mas, min); + +none: + mas->node = MAS_NONE; + return NULL; } EXPORT_SYMBOL_GPL(mas_prev); @@ -6111,8 +6128,16 @@ EXPORT_SYMBOL_GPL(mas_find); */ void *mas_find_rev(struct ma_state *mas, unsigned long min) { + if (unlikely(mas_is_none(mas))) { + if (mas->index <= min) + goto none; + + mas->last = mas->index; + mas->node = MAS_START; + } + if (unlikely(mas_is_paused(mas))) { - if (unlikely(mas->last == ULONG_MAX)) { + if (unlikely(mas->index <= min)) { mas->node = MAS_NONE; return NULL; } @@ -6132,14 +6157,30 @@ void *mas_find_rev(struct ma_state *mas, unsigned long min) return entry; } - if (unlikely(!mas_searchable(mas))) - return NULL; + if (unlikely(!mas_searchable(mas))) { + if (mas_is_ptr(mas)) + goto none; + + if (mas_is_none(mas)) { + /* + * Walked to the location, and there was nothing so the + * previous location is 0. + */ + mas->last = mas->index = 0; + mas->node = MAS_ROOT; + return mas_root(mas); + } + } if (mas->index < min) return NULL; /* Retries on dead nodes handled by mas_prev_entry */ return mas_prev_entry(mas, min); + +none: + mas->node = MAS_NONE; + return NULL; } EXPORT_SYMBOL_GPL(mas_find_rev); From patchwork Fri May 5 17:41:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Liam R. Howlett" X-Patchwork-Id: 13232911 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 67903C77B7C for ; Fri, 5 May 2023 17:44:58 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6E4956B00A2; Fri, 5 May 2023 13:44:56 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 61B576B00A4; Fri, 5 May 2023 13:44:56 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 447F86B00A3; Fri, 5 May 2023 13:44:56 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by kanga.kvack.org (Postfix) with ESMTP id 207406B00A1 for ; Fri, 5 May 2023 13:44:56 -0400 (EDT) Received: from pps.filterd (m0333520.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 345HhQ8a031799; Fri, 5 May 2023 17:44:46 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=MconJcdQ5PNIkXbmMn9lrZAStfvANxcQEAkfOBppt3M=; b=OfC3ScE4aeBbqTiteIEFigFxppLwCPgjYxRFeMA8yt/JtQd3c6B3MUYlQkjTLjkDZ7uJ c5pDX4Vy+dphtlqv2VfP6zAFizIhb1NQztHvktd+JFqLOlwn4gr8ELgB2L2MXdX6dfDj lXmFJbEjAarMQTIlibHuWu+Qp3YMD6t5gDHnD3IVZCu63wJ9PMQ+OjULq9RMlB3HTvku smcAvM5md2tXQxEo5hKGUKffhITcG5lU0ULBpYpwZ3dUnHw299gnlqAyM1aFYDYwTv+C 6xRnp4awTjtEXhSyulOPh+M1rUfylErQ2u3SK9gCtxbZ/cu+h0FgdeBamBf00ZoyniO/ 3g== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3q8u9d5nf1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 05 May 2023 17:44:46 +0000 Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 345HQSiT026716; Fri, 5 May 2023 17:44:45 GMT Received: from nam11-dm6-obe.outbound.protection.outlook.com (mail-dm6nam11lp2177.outbound.protection.outlook.com [104.47.57.177]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3q8spgf06s-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 05 May 2023 17:44:45 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DEaEPZemYCIBJCSjiPRQB+oOQfIqdEAXauXik8pHJTyzudkDMD50H8Zz9IRunGJolVnpX6MFTfBbkL1IinCuGzGqxMfm9TZP9Omd3jyC6we20onv3SQEXKbOf9mNhzpe8yyvrpcMgZpO5HQkYkqhbtrI3TUnMzAJhQBMsYMI/62LS1W2493XOPmdNogqGCrCfyGfLWnQ9pXpyC4J+20u30spvFjyk8rmh7kBVflHaIVqquKfAJ4eXqOK2obaa9ivQU9ge8PEBG4YJsfv86UrsmDHFMwVpMeBWo0N7Pa2uwCOL4AyCr3PFqWlJk4qUeURrzVOxpjF5otpU/9X+RyGUw== 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=MconJcdQ5PNIkXbmMn9lrZAStfvANxcQEAkfOBppt3M=; b=mubBLQvGPVkoE3hC0O/n3I+/eysHDKFbcU2Fm5Hj/2Ko8UYXWf4PUgt1DqH6m8whRj2KP/88F4BZG7+Od99UWHOaqztmIp9HU+QGgu+LK4CTrib0fuscslHdx6CbFEGHJqFm3GBEwYj03trYQ1TpMk6GOMVOpIswwe5C3GmyRrKke4CDRVAkpgzfHW3383nggf50HoevknYI2V2GmuYmqWzIY7kfR8My4zhXWa/xjNj9aJ/+m9AQx8U9yYi2ddhNFO08sk950EcMCAI0XMuUW9lcMMBjqScOOpX3zYeYp2WdmRLQS4iNmFRgnB3LXtuaaXU5cMHkJLDd4z4zXi+fCg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=MconJcdQ5PNIkXbmMn9lrZAStfvANxcQEAkfOBppt3M=; b=lxcZoVEALTbh73ezma2tb3kUZrVF3lTVF6FkQyz+kbp9o36zhq3Ctxd1deTvbW8/45aMSKeWt+hyqc4ISuJJIkYGLK/8UBfJ9WRhs2n1Xsxo1kuwgDkq+s8oifZ1591f8TsABj18BeMGbmyZOmdLhdW6Ufqvhl8CYnH6UJI3v9Y= Received: from SN6PR10MB3022.namprd10.prod.outlook.com (2603:10b6:805:d8::25) by DS0PR10MB6895.namprd10.prod.outlook.com (2603:10b6:8:134::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6363.27; Fri, 5 May 2023 17:44:41 +0000 Received: from SN6PR10MB3022.namprd10.prod.outlook.com ([fe80::8bb9:2bb7:3930:b5da]) by SN6PR10MB3022.namprd10.prod.outlook.com ([fe80::8bb9:2bb7:3930:b5da%7]) with mapi id 15.20.6363.022; Fri, 5 May 2023 17:44:41 +0000 From: "Liam R. Howlett" To: Andrew Morton Cc: maple-tree@lists.infradead.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, "Liam R. Howlett" , Peng Zhang Subject: [PATCH v2 25/36] maple_tree: Revise limit checks in mas_empty_area{_rev}() Date: Fri, 5 May 2023 13:41:53 -0400 Message-Id: <20230505174204.2665599-26-Liam.Howlett@oracle.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230505174204.2665599-1-Liam.Howlett@oracle.com> References: <20230505174204.2665599-1-Liam.Howlett@oracle.com> X-ClientProxiedBy: YT4PR01CA0335.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:10a::26) To SN6PR10MB3022.namprd10.prod.outlook.com (2603:10b6:805:d8::25) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN6PR10MB3022:EE_|DS0PR10MB6895:EE_ X-MS-Office365-Filtering-Correlation-Id: fda8e013-9356-439e-4d47-08db4d9067a9 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: wnCs504GBYqBF49N0B9dc8JBRksncdKi/gVSmJeu98T+wcXLiiersXbAUiEk86OaiHNhPXlhjgEv24RdqKrD9wll0Z/49eucB3GI2Lw8nUvmLfO1BObnvQAI/tu1wJ777IOdJrcBtzRzb/C6+zbC8VC1lF3VnPGMcFCQjK0PMbP7BlWj6BZ9TYeaXfbb6caHHWy/p2t4Y6/jsqLts/BY0+cDk07FNHBPgwtsyy2VCehMsMxkws+B4A9gQbDIzblXTQegFXQqevRzszmjheUHSEAb1rtRVjZyzThiROOYMcm7SKmID/3SZrftDR0QjPS2NwGod5bXGNJnpY9SHP9mQ/11wxuQ5KEN+AuJT3y6S095rNYn+04Dx47U2+2HiCdkuAJDdbsJYdA9sy4hkM4Xb2C3bAq92RVkdZrlPWnxavbOD1qIXOq71JZgwO+Nch6MBIG5pINL5p5SoX2VOwS4cZFXR+/4KHGS/Afh6G+Q8VQcLfS0vJEK3YZ+Ki8lpGSvUH2oVVGwmMoBH/W6aghlZrGdHb9iOAC3JXNFDXA2RTtmuDxKFdV3012IHNdswamT X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SN6PR10MB3022.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(136003)(376002)(346002)(396003)(39860400002)(366004)(451199021)(4326008)(6916009)(66946007)(66476007)(66556008)(41300700001)(8936002)(5660300002)(8676002)(6512007)(26005)(6506007)(1076003)(54906003)(316002)(478600001)(6666004)(6486002)(2906002)(186003)(2616005)(83380400001)(86362001)(36756003)(38100700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: FIxG9Tcd0goeZoETjbYuqFcy1Jo6CuaPlCBdQpGbg15EQLp9UPUtICi94fjhYrP49IP24TPGEpAYTOLiOFSHbCyLISiDjnbA/2pzOCfR++sfbmQ+gjKT1d2kzr0z5Mw9I1tCNbVMNo45PaOFg489xRQ+m6cFRVld+9cHzbcC7Kk2ijFTqt+oHa3QPXQK7Sas/YYGNg6MNRq1Hxrp08WpK4FeQXWJGzTsgMflneVqL7YkEE5fMF5lTSlaw+cUTvdOJ3ayA/PNwXI6zLyYxHmbHCP8KuS+2EucVcJtuWqSc15s4TEaloXVkB+r8qm+RBsah8s+EMGPXpibMZKxnrbF0e5fHfAPhicrkQjqZCLbrCmzo6XOy6b2eUrwLcfHfWxKD/z8czzX8LTC3KDKTribhZjREICY14HCCy6PEuxQF0ETtuVGPaKOYG5nkJxDbEoNm8LQbekAEGZMBypRtlQ1n7QC4J+/CaYsupPRHpGZHkolxV0iDs93PbvnO5H6FJz1JlDynCZQydy1lzgIOSAZCIP7WFRWuWxlX7iC/dXazdYPftw9Kn0CxmCRW6LRZ0lhQbVGA7Ja+wUT6+sUSqQehWj0ejU+G2fDh+XIklt750h/o7nsA2gUKr0nFFgxLL5IiUqsLCZBscSyULsI76Gzj/A515GI76aDEGIAgoYG7BlJN9f5n1fedfu+oOQ6+zMfY+LrpO2RLQWJdEhEeLnBfupnOv2nyI195y4LOtdD2vgz7non8GOcPEngi9y3KgcSpGVDW2Dh0/Z+cuaw4ZwiW30ntzOwNj7xiBxZnMDOWxnK4eUvu6ba+jkfkt4hQJnesDD9C85SMXH9/QHqStTROdqRegquVMWO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gyRDB7yOCTn56Le3NhMN7Gi66tOvsKb3122Wyk6M1yGek78TlUmpX6CTzEPZQ7ak0cO+M99FxL5UTf+Zev9bUL0NO7ecoAPTJc/RVlbtrj6qGkR0V+P3PsMlzBPx96ssRRkid0SaQ0sfKBGlVrKRRC1C8kjr6xigZ4eSYdKFQ3XOC9KYlVGjTUzkPGpqMm4ORO4BwjelKOBd2EoWOvzcX6nfyz180p6oXyxBcKFAXLiue254i8RMIDodeBQ6TDmKeTEYrM8o08wqYHdm9hMoGG/MIdOZdbHXw7VxET8BXJsn61CJv05JGBj2yL2ZSRpuDADI4q5zSW95MsB+h4TyHeysVnzqDgMaa5C6v80rRaJ9bbsJcbyhEdY/PiU+S+WVjjuuCpZaj5y5RmILh3PZtr6UJqACekHXVEWam8E/sDC7EqoTOrw8dkujrwBnkQwihJ5p5iHAaOllZQP86lqLtGY3etFP1t3Xcq9S0Y3qHIPkhiInRIS8Ew46xukkssh6+ZCvl0gO3/4+tFZFk8Byt2a9sO0/i7hsGSteZsKqh8hoKyMC2eSehy8Msocw6CbAsetlR3ReL7tIyKo6tHTrMw3gyl7FwPqzwdqPWvIYHdsLef8f/lms14aea84iWcFHjMUsWUaSM2D1aPj46wcShEZjoMAMOP18FCEKhBsRBmmQYLEWHAEqihNoM+xvGXfE3+ X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: fda8e013-9356-439e-4d47-08db4d9067a9 X-MS-Exchange-CrossTenant-AuthSource: SN6PR10MB3022.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 May 2023 17:44:41.3814 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 5As6icTo3WN9Jm4XB6OAX8vpNrzD0M/FqL9zMflhRePU47aYYCXn00rJcDwX4Jx2UnegL5HU9gL5dp0rgAguBQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR10MB6895 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-05-05_24,2023-05-05_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 bulkscore=0 spamscore=0 mlxlogscore=999 mlxscore=0 adultscore=0 phishscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303200000 definitions=main-2305050146 X-Proofpoint-GUID: -KxCpIEoAxnlQMhiRl-jqgc5MUcL99VT X-Proofpoint-ORIG-GUID: -KxCpIEoAxnlQMhiRl-jqgc5MUcL99VT X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Since the maple tree is inclusive in range, ensure that a range of 1 (min = max) works for searching for a gap in either direction, and make sure the size is at least 1 but not larger than the delta between min and max. This commit also updates the testing. Unfortunately there isn't a way to safely update the tests and code without a test failure. Suggested-by: Peng Zhang Signed-off-by: Liam R. Howlett --- lib/maple_tree.c | 20 +++++++++++++------- lib/test_maple_tree.c | 27 ++++++++++++++++++++------- 2 files changed, 33 insertions(+), 14 deletions(-) diff --git a/lib/maple_tree.c b/lib/maple_tree.c index 425ad922bb2d6..580310741d892 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -5282,7 +5282,10 @@ int mas_empty_area(struct ma_state *mas, unsigned long min, unsigned long *pivots; enum maple_type mt; - if (min >= max) + if (min > max) + return -EINVAL; + + if (size == 0 || max - min < size - 1) return -EINVAL; if (mas_is_start(mas)) @@ -5337,7 +5340,10 @@ int mas_empty_area_rev(struct ma_state *mas, unsigned long min, { struct maple_enode *last = mas->node; - if (min >= max) + if (min > max) + return -EINVAL; + + if (size == 0 || max - min < size - 1) return -EINVAL; if (mas_is_start(mas)) { @@ -5373,7 +5379,7 @@ int mas_empty_area_rev(struct ma_state *mas, unsigned long min, return -EBUSY; /* Trim the upper limit to the max. */ - if (max <= mas->last) + if (max < mas->last) mas->last = max; mas->index = mas->last - size + 1; @@ -6409,7 +6415,7 @@ int mtree_alloc_range(struct maple_tree *mt, unsigned long *startp, { int ret = 0; - MA_STATE(mas, mt, min, max - size); + MA_STATE(mas, mt, min, min); if (!mt_is_alloc(mt)) return -EINVAL; @@ -6429,7 +6435,7 @@ int mtree_alloc_range(struct maple_tree *mt, unsigned long *startp, retry: mas.offset = 0; mas.index = min; - mas.last = max - size; + mas.last = max - size + 1; ret = mas_alloc(&mas, entry, size, startp); if (mas_nomem(&mas, gfp)) goto retry; @@ -6445,14 +6451,14 @@ int mtree_alloc_rrange(struct maple_tree *mt, unsigned long *startp, { int ret = 0; - MA_STATE(mas, mt, min, max - size); + MA_STATE(mas, mt, min, max - size + 1); if (!mt_is_alloc(mt)) return -EINVAL; if (WARN_ON_ONCE(mt_is_reserved(entry))) return -EINVAL; - if (min >= max) + if (min > max) return -EINVAL; if (max < size - 1) diff --git a/lib/test_maple_tree.c b/lib/test_maple_tree.c index 19b130c9dddea..fbf7b6f227f34 100644 --- a/lib/test_maple_tree.c +++ b/lib/test_maple_tree.c @@ -123,7 +123,7 @@ static noinline void __init check_mtree_alloc_rrange(struct maple_tree *mt, unsigned long result = expected + 1; int ret; - ret = mtree_alloc_rrange(mt, &result, ptr, size, start, end - 1, + ret = mtree_alloc_rrange(mt, &result, ptr, size, start, end, GFP_KERNEL); MT_BUG_ON(mt, ret != eret); if (ret) @@ -701,7 +701,7 @@ static noinline void __init check_alloc_rev_range(struct maple_tree *mt) 0, /* Return value success. */ 0x0, /* Min */ - 0x565234AF1 << 12, /* Max */ + 0x565234AF0 << 12, /* Max */ 0x3000, /* Size */ 0x565234AEE << 12, /* max - 3. */ 0, /* Return value success. */ @@ -713,14 +713,14 @@ static noinline void __init check_alloc_rev_range(struct maple_tree *mt) 0, /* Return value success. */ 0x0, /* Min */ - 0x7F36D510A << 12, /* Max */ + 0x7F36D5109 << 12, /* Max */ 0x4000, /* Size */ 0x7F36D5106 << 12, /* First rev hole of size 0x4000 */ 0, /* Return value success. */ /* Ascend test. */ 0x0, - 34148798629 << 12, + 34148798628 << 12, 19 << 12, 34148797418 << 12, 0x0, @@ -732,6 +732,12 @@ static noinline void __init check_alloc_rev_range(struct maple_tree *mt) 0x0, -EBUSY, + /* Single space test. */ + 34148798725 << 12, + 34148798725 << 12, + 1 << 12, + 34148798725 << 12, + 0, }; int i, range_count = ARRAY_SIZE(range); @@ -780,9 +786,9 @@ static noinline void __init check_alloc_rev_range(struct maple_tree *mt) mas_unlock(&mas); for (i = 0; i < req_range_count; i += 5) { #if DEBUG_REV_RANGE - pr_debug("\tReverse request between %lu-%lu size %lu, should get %lu\n", - req_range[i] >> 12, - (req_range[i + 1] >> 12) - 1, + pr_debug("\tReverse request %d between %lu-%lu size %lu, should get %lu\n", + i, req_range[i] >> 12, + (req_range[i + 1] >> 12), req_range[i+2] >> 12, req_range[i+3] >> 12); #endif @@ -901,6 +907,13 @@ static noinline void __init check_alloc_range(struct maple_tree *mt) 4503599618982063UL << 12, /* Size */ 34359052178 << 12, /* Expected location */ -EBUSY, /* Return failure. */ + + /* Test a single entry */ + 34148798648 << 12, /* Min */ + 34148798648 << 12, /* Max */ + 4096, /* Size of 1 */ + 34148798648 << 12, /* Location is the same as min/max */ + 0, /* Success */ }; int i, range_count = ARRAY_SIZE(range); int req_range_count = ARRAY_SIZE(req_range); From patchwork Fri May 5 17:41:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Liam R. Howlett" X-Patchwork-Id: 13232906 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id CCED1C77B75 for ; Fri, 5 May 2023 17:44:47 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5CF606B009F; Fri, 5 May 2023 13:44:47 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 580956B009E; Fri, 5 May 2023 13:44:47 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 420316B009F; Fri, 5 May 2023 13:44:47 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by kanga.kvack.org (Postfix) with ESMTP id 1C8176B009D for ; Fri, 5 May 2023 13:44:47 -0400 (EDT) Received: from pps.filterd (m0246632.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 345HhIUc002987; Fri, 5 May 2023 17:44:46 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=0Ka6Dn5m4CcrZYyEBIVismStZ9lyI0eLhcunT5aSalE=; b=1Y5MJ2jC7fhmsQFA6xkDTmOE5abZv36zg8fdOyol2Auvu+fUjQcAENULsF0cvwb1jl5M LrkcF/HOKztkvbd46JLOdFdSUPxsfGZKzawMgbIdRtjC3v8Qjh69uINLnMPXBDSphYL8 GoHKcs7LJ+qFVQZ6wGiOeqJ3Q4GOFIif3DwQcxbD177KQHqZDhVSCyPCZ6uZe2RiqrJ6 WI8mqELPw3E7Tjlru+hdMti3iz+UzcLxIH2uFzbVg0Qz4sROc6G0+0kQfg/FT/hG5/h4 ZUHewQeFAJ6QRpQhR2Dr7A37KalTJNhksSMJcQ89HSJvnyYm5fA6ytyn0pmlqV8KeMAx 9Q== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3qburgdkdr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 05 May 2023 17:44:46 +0000 Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 345HQSiU026716; Fri, 5 May 2023 17:44:46 GMT Received: from nam11-dm6-obe.outbound.protection.outlook.com (mail-dm6nam11lp2177.outbound.protection.outlook.com [104.47.57.177]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3q8spgf06s-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 05 May 2023 17:44:46 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ixQkarnanwo4Dv910eUdFhHE89QT0PzAQTVNfMzyUSD77Q7XPqLvocQxaEx6kt+XyT7Xjzrh+foVaB6xNSOcyGXo62ZL3Lx0oYDYRvH21ldDTJn7aqMcAV5+EeQ4kgR9NlONX7epijXCHpJwqzFs/65AINqwha9zhDb3Y0CU0GJ2ko8RmLq1Ogpg2WsxTpgcg0LmNje9P1JYEH57l32tLS50/vzSdcNbPjRfai068IEaLaEfCfCr9mPRVSdtHbUNC2CbOYz2tXDKCrds/b88v+vd7nrekz7Ba/kgmapCEEpZGDVEJXJE66x2BGZM+qw4OT6C/4UxgXd1DyXD7qEDNA== 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=0Ka6Dn5m4CcrZYyEBIVismStZ9lyI0eLhcunT5aSalE=; b=VFbrIFum2wCEawCINkCOiaWR9MjTpBl2Bc+I7WTu3O2uhnHAdYAPEELx/gIDmIzVgs50ekOKBYzYT4dStHnmDalTZNn46glqHR0kDwg4epCYfXvSRemOL0D5z/yotDkS4J9IVLMR3aqI+wDYORW/2Th8tWclmw0Fzrj9wpx4DXMCDlnmiUiLRODfshAdN6U0P842Ru7Kv+3ZicagxyNbrgDWHoHrvAf//sizWErS7h0E4G0gRn+w0CAwv86flogbKFJTKaItzk0sK5fip8iW0pyCTofpI4544V3zU9m330MnrN108X35Yna7FTByIH9lVXoEqnEJ36wyJ+DYU+cgcw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=0Ka6Dn5m4CcrZYyEBIVismStZ9lyI0eLhcunT5aSalE=; b=j71mbhqkBH9i9x7fPI/WSM31KJ+x0XVOPGsD5V0drnCBe+UJsacKABHMdVvPmQk0yn6dMxdwf/QMLNWKXx4LID0DPSFwDaC4CTxWYegupi+lKbKtHmf2fgCI+8BeZqQXpTWe6GCZKhVADfd1XwO0DVludOkD0rXqdUmtI3U6CDY= Received: from SN6PR10MB3022.namprd10.prod.outlook.com (2603:10b6:805:d8::25) by DS0PR10MB6895.namprd10.prod.outlook.com (2603:10b6:8:134::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6363.27; Fri, 5 May 2023 17:44:43 +0000 Received: from SN6PR10MB3022.namprd10.prod.outlook.com ([fe80::8bb9:2bb7:3930:b5da]) by SN6PR10MB3022.namprd10.prod.outlook.com ([fe80::8bb9:2bb7:3930:b5da%7]) with mapi id 15.20.6363.022; Fri, 5 May 2023 17:44:43 +0000 From: "Liam R. Howlett" To: Andrew Morton Cc: maple-tree@lists.infradead.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, "Liam R. Howlett" Subject: [PATCH v2 26/36] maple_tree: Fix testing mas_empty_area() Date: Fri, 5 May 2023 13:41:54 -0400 Message-Id: <20230505174204.2665599-27-Liam.Howlett@oracle.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230505174204.2665599-1-Liam.Howlett@oracle.com> References: <20230505174204.2665599-1-Liam.Howlett@oracle.com> X-ClientProxiedBy: YT3PR01CA0046.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:82::8) To SN6PR10MB3022.namprd10.prod.outlook.com (2603:10b6:805:d8::25) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN6PR10MB3022:EE_|DS0PR10MB6895:EE_ X-MS-Office365-Filtering-Correlation-Id: 6b86e0c4-8a91-4240-37bd-08db4d9068fe X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: pwSJIVWieIOgG5+ZY3ET7xyE/I280Xe0ivhzRpDDJGrrMYTyjrSxUo8SBOoQQwsNpAivCIIWUwzgYsuIzREAuRE/hBwsTVqX+RXm9hfflE0vyLfhtrgWRp+9StLx8hGyf8YMdZwyAeB7CG6N5IwrFSmeYBzpcfg4hNKUPnH7oB6sKMR+bNpZpf8CVeFNMjTxFf9MjR68ICkoAdM1pwqgEHzp8SvtNw/qJRQjJwaxLPEhA+03vnCJl5fI5qRIAo6bHNrpY+2WgmJ2/o2lj9gT9VlbQVdCRv/73Mnt5H51oRDjpxNQj+Ydt7hl8T+FonOMesCv2R0jqmAWrlE6EeRd0M0XXcOYj8OeculfbGiFF8GZlpkMhoOQLby3xqu7IK3TUWhC4tJPEps3rchqqJ0ALTzTDvpTlzoV8OhDYDa1dUbgEcvG6XGo5QpkaHWUGybU7yHbu4Q6yYlT2UKC6DvmI9kUgrEWjL1Swy3W7J9SnH8/oFM/tvOoL4zyEyQRF70sa5F+mBdkW+RxKZ/Zww6QPNET/nH+uzGMjppyizqRgDtMM88bNODxLsB5Hz25BHYb X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SN6PR10MB3022.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(136003)(376002)(346002)(396003)(39860400002)(366004)(451199021)(4326008)(6916009)(66946007)(66476007)(66556008)(41300700001)(8936002)(5660300002)(8676002)(6512007)(26005)(6506007)(1076003)(316002)(478600001)(6666004)(6486002)(107886003)(2906002)(4744005)(186003)(2616005)(83380400001)(86362001)(36756003)(38100700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: AdxUxb/TF+gLMjBj2CjlJUoMEWlTASwgQJ9icGZnlOQHEwiGDEs136+dh1cHeZbHYc3fV6bzWoLhVoIKUtsRXp5GSB2ZSD8INjyqbjFF4eLVgmsWUrC+05RV2YAI4KBaoGhMgBnX/nOR05ctW+2iRcj/k/cilDVJIbwnfiS5UV59oibGZMeHJI5MW3MwZFMxmK22IAPZmCJ4H0ap2pgXDAmIMSsb3r2iNJmBktIc9veH5pq6VIk/HhwBn8uhUht9VXv+Ns88Y4ngRnHsanRiBZFoUDqhkclbMSfypEdHpDMXA83uaBrbYeUfRr33mYyt35DPO2U2mCxMSlq9kJJBsWBU7ta35fh8+UePTvsH4bF0Qhppbyzqu27OV1s/6vIYom7w300+Nn5JJvTgGueAs1yVSw+0P/LP6+kVcM9uvPG65QC1GpFvuFkTJ0bGzofdE6iTkdVrPxP3QStXixewov9Fw/SAxZP3p35lKNatCN3GRJIL91ZT9VVzw5PlJzP5Z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t7LWf4f+P7Dfg== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: EtAWkKwGnwgzPbalKoMFQRu6BdKTSLck0bRbCyJqgzjzIWS/2AcND7VbvYFontjlNDF67LW1ztO9Ue+AL618me2XR2CBN3FxNUqZQADMsVtc/6Su1SJz8UqqSJ+rFXPioETZcH/D15FFQ0YoGavp+0IGjtljntGq05tpU/qTISv8NdEWOIu7MHIyfA/He949OJEy3JsBYUO4f2Rx4Y/cvJVvhXacLUBqh/EjbqupTlKbcm1Ba0KgpmzWlzt1y9JgT0E6q6eFe+57CIPCuomnXyxbOAexbldYIjNCUVQfjUzdCcDKCyz34I7P+RYOzLbC9Y28iNty26zWF7lOtugl7yKu2TxbU6xrCzqdfxsP51pTivC59lWP82RGt0r/O/Azdrso/EleqgW+57eIPrPJeaIBH3SdOXID6VFGzabAIzIADfDoF2wXhvHcT9JYxS7j48UZMiezPDUJaT/sVkWv9YGYA1kWvZSu5cfsewtM5S7gGbWpAwiyAIUhbr4WXBuIYHJ5mDZYVoZNB6aXUWnGtAZhjSirQ4632YPa9qun2CEhp+0ejtjOQw1aglCuvb6woAQuJn6uq5m+qC/WURFzdmpw2qIzh7dkVy0X0StXQYC+70wq+YREDGkcTfUJtaZYZ6Sj32vdSZYz/8QYwI6yTX49Vld+XTgLScvO2/tta3siHSKHILj0vAHsKDfFePD6ipvU3lRpYE4K7/hjoG5UzVvH83TXKYonsq3NnuOlT1QZBc3+xfyZ0Rfrp+N0IgQ3ezj60VgaROvsZJePk4SdGeCJagnZyOBTX1SBR9JtxUaQ2CA+OHpYVMl5xjG14Q5nHMsNr5C1GYmSs5mh4kuNXHeBcQkZGjQgtrVr1rKS2eZ61bBTRmXZ8CAZuCH9jiaqqUimT7zfMXHN6ujUUcn+qw== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6b86e0c4-8a91-4240-37bd-08db4d9068fe X-MS-Exchange-CrossTenant-AuthSource: SN6PR10MB3022.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 May 2023 17:44:43.6360 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: wHphY56w4ebcZ7oBKb9DqkhNHBw6gcT/of39C0HCj7dpTEkoH5BznPoDhdS65sVNFnwLWeb8EuIMoIpQm5ujuA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR10MB6895 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-05-05_24,2023-05-05_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 bulkscore=0 spamscore=0 mlxlogscore=999 mlxscore=0 adultscore=0 phishscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303200000 definitions=main-2305050146 X-Proofpoint-GUID: 9HqCwzYjEgnuCZJY1gbFlvgOMzNsLOzZ X-Proofpoint-ORIG-GUID: 9HqCwzYjEgnuCZJY1gbFlvgOMzNsLOzZ X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Empty area will return -EINVAL if the search window is smaller than the requested size. Fix the test case to check for this error code. Signed-off-by: Liam R. Howlett --- lib/test_maple_tree.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/test_maple_tree.c b/lib/test_maple_tree.c index fbf7b6f227f34..48bc4ad984c86 100644 --- a/lib/test_maple_tree.c +++ b/lib/test_maple_tree.c @@ -2696,7 +2696,7 @@ static noinline void __init check_empty_area_window(struct maple_tree *mt) MT_BUG_ON(mt, mas_empty_area(&mas, 5, 100, 6) != -EBUSY); mas_reset(&mas); - MT_BUG_ON(mt, mas_empty_area(&mas, 0, 8, 10) != -EBUSY); + MT_BUG_ON(mt, mas_empty_area(&mas, 0, 8, 10) != -EINVAL); mas_reset(&mas); mas_empty_area(&mas, 100, 165, 3); From patchwork Fri May 5 17:41:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Liam R. Howlett" X-Patchwork-Id: 13232907 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7338AC77B7C for ; Fri, 5 May 2023 17:44:50 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id F1E776B0078; Fri, 5 May 2023 13:44:49 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id ED17B6B0092; Fri, 5 May 2023 13:44:49 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D20B26B00A0; Fri, 5 May 2023 13:44:49 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by kanga.kvack.org (Postfix) with ESMTP id B24866B0078 for ; Fri, 5 May 2023 13:44:49 -0400 (EDT) Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 345HhJ54028052; Fri, 5 May 2023 17:44:49 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=+txu4aLGOrwMbxOMzM/5NFwUsTgankdKbz+bA1PibVU=; b=V8ZsqSE/xeFjFdKINWlWAgZhAQpS2i2R7NlUIH4ZKTJCtJCL0H4u3UBnhghbRwo87fZp WhAES5jev7Bc5j4Z2UBrxcpL0PsL13ODu4vlrGPkg2zWgZvnFpJ5dPJcHHfX/RaZJcR2 Y62Y9zj8b28NWNBW6oUuU46VS02wgDUbc4QXCYy8olGPTp7IlQVxzEKT7nmcRRRAEcaJ hkfktcfn500JlQDQgXnQ3LuhB3wBHOl66+teas5FHvHf3areEtFZ1J2BtGEKWOkXg4CC /ir+qciX9oou2W/TdBqRmqre+ywDpZJthqGzNVFpLBlE/A6+MSyZ8VDgyD92wd0aF7eu yg== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3q8t145jdm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 05 May 2023 17:44:49 +0000 Received: from pps.filterd (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 345HHB3k010067; Fri, 5 May 2023 17:44:48 GMT Received: from nam11-dm6-obe.outbound.protection.outlook.com (mail-dm6nam11lp2170.outbound.protection.outlook.com [104.47.57.170]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3q8spankgq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 05 May 2023 17:44:48 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=E+ubKNX57T+5BCzxeTvi7VgOHF+hx6HGerxOgOBGQ1H+AmMoa4Xw4IhR/Kbx/P966w9o5Xack2cfbeDbSGnNv+RRiS9Mr25DvrpLTRO0CY5L+sxM0A8qqq9vQo9DGhvc1K1Jw45LFSJY7ssaY53ZLj6oVscJ0L6WyVD9xkfa4Z+tOP87JavIfYFcLkg834fst3Pyd0eLTC6ge7vXtOFunbPsFPaNdlwisRn1Gx5fG1ot8NDDgh5uCfpNkdnd7EXKNylpCevyMNR7Q0/Mf5Oq233VLd+U92k6MMPD8Cf6QBpQv4OMvzZO27GjVVQL3aR69k0V23eJy6Kjmqe3piqhHw== 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=+txu4aLGOrwMbxOMzM/5NFwUsTgankdKbz+bA1PibVU=; b=JB3oymGN1N+zobcYIxklVPingSM+4maGImCVAoSAP3q0B7XGfSBTqKpMvOl1sJVSRHqfKT7SyMOpZp+vU+HzR3j+id+oQR2GqUOzD951miSAfbND0wGW0NENE+PYvjSPhm2c649gk7tBuCR5h98adFKJiCyIFzR7xycBpolMvWTkc6befm72rgRg+rwfvsPzgPYmW7ERR6EVeCVgQP+3XEG/LwXAu/lNq65zisp27i3mnZtBLxcN172KL8tjgo5Wo6HBLCQ03bfOHpwsvJUjmcDnYoF4MBT26pqU8va2f7WGJ83KWclH5Vp9ICbaL1A8ctUBUazJzQRsr1drTMuwpg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=+txu4aLGOrwMbxOMzM/5NFwUsTgankdKbz+bA1PibVU=; b=t7Aeeo54fCw58VnVfD3pRX4wPG4LE1BRhni0CCD8ezRnUmB1YVCkyrPejbjSOZ1xWpsLbt+gP6t+4oM3iuWghGibZGfg6kRf++uHnrbcV8s7rUMYDherRzOi+9/j5N7Xpv+XSFNJRma1oxGKcCboM19O0HoYpew/ym8WgXF+r1A= Received: from SN6PR10MB3022.namprd10.prod.outlook.com (2603:10b6:805:d8::25) by DS0PR10MB6895.namprd10.prod.outlook.com (2603:10b6:8:134::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6363.27; Fri, 5 May 2023 17:44:46 +0000 Received: from SN6PR10MB3022.namprd10.prod.outlook.com ([fe80::8bb9:2bb7:3930:b5da]) by SN6PR10MB3022.namprd10.prod.outlook.com ([fe80::8bb9:2bb7:3930:b5da%7]) with mapi id 15.20.6363.022; Fri, 5 May 2023 17:44:45 +0000 From: "Liam R. Howlett" To: Andrew Morton Cc: maple-tree@lists.infradead.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, "Liam R. Howlett" Subject: [PATCH v2 27/36] maple_tree: Introduce mas_next_slot() interface Date: Fri, 5 May 2023 13:41:55 -0400 Message-Id: <20230505174204.2665599-28-Liam.Howlett@oracle.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230505174204.2665599-1-Liam.Howlett@oracle.com> References: <20230505174204.2665599-1-Liam.Howlett@oracle.com> X-ClientProxiedBy: YT1P288CA0015.CANP288.PROD.OUTLOOK.COM (2603:10b6:b01::28) To SN6PR10MB3022.namprd10.prod.outlook.com (2603:10b6:805:d8::25) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN6PR10MB3022:EE_|DS0PR10MB6895:EE_ X-MS-Office365-Filtering-Correlation-Id: 6d9f9224-8c17-4abe-2239-08db4d906a53 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: MLZ/9o76tPqKRvQWfy5JcPzI+QEV3ov6VPyNvLsl6+xpIJ0LfBn+pNEWDMquRvm2fp0BDguUSswgFO1Mqr92IFo2+RIUxJHNKXKB3emu/SFXmyRX9F6zKRsacMN0W5vuQ/0YmOBb2j6mhcABEKuab6tN4hnIcKVlE/X9CGNoDL6GcbSEJ6OFOZ+oVbDZdncCR7stSqmPD66mCPz8un6qULNnqnUAArHzmIV/cky/J1mEvnZIR9/API73zrZDuG1f7tF3gj6O2ipDTYJgpcD6bcp5RQ3n+QlvbGc539Yr7ysovxRjAaDRujiZ0Nbb+ErlJjrMqYlUqPx4QEyfJtV8omccx4hKlMfLUKi8sW/9bV6ZUgWTdnO391iNjlwUk0MOozzf04yAOWr4DnpchIvmmEKj9LXs1di+ks979FaCxUaLz0+yPNoLMMEElKryC5eBBJdHzzu0ea0NHMpTxQ9ZdfBxgqCglJnBH3ZwXqDt5ydWCyVfvkIwUp3uQjQmokft6KFZ9KOsaq3Ss7UQxMcJhrFPdXA1zEFbb7WDRbLwpQ+mbveQkrb6WepsB+IQf2S7 X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SN6PR10MB3022.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(136003)(376002)(346002)(396003)(39860400002)(366004)(451199021)(4326008)(6916009)(66946007)(66476007)(66556008)(41300700001)(8936002)(5660300002)(8676002)(6512007)(26005)(6506007)(1076003)(316002)(478600001)(6666004)(6486002)(107886003)(2906002)(186003)(2616005)(83380400001)(86362001)(36756003)(38100700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: GfuzXrrycQ5Nj279/3efyJr2J0JUtW/HH1DSZsK2K5s2fqPfhCOA4cyaEpC1vkLOKtGNu7iFMVxzuX8SrGW5E2Jt+2C6k6vhOwUJ5WPxjLl+r4p/omLFGxCebbiaTvY891g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juE1obpMLfsfmatKQwXZHOnNyyI5O+5BapmKq7umlQh1aKpsZN87tDtarYo+hNrGeOovltupmae/20/hnZ3rYjuGMG611xN31pTj3sAZnkihybKS3yqQs76iie4CBF7y/jXkhXkZHCReRqqDu6BprtftBxRv2HmBTXIFvSdEXaj9J7fsbVCOZUjWj74FW4gCKVxTOlgcTllwaxegW2FkNESi3D1vT3DzZqwOWxWe6DWBw8yblGSuZ++q1skWbPSPgxh+AR4mAZWWBFsrsl8/D2xVVGnat7xH1ypElpqijU3+7q1bGwgz45h9PVSmJao4xQ/w6v5a+Hw== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6d9f9224-8c17-4abe-2239-08db4d906a53 X-MS-Exchange-CrossTenant-AuthSource: SN6PR10MB3022.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 May 2023 17:44:45.8645 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: rMj97Mk6gPbZIcOl1Vmg9f+KX2OALH9hce/9j881fh+aVG8/y6wPVNUwZvLE1mIroZHLbijz5WFhrYUDrurlGQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR10MB6895 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-05-05_24,2023-05-05_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 phishscore=0 spamscore=0 mlxlogscore=999 bulkscore=0 suspectscore=0 mlxscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303200000 definitions=main-2305050146 X-Proofpoint-GUID: blwy_-bJFhjaxedRoFC554zuFZlAzhPQ X-Proofpoint-ORIG-GUID: blwy_-bJFhjaxedRoFC554zuFZlAzhPQ X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Sometimes, during a tree walk, the user needs the next slot regardless of if it is empty or not. Add an interface to get the next slot. Since there are no consecutive NULLs allowed in the tree, the mas_next() function can only advance two slots at most. So use the new mas_next_slot() interface to align both implementations. Use this method for mas_find() as well. Signed-off-by: Liam R. Howlett --- lib/maple_tree.c | 229 +++++++++++++++++++++-------------------------- 1 file changed, 104 insertions(+), 125 deletions(-) diff --git a/lib/maple_tree.c b/lib/maple_tree.c index 580310741d892..2865a987bc559 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -4606,11 +4606,10 @@ static inline int mas_prev_node(struct ma_state *mas, unsigned long min) static inline int mas_next_node(struct ma_state *mas, struct maple_node *node, unsigned long max) { - unsigned long min, pivot; + unsigned long min; unsigned long *pivots; struct maple_enode *enode; int level = 0; - unsigned char offset; unsigned char node_end; enum maple_type mt; void __rcu **slots; @@ -4618,19 +4617,16 @@ static inline int mas_next_node(struct ma_state *mas, struct maple_node *node, if (mas->max >= max) goto no_entry; + min = mas->max + 1; level = 0; do { if (ma_is_root(node)) goto no_entry; - min = mas->max + 1; - if (min > max) - goto no_entry; - + /* Walk up. */ if (unlikely(mas_ascend(mas))) return 1; - offset = mas->offset; level++; node = mas_mn(mas); mt = mte_node_type(mas->node); @@ -4639,36 +4635,37 @@ static inline int mas_next_node(struct ma_state *mas, struct maple_node *node, if (unlikely(ma_dead_node(node))) return 1; - } while (unlikely(offset == node_end)); + } while (unlikely(mas->offset == node_end)); slots = ma_slots(node, mt); - pivot = mas_safe_pivot(mas, pivots, ++offset, mt); - while (unlikely(level > 1)) { - /* Descend, if necessary */ - enode = mas_slot(mas, slots, offset); - if (unlikely(ma_dead_node(node))) - return 1; + mas->offset++; + enode = mas_slot(mas, slots, mas->offset); + if (unlikely(ma_dead_node(node))) + return 1; - mas->node = enode; + if (level > 1) + mas->offset = 0; + + while (unlikely(level > 1)) { level--; + mas->node = enode; node = mas_mn(mas); mt = mte_node_type(mas->node); slots = ma_slots(node, mt); - pivots = ma_pivots(node, mt); + enode = mas_slot(mas, slots, 0); if (unlikely(ma_dead_node(node))) return 1; - - offset = 0; - pivot = pivots[0]; } - enode = mas_slot(mas, slots, offset); + if (!mas->offset) + pivots = ma_pivots(node, mt); + + mas->max = mas_safe_pivot(mas, pivots, mas->offset, mt); if (unlikely(ma_dead_node(node))) return 1; mas->node = enode; mas->min = min; - mas->max = pivot; return 0; no_entry: @@ -4679,83 +4676,106 @@ static inline int mas_next_node(struct ma_state *mas, struct maple_node *node, return 0; } +static inline void mas_rewalk(struct ma_state *mas, unsigned long index) +{ +retry: + mas_set(mas, index); + mas_state_walk(mas); + if (mas_is_start(mas)) + goto retry; +} + +static inline bool mas_rewalk_if_dead(struct ma_state *mas, + struct maple_node *node, const unsigned long index) +{ + if (unlikely(ma_dead_node(node))) { + mas_rewalk(mas, index); + return true; + } + return false; +} + /* - * mas_next_nentry() - Get the next node entry - * @mas: The maple state - * @max: The maximum value to check - * @*range_start: Pointer to store the start of the range. + * mas_next_slot() - Get the entry in the next slot * - * Sets @mas->offset to the offset of the next node entry, @mas->last to the - * pivot of the entry. + * @mas: The maple state + * @max: The maximum starting range + * @empty: Can be empty * - * Return: The next entry, %NULL otherwise + * Return: The entry in the next slot which is possibly NULL */ -static inline void *mas_next_nentry(struct ma_state *mas, - struct maple_node *node, unsigned long max, enum maple_type type) +void *mas_next_slot(struct ma_state *mas, unsigned long max, bool empty) { - unsigned char count; - unsigned long pivot; - unsigned long *pivots; void __rcu **slots; + unsigned long *pivots; + unsigned long pivot; + enum maple_type type; + struct maple_node *node; + unsigned char data_end; + unsigned long save_point = mas->last; void *entry; - if (mas->last == mas->max) { - mas->index = mas->max; - return NULL; - } - - slots = ma_slots(node, type); +retry: + node = mas_mn(mas); + type = mte_node_type(mas->node); pivots = ma_pivots(node, type); - count = ma_data_end(node, type, pivots, mas->max); - if (unlikely(ma_dead_node(node))) - return NULL; - - mas->index = mas_safe_min(mas, pivots, mas->offset); - if (unlikely(ma_dead_node(node))) - return NULL; - - if (mas->index > max) - return NULL; - - if (mas->offset > count) - return NULL; + data_end = ma_data_end(node, type, pivots, mas->max); + if (unlikely(mas_rewalk_if_dead(mas, node, save_point))) + goto retry; - while (mas->offset < count) { - pivot = pivots[mas->offset]; - entry = mas_slot(mas, slots, mas->offset); - if (ma_dead_node(node)) - return NULL; +again: + if (mas->max >= max) { + if (likely(mas->offset < data_end)) + pivot = pivots[mas->offset]; + else + return NULL; /* must be mas->max */ - mas->last = pivot; - if (entry) - return entry; + if (unlikely(mas_rewalk_if_dead(mas, node, save_point))) + goto retry; if (pivot >= max) return NULL; + } - if (pivot >= mas->max) + if (likely(mas->offset < data_end)) { + mas->index = pivots[mas->offset] + 1; + mas->offset++; + if (likely(mas->offset < data_end)) + mas->last = pivots[mas->offset]; + else + mas->last = mas->max; + } else { + if (mas_next_node(mas, node, max)) { + mas_rewalk(mas, save_point); + goto retry; + } + + if (mas_is_none(mas)) return NULL; - mas->index = pivot + 1; - mas->offset++; + mas->offset = 0; + mas->index = mas->min; + node = mas_mn(mas); + type = mte_node_type(mas->node); + pivots = ma_pivots(node, type); + mas->last = pivots[0]; } - pivot = mas_logical_pivot(mas, pivots, mas->offset, type); - entry = mas_slot(mas, slots, mas->offset); - if (ma_dead_node(node)) - return NULL; + slots = ma_slots(node, type); + entry = mt_slot(mas->tree, slots, mas->offset); + if (unlikely(mas_rewalk_if_dead(mas, node, save_point))) + goto retry; - mas->last = pivot; - return entry; -} + if (entry) + return entry; -static inline void mas_rewalk(struct ma_state *mas, unsigned long index) -{ -retry: - mas_set(mas, index); - mas_state_walk(mas); - if (mas_is_start(mas)) - goto retry; + if (!empty) { + if (!mas->offset) + data_end = 2; + goto again; + } + + return entry; } /* @@ -4773,47 +4793,12 @@ static inline void mas_rewalk(struct ma_state *mas, unsigned long index) static inline void *mas_next_entry(struct ma_state *mas, unsigned long limit) { void *entry = NULL; - struct maple_node *node; - unsigned long last; - enum maple_type mt; if (mas->last >= limit) return NULL; - last = mas->last; -retry: - node = mas_mn(mas); - mt = mte_node_type(mas->node); - mas->offset++; - if (unlikely(mas->offset >= mt_slots[mt])) { - mas->offset = mt_slots[mt] - 1; - goto next_node; - } - - while (!mas_is_none(mas)) { - entry = mas_next_nentry(mas, node, limit, mt); - if (unlikely(ma_dead_node(node))) { - mas_rewalk(mas, last); - goto retry; - } - - if (likely(entry)) - return entry; - - if (unlikely((mas->last >= limit))) - return NULL; - -next_node: - if (unlikely(mas_next_node(mas, node, limit))) { - mas_rewalk(mas, last); - goto retry; - } - mas->offset = 0; - node = mas_mn(mas); - mt = mte_node_type(mas->node); - } - - return NULL; + entry = mas_next_slot(mas, limit, false); + return entry; } /* @@ -4844,10 +4829,8 @@ static inline void *mas_prev_nentry(struct ma_state *mas, unsigned long limit, slots = ma_slots(mn, mt); pivots = ma_pivots(mn, mt); count = ma_data_end(mn, mt, pivots, mas->max); - if (unlikely(ma_dead_node(mn))) { - mas_rewalk(mas, index); + if (unlikely(mas_rewalk_if_dead(mas, mn, index))) goto retry; - } offset = mas->offset - 1; if (offset >= mt_slots[mt]) @@ -4860,10 +4843,8 @@ static inline void *mas_prev_nentry(struct ma_state *mas, unsigned long limit, pivot = pivots[offset]; } - if (unlikely(ma_dead_node(mn))) { - mas_rewalk(mas, index); + if (unlikely(mas_rewalk_if_dead(mas, mn, index))) goto retry; - } while (offset && !mas_slot(mas, slots, offset)) { pivot = pivots[--offset]; @@ -4880,10 +4861,8 @@ static inline void *mas_prev_nentry(struct ma_state *mas, unsigned long limit, min = mas_safe_min(mas, pivots, offset); entry = mas_slot(mas, slots, offset); - if (unlikely(ma_dead_node(mn))) { - mas_rewalk(mas, index); + if (unlikely(mas_rewalk_if_dead(mas, mn, index))) goto retry; - } mas->offset = offset; mas->last = pivot; @@ -6108,8 +6087,8 @@ void *mas_find(struct ma_state *mas, unsigned long max) if (mas->index == max) return NULL; - /* Retries on dead nodes handled by mas_next_entry */ - return mas_next_entry(mas, max); + /* Retries on dead nodes handled by mas_next_slot */ + return mas_next_slot(mas, max, false); ptr_out_of_range: mas->node = MAS_NONE; From patchwork Fri May 5 17:41:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Liam R. Howlett" X-Patchwork-Id: 13232909 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7BDFBC77B7C for ; Fri, 5 May 2023 17:44:54 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 13CDE6B0081; Fri, 5 May 2023 13:44:54 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 0EBB36B009E; Fri, 5 May 2023 13:44:54 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E58DD6B00A1; Fri, 5 May 2023 13:44:53 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by kanga.kvack.org (Postfix) with ESMTP id C4B576B0081 for ; Fri, 5 May 2023 13:44:53 -0400 (EDT) Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 345HhJ55028052; Fri, 5 May 2023 17:44:53 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=CSPTd7X/nJiZQ3dnRaeG803+526/vbVCDuYpiQ7PWtM=; b=Sj3LL3XMXkylM5mJhnd4A+wEPRdyTSMIAUqNZajsf31/XJuKRv8lVaUrfLmleqxOK27O 8yt7VHQGwSt8o8yxCe7a5yKLgpx9quiTWapBH0OIy4jRlBM2kkAzsY6x3Icew4bkthvA wrjo3OOSv66j5YauCWad4XZShZ9PNb3q4pZCBoMIHLLm63l1r+Ij4/bP334H0kSHIC7F 7pNucx2u6HtnkAMeNPeodsCPFCqNYdxxtQOSAW8AlCxRz3FhJoo8MLKDkcM3CFhE/PUQ gkjJRwC4bzq/sOie6QeYtGhNjYyR39Y5FB/K8CQGJUBTVEN5ybskt7jQsHTdNkiE+zLi sQ== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3q8t145jdu-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 05 May 2023 17:44:53 +0000 Received: from pps.filterd (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 345HA61i009869; Fri, 5 May 2023 17:44:52 GMT Received: from nam11-dm6-obe.outbound.protection.outlook.com (mail-dm6nam11lp2176.outbound.protection.outlook.com [104.47.57.176]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3q8spankhx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 05 May 2023 17:44:52 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GiZFI2f5hXOVT4TJTMqn6Bjfyyj84VmwqmgCYj50oxDkLjo6Y5i2xbAgXkuGo6R54j+x99KoJxvWlOH8kGUNr7N/LvTxLgQ+GLYywPFAJAx9R2lmwc/DwkG7XgqgTInWH2Qd8txUIvOmZTGYRzruKJVKHsPsqwYg3QCsYNa81hffbVxK2Hpw5hqQe4VjrGuwtAcqhr+PIbiQA5ug/NTGEb8Udl12pE6PNkxypDfhRdmVQufO0lGdVPm1jZCZRpVnZHEAhhzL950lq6o0BZd/g9m/PcdFvN5E4kNe+tgiBP/uHW3fYiMv4jkQ30I5XHGi8SYMr1xXCa3+pzscrvVMLw== 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=CSPTd7X/nJiZQ3dnRaeG803+526/vbVCDuYpiQ7PWtM=; b=fBp+xM5uaqfOPhTpgA1ABolQt+R/hwXhqSju9w9wGSrs8z4OhVA8OaDwYP5tpLJqQco5IBfGfGM39lxCTLht+OMbn7795osm9hKlvoUUAUAjEr/YxChlbeYbQkS75gboj4yIqWlK4vVbBuvlwOmoGCjytbj7mVZCuz0Kn80zcIi2tuiZIU3UnKKT43Ab7BTKgzOoF8Eq61wzI+VyrIztFAHySKwDcoEamMvZv7/8Xlgaf2BHUc0/a2RsAt6/WFbGrRbBKs60JCiv8BmhUawB8yrPnTdzs8Y4m9hW4c8qGM3tJUfQSLdXEpxZz7zI+9dLTYQO2z+tpANR5UOgYvoj5w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=CSPTd7X/nJiZQ3dnRaeG803+526/vbVCDuYpiQ7PWtM=; b=qfQ3Wo1MniS1VmgTxzTKp4JyUggzPAfujLh80yS02WzsBcuEgQGDy7SNN7DylTPlz5CThRuPHi4QmDhhi6BjpmWW93nnxjM0vnPcCCGTdPmWCVsowseKKbVsBWngfRKhCvmlVJbfHO/4RvpLfqTnyqkCBPKXVb/juV3MSDvLAdo= Received: from SN6PR10MB3022.namprd10.prod.outlook.com (2603:10b6:805:d8::25) by DS0PR10MB6895.namprd10.prod.outlook.com (2603:10b6:8:134::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6363.27; Fri, 5 May 2023 17:44:48 +0000 Received: from SN6PR10MB3022.namprd10.prod.outlook.com ([fe80::8bb9:2bb7:3930:b5da]) by SN6PR10MB3022.namprd10.prod.outlook.com ([fe80::8bb9:2bb7:3930:b5da%7]) with mapi id 15.20.6363.022; Fri, 5 May 2023 17:44:48 +0000 From: "Liam R. Howlett" To: Andrew Morton Cc: maple-tree@lists.infradead.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, "Liam R. Howlett" Subject: [PATCH v2 28/36] maple_tree: Add mas_next_range() and mas_find_range() interfaces Date: Fri, 5 May 2023 13:41:56 -0400 Message-Id: <20230505174204.2665599-29-Liam.Howlett@oracle.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230505174204.2665599-1-Liam.Howlett@oracle.com> References: <20230505174204.2665599-1-Liam.Howlett@oracle.com> X-ClientProxiedBy: YT1P288CA0027.CANP288.PROD.OUTLOOK.COM (2603:10b6:b01::40) To SN6PR10MB3022.namprd10.prod.outlook.com (2603:10b6:805:d8::25) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN6PR10MB3022:EE_|DS0PR10MB6895:EE_ X-MS-Office365-Filtering-Correlation-Id: f4ba792a-2f74-4c53-6efd-08db4d906baa X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 1ok319SvQoG1NLeUZ5Riod9yQZNGML6aNacDPbZBvgqDSUGy8vtSCakg8NAzQFnoCQGHuB+gMY39V9e0xpw+KSfIMRUtdmkVGuvr01F9f4p8ME5TrcW6SQmt0Xs7UptmSIoMoGLxjfJhw+Lob9mxVvtSbkeBPSnNfOImyHEJ/9tdozeoXamrZJDmhmuZ1lWd4U+Wcp5alEYDsiq3HtA5iE7tkuzEp7xoBdspDlCCsN9WLrz1NqGwAcE7Sz6uspuzUN/F7038G+vade1zqY14bTa6oRr/0LPws8Phv1MH4pXwivTTD4xe+ze35WETSKht4im/E1XCU8fz3k1ZnhRQF9sSG5ly6A4H7kCVgrCSUsBWMQme743jDpLml25bkSCb+PI/EvUHVMqiSHfbPNH8j/II3vYcPYBsDBobIZwMYb3wh2IQpaqIbm1BqtcPlff8SAl9/sUfad6MoBcaJwOOBIeK1tX2oxbzrI8uT6ZS2mJ1BLVJYTCqUzRpVIwTR9PoEY6FB8eTAFNfgAbOquYA4UJ53kgMPYkmJ6QkgamOhOu+EdunWMCpTUkYjKETdAdl X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SN6PR10MB3022.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(136003)(376002)(346002)(396003)(39860400002)(366004)(451199021)(4326008)(6916009)(66946007)(66476007)(66556008)(41300700001)(8936002)(5660300002)(8676002)(6512007)(26005)(6506007)(1076003)(316002)(478600001)(6666004)(6486002)(107886003)(2906002)(186003)(2616005)(83380400001)(86362001)(36756003)(38100700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Hm/n7/0xfKUOVKISchxXPXOOViByqAT6ez8tzBuZeu16ejTNndA7WhrcnnleR7ODK8tBgdHC0Q9QmsCUzVh906ApqliotgNWzEgF9sNfO52Bf6m3b+zrNX0ks+FuE7z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DDu9Iwh+OzJtgBqmndwl51B61AgU5Yc9kUnHuYJUALYMSKUG/eKChx/8NjUiXMJSOsExf5IlpkBXFLFeUfwtwB0Iayvf2YJj99/XQEpViKj9EktLBkqmuFZTCBOqhSWtdPfKPXkvozrnoCqoKMa+IiB2+gxivE/0nQWBZm/RMMidX3nF2e2prtFF1Kg7IJcQBrKfWKstpeG/3+9LU6fTgqWVI4E8+/xn0s23meHtjzw7meKpULsRv0wBuHXY+2XT6ftLEgie3I82KUUcJdaGHIzmbVLwNm5vfkr9QweBppnbfCvSm3FHU0E4dReBRXzPpg== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: f4ba792a-2f74-4c53-6efd-08db4d906baa X-MS-Exchange-CrossTenant-AuthSource: SN6PR10MB3022.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 May 2023 17:44:48.1440 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: AzYTSYqBQk771kvzIfb/8WjH/syomPYxziXySBY+2FW5pYVJ/49xp+uiZ+nIeGTJ2IITL7wqV/eMt4SWLUKpow== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR10MB6895 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-05-05_24,2023-05-05_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 phishscore=0 spamscore=0 mlxlogscore=999 bulkscore=0 suspectscore=0 mlxscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303200000 definitions=main-2305050146 X-Proofpoint-GUID: VxQ-Edq0BiYnWQuazuNsXOiGvsOrvBy_ X-Proofpoint-ORIG-GUID: VxQ-Edq0BiYnWQuazuNsXOiGvsOrvBy_ X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Some users of the maple tree may want to move to the next range in the tree, even if it stores a NULL. This family of function provides that functionality by advancing one slot at a time and returning the result, while mas_contiguous() will iterate over the range and stop on encountering the first NULL. Signed-off-by: Liam R. Howlett --- include/linux/maple_tree.h | 15 ++++ lib/maple_tree.c | 171 ++++++++++++++++++++++++++----------- 2 files changed, 135 insertions(+), 51 deletions(-) diff --git a/include/linux/maple_tree.h b/include/linux/maple_tree.h index ed92abf4c1fb5..a4cd8f891a090 100644 --- a/include/linux/maple_tree.h +++ b/include/linux/maple_tree.h @@ -455,6 +455,7 @@ void *mas_erase(struct ma_state *mas); int mas_store_gfp(struct ma_state *mas, void *entry, gfp_t gfp); void mas_store_prealloc(struct ma_state *mas, void *entry); void *mas_find(struct ma_state *mas, unsigned long max); +void *mas_find_range(struct ma_state *mas, unsigned long max); void *mas_find_rev(struct ma_state *mas, unsigned long min); int mas_preallocate(struct ma_state *mas, gfp_t gfp); bool mas_is_err(struct ma_state *mas); @@ -467,6 +468,7 @@ int mas_expected_entries(struct ma_state *mas, unsigned long nr_entries); void *mas_prev(struct ma_state *mas, unsigned long min); void *mas_next(struct ma_state *mas, unsigned long max); +void *mas_next_range(struct ma_state *mas, unsigned long max); int mas_empty_area(struct ma_state *mas, unsigned long min, unsigned long max, unsigned long size); @@ -528,6 +530,19 @@ static inline void mas_reset(struct ma_state *mas) #define mas_for_each(__mas, __entry, __max) \ while (((__entry) = mas_find((__mas), (__max))) != NULL) +/** + * mas_contiguous() - Iterate over a contiguous range of the maple tree. + * @__mas: Maple Tree operation state (maple_state) + * @__entry: Entry retrieved from the tree + * @__max: maximum index to retrieve from the tree + * + * When returned, mas->index and mas->last will hold the entire range of the + * entry. The loop will terminate on the first NULL encountered. + * + * Note: may return the zero entry. + */ +#define mas_contiguous(__mas, __entry, __max) \ + while (((__entry) = mas_find_range((__mas), (__max))) != NULL) /** * mas_set_range() - Set up Maple Tree operation state for a different index. diff --git a/lib/maple_tree.c b/lib/maple_tree.c index 2865a987bc559..2f43afeae94e4 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -4792,13 +4792,10 @@ void *mas_next_slot(struct ma_state *mas, unsigned long max, bool empty) */ static inline void *mas_next_entry(struct ma_state *mas, unsigned long limit) { - void *entry = NULL; - if (mas->last >= limit) return NULL; - entry = mas_next_slot(mas, limit, false); - return entry; + return mas_next_slot(mas, limit, false); } /* @@ -5885,18 +5882,8 @@ int mas_expected_entries(struct ma_state *mas, unsigned long nr_entries) } EXPORT_SYMBOL_GPL(mas_expected_entries); -/** - * mas_next() - Get the next entry. - * @mas: The maple state - * @max: The maximum index to check. - * - * Returns the next entry after @mas->index. - * Must hold rcu_read_lock or the write lock. - * Can return the zero entry. - * - * Return: The next entry or %NULL - */ -void *mas_next(struct ma_state *mas, unsigned long max) +static inline bool mas_next_setup(struct ma_state *mas, unsigned long max, + void **entry) { bool was_none = mas_is_none(mas); @@ -5904,24 +5891,71 @@ void *mas_next(struct ma_state *mas, unsigned long max) mas->node = MAS_START; if (mas_is_start(mas)) - mas_walk(mas); /* Retries on dead nodes handled by mas_walk */ + *entry = mas_walk(mas); /* Retries on dead nodes handled by mas_walk */ if (mas_is_ptr(mas)) { + *entry = NULL; if (was_none && mas->index == 0) { mas->index = mas->last = 0; - return mas_root(mas); + return true; } mas->index = 1; mas->last = ULONG_MAX; mas->node = MAS_NONE; - return NULL; + return true; } - /* Retries on dead nodes handled by mas_next_entry */ - return mas_next_entry(mas, max); + if (mas_is_none(mas)) + return true; + return false; +} + +/** + * mas_next() - Get the next entry. + * @mas: The maple state + * @max: The maximum index to check. + * + * Returns the next entry after @mas->index. + * Must hold rcu_read_lock or the write lock. + * Can return the zero entry. + * + * Return: The next entry or %NULL + */ +void *mas_next(struct ma_state *mas, unsigned long max) +{ + void *entry = NULL; + + if (mas_next_setup(mas, max, &entry)) + return entry; + + /* Retries on dead nodes handled by mas_next_slot */ + return mas_next_slot(mas, max, false); } EXPORT_SYMBOL_GPL(mas_next); +/** + * mas_next_range() - Advance the maple state to the next range + * @mas: The maple state + * @max: The maximum index to check. + * + * Sets @mas->index and @mas->last to the range. + * Must hold rcu_read_lock or the write lock. + * Can return the zero entry. + * + * Return: The next entry or %NULL + */ +void *mas_next_range(struct ma_state *mas, unsigned long max) +{ + void *entry = NULL; + + if (mas_next_setup(mas, max, &entry)) + return entry; + + /* Retries on dead nodes handled by mas_next_slot */ + return mas_next_slot(mas, max, true); +} +EXPORT_SYMBOL_GPL(mas_next_range); + /** * mt_next() - get the next value in the maple tree * @mt: The maple tree @@ -6031,49 +6065,38 @@ void mas_pause(struct ma_state *mas) EXPORT_SYMBOL_GPL(mas_pause); /** - * mas_find() - On the first call, find the entry at or after mas->index up to - * %max. Otherwise, find the entry after mas->index. - * @mas: The maple state - * @max: The maximum value to check. - * - * Must hold rcu_read_lock or the write lock. - * If an entry exists, last and index are updated accordingly. - * May set @mas->node to MAS_NONE. + * mas_find_setup() - Internal function to set up mas_find*(). * - * Return: The entry or %NULL. + * Returns: True if entry is the answer, false otherwise. */ -void *mas_find(struct ma_state *mas, unsigned long max) +static inline bool mas_find_setup(struct ma_state *mas, unsigned long max, + void **entry) { + *entry = NULL; + if (unlikely(mas_is_none(mas))) { if (unlikely(mas->last >= max)) - return NULL; + return true; mas->index = mas->last; mas->node = MAS_START; - } - - if (unlikely(mas_is_paused(mas))) { + } else if (unlikely(mas_is_paused(mas))) { if (unlikely(mas->last >= max)) - return NULL; + return true; mas->node = MAS_START; mas->index = ++mas->last; - } - - - if (unlikely(mas_is_ptr(mas))) + } else if (unlikely(mas_is_ptr(mas))) goto ptr_out_of_range; if (unlikely(mas_is_start(mas))) { /* First run or continue */ - void *entry; - if (mas->index > max) - return NULL; + return true; - entry = mas_walk(mas); - if (entry) - return entry; + *entry = mas_walk(mas); + if (*entry) + return true; } @@ -6081,23 +6104,69 @@ void *mas_find(struct ma_state *mas, unsigned long max) if (unlikely(mas_is_ptr(mas))) goto ptr_out_of_range; - return NULL; + return true; } if (mas->index == max) - return NULL; + return true; - /* Retries on dead nodes handled by mas_next_slot */ - return mas_next_slot(mas, max, false); + return false; ptr_out_of_range: mas->node = MAS_NONE; mas->index = 1; mas->last = ULONG_MAX; - return NULL; + return true; +} + +/** + * mas_find() - On the first call, find the entry at or after mas->index up to + * %max. Otherwise, find the entry after mas->index. + * @mas: The maple state + * @max: The maximum value to check. + * + * Must hold rcu_read_lock or the write lock. + * If an entry exists, last and index are updated accordingly. + * May set @mas->node to MAS_NONE. + * + * Return: The entry or %NULL. + */ +void *mas_find(struct ma_state *mas, unsigned long max) +{ + void *entry = NULL; + + if (mas_find_setup(mas, max, &entry)) + return entry; + + /* Retries on dead nodes handled by mas_next_slot */ + return mas_next_slot(mas, max, false); } EXPORT_SYMBOL_GPL(mas_find); +/** + * mas_find_range() - On the first call, find the entry at or after + * mas->index up to %max. Otherwise, advance to the next slot mas->index. + * @mas: The maple state + * @max: The maximum value to check. + * + * Must hold rcu_read_lock or the write lock. + * If an entry exists, last and index are updated accordingly. + * May set @mas->node to MAS_NONE. + * + * Return: The entry or %NULL. + */ +void *mas_find_range(struct ma_state *mas, unsigned long max) +{ + void *entry; + + if (mas_find_setup(mas, max, &entry)) + return entry; + + /* Retries on dead nodes handled by mas_next_slot */ + return mas_next_slot(mas, max, true); +} +EXPORT_SYMBOL_GPL(mas_find_range); + /** * mas_find_rev: On the first call, find the first non-null entry at or below * mas->index down to %min. Otherwise find the first non-null entry below From patchwork Fri May 5 17:41:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Liam R. Howlett" X-Patchwork-Id: 13232910 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7ABFEC77B7F for ; Fri, 5 May 2023 17:44:56 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B4E1F6B009E; Fri, 5 May 2023 13:44:54 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id AD7C86B00A1; Fri, 5 May 2023 13:44:54 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9284B6B00A2; Fri, 5 May 2023 13:44:54 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by kanga.kvack.org (Postfix) with ESMTP id 6E0836B009E for ; Fri, 5 May 2023 13:44:54 -0400 (EDT) Received: from pps.filterd (m0333520.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 345HhNkf031597; Fri, 5 May 2023 17:44:54 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=PTafvL4X6xGu6T0ZfW1qKXJxgqqfRSq/Q/MjkpchD+M=; b=c2cuLEKUg8uBZL6TMj16K3BXpOp5nIMSRU9K8JTDNUbTrBdpttIM5Xe0ooqRkQISwueh SPB9yz1wxWmNB2T/XbAvsUOmdrNTllixAu+E6FEhba/VwcCNmu89ZdwDXoyYAfdvoxvO dylElGrFRHVRk7ZZlaNZHh/J1gIPT9vYL6x6xjRXIur4PlNrbg9YopVLgfNiN3VOHfpM lfDE/27n8o+aQrPsrW4rJj45MZfmuoKwZ+GPkwDIfViQ6gW2L+XFpxtzlWqJNBC/jH4P fXwpQ/5WUH+WyQg0X5iJlL7uqxXyuK42CGA/DY5XzkoH1aLDgM0OEawSunUW0DcJqqOh OA== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3q8u9d5nfa-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 05 May 2023 17:44:53 +0000 Received: from pps.filterd (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 345HA61j009869; Fri, 5 May 2023 17:44:52 GMT Received: from nam11-dm6-obe.outbound.protection.outlook.com (mail-dm6nam11lp2176.outbound.protection.outlook.com [104.47.57.176]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3q8spankhx-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 05 May 2023 17:44:52 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Oz5IyQR4o1StFJ4zEhM+bOIiYI5/W4ztW0gBIGPftAdB25bAEVSAG0DvXHZWF/5tivdOp/GnMCWGDrBxKmFxO845znZdIs0Pk8jHlstd9iu8movWVEbyDUktcob+GQeGs5XFimUJtSU4L1zCRQkbQiqcAHmZpckQFb0rGxPIfhEFpqZF+UDsRkgf0lbiTLcBL+klKsfNe8Zybm/GPE/9kUmrMJ+mCmN0LMdEVtN1PnhnlN6XEq8iGc+fFjWGIcOiLY8dOuN0xrI0lGzCxxiT6uztkO1L5XED6Z07WqnSK7CF/ZaaymnieC6MbejqqOtX2YgnH3m5R5oXFD0+Bhoukg== 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=PTafvL4X6xGu6T0ZfW1qKXJxgqqfRSq/Q/MjkpchD+M=; b=UVmn43+XGYcPqFO2Uxab7uXn9+lwcqbkdEQZoPsigH4VSwxsOucqdYQh5Lf6f75TY257zr1hYQ9CNucthblRkVr/ZWov6kKqBOEHRwhZG17iB2kwO4WMR/Upg1GqdW3D/aKi9VzyaBNPZnSWrVNg6gHREdBXJf7rV8Odo3LG9fOIGGOT9eHLzuc1pl0UBC3+zWPbdNlOxsGv4tgwa+GrOOT/twLdSu799z6Z5YDzHB/9wqC9lfIyiY8+inh/slT6sp63/n1EJF7xAucYMCEbJbm1gaED60S5qpJS9vgD7nWYQHh1NvQyS3N2no8Bi2DPOuugN4FDodcRNyVqmn8wzw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=PTafvL4X6xGu6T0ZfW1qKXJxgqqfRSq/Q/MjkpchD+M=; b=aUWMEpRhHPBnm94w3GAu5OoZwHhwzHNr9iAGnuYpUEGzD1fJ9BeioSbWPBWI9YuPZXq149mtueBUjCpjduxn+cB9w46SA0sJtIAMIKhSmEPOWmoffuW2AaeaT/iY/Y+IFZBx0T9Ua0VdNNoGDGijsHnzIGm8FVEF8uYxTySgfRs= Received: from SN6PR10MB3022.namprd10.prod.outlook.com (2603:10b6:805:d8::25) by DS0PR10MB6895.namprd10.prod.outlook.com (2603:10b6:8:134::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6363.27; Fri, 5 May 2023 17:44:50 +0000 Received: from SN6PR10MB3022.namprd10.prod.outlook.com ([fe80::8bb9:2bb7:3930:b5da]) by SN6PR10MB3022.namprd10.prod.outlook.com ([fe80::8bb9:2bb7:3930:b5da%7]) with mapi id 15.20.6363.022; Fri, 5 May 2023 17:44:50 +0000 From: "Liam R. Howlett" To: Andrew Morton Cc: maple-tree@lists.infradead.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, "Liam R. Howlett" Subject: [PATCH v2 29/36] maple_tree: Relocate mas_rewalk() and mas_rewalk_if_dead() Date: Fri, 5 May 2023 13:41:57 -0400 Message-Id: <20230505174204.2665599-30-Liam.Howlett@oracle.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230505174204.2665599-1-Liam.Howlett@oracle.com> References: <20230505174204.2665599-1-Liam.Howlett@oracle.com> X-ClientProxiedBy: YT4PR01CA0464.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:d6::21) To SN6PR10MB3022.namprd10.prod.outlook.com (2603:10b6:805:d8::25) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN6PR10MB3022:EE_|DS0PR10MB6895:EE_ X-MS-Office365-Filtering-Correlation-Id: d16eb292-4577-459b-48eb-08db4d906ccd X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: TpOhe0XANZRDcY8pgNvWkB+Aj+R8IlyQd+tmkDsjdQkrRS+dBeMdgsnV5C/eEvM3x29C5Pg7iSdpcZ4Qv4IMKclwnTwtg/nh0jbTJ4MDUItmfL2PhlDT+8r6VVxV1I6xP29oUa0vzVKB/xrOb12pxf/Kq+1NqPgzewP/vgZl65J4cNw8cpeiE1ZPfNZbNjf6dlaD/8MThbIz+BMJm31K1a7yLJkR1BsvXx7fcmVqe4ZIggQlDVq/Q1Wajj750+7mP7PYlcg68PcwQ5YnJteO2Z7Zd9u4u6nPGvxnTsflliyjAsYhQH0t0/PWfiLmDY29v8YS2ys6rERWeFw2KwH4HVfEwMcx95sbToqNHiQNVhmbs06kIr9ArApN/J52Zr5PtUWVNchUpA522qnB0o3DNA5nKrQ/psu71WOcx9lZKs88xDUC3BJpYeONiJ3JQRFp8d55ZZc0syRreAtUPalVhYyO8R+cD70CUNhG5btXKyHRausSmvB/Z+Hby1E9MS1Dt536GYO9YBJZhDpF/hdbmzK7+7sWQXw2oD63WIX1PcGGs304aIjBesEvHOkWNrtC X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SN6PR10MB3022.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(136003)(376002)(346002)(396003)(39860400002)(366004)(451199021)(4326008)(6916009)(66946007)(66476007)(66556008)(41300700001)(8936002)(5660300002)(8676002)(6512007)(26005)(6506007)(1076003)(316002)(478600001)(6486002)(107886003)(2906002)(186003)(2616005)(83380400001)(86362001)(36756003)(38100700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: F51w7Ox4aS8VmXwu46vP1/cbaWXIyW3Xc3hTU2n352THbGvJaSUNFtHjpqaHZWLw9N4o0LlEReFP2DLMN5xpPOy1bn+cVXee4NgZvav4xAWCXaPWkKru/hV4+Z6ZPpSHps0HiwpWwL5zcfXl2xJcyEANmR/xfBks0IP5PxAaoOI2+jtNyBLfc/TvTQS1FvZ0xBoFHH2VWjbX0rV6vE5j4S57lCtRtA4ytb6HTMv9lG6NCd1E91PZ2owiw4HGYk2UYp63V/Zo79gJF8WFSj2WvvR/UsN7uSnllODjhnzJH4mKKFYmmHnLv+KYPny7hT7m9SZt91fBff5tZzKPvDT82TBG7CpUvvC7keOrvBE4Y2dJzZYgoXyeNCr/6X1SbJSP92aT7vlCI75Z3+qlvhi1bsoawom+F/Yy2FmLcZKb0z2+Ce9uV7ILyjvEpEMsS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Ag== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: d16eb292-4577-459b-48eb-08db4d906ccd X-MS-Exchange-CrossTenant-AuthSource: SN6PR10MB3022.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 May 2023 17:44:50.0191 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: uYnmyhw6QJRY+JOclBkelaQB3YpcgpSie8u3NuATYnM2GxtZy4tSdO5Zss/ll9GTtO+nx5xZhXCcuIzTLG2T7A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR10MB6895 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-05-05_24,2023-05-05_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 phishscore=0 spamscore=0 mlxlogscore=999 bulkscore=0 suspectscore=0 mlxscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303200000 definitions=main-2305050146 X-Proofpoint-GUID: Y2EvNB6zQMbOz4BlHOh-QzHJ5m_eydTy X-Proofpoint-ORIG-GUID: Y2EvNB6zQMbOz4BlHOh-QzHJ5m_eydTy X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: These functions need to move for future use. Signed-off-by: Liam R. Howlett --- lib/maple_tree.c | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/lib/maple_tree.c b/lib/maple_tree.c index 2f43afeae94e4..b0f185a8154b4 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -4497,6 +4497,25 @@ static inline void *mas_insert(struct ma_state *mas, void *entry) } +static inline void mas_rewalk(struct ma_state *mas, unsigned long index) +{ +retry: + mas_set(mas, index); + mas_state_walk(mas); + if (mas_is_start(mas)) + goto retry; +} + +static inline bool mas_rewalk_if_dead(struct ma_state *mas, + struct maple_node *node, const unsigned long index) +{ + if (unlikely(ma_dead_node(node))) { + mas_rewalk(mas, index); + return true; + } + return false; +} + /* * mas_prev_node() - Find the prev non-null entry at the same level in the * tree. The prev value will be mas->node[mas->offset] or MAS_NONE. @@ -4676,25 +4695,6 @@ static inline int mas_next_node(struct ma_state *mas, struct maple_node *node, return 0; } -static inline void mas_rewalk(struct ma_state *mas, unsigned long index) -{ -retry: - mas_set(mas, index); - mas_state_walk(mas); - if (mas_is_start(mas)) - goto retry; -} - -static inline bool mas_rewalk_if_dead(struct ma_state *mas, - struct maple_node *node, const unsigned long index) -{ - if (unlikely(ma_dead_node(node))) { - mas_rewalk(mas, index); - return true; - } - return false; -} - /* * mas_next_slot() - Get the entry in the next slot * From patchwork Fri May 5 17:41:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Liam R. Howlett" X-Patchwork-Id: 13232912 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 388CEC77B7F for ; Fri, 5 May 2023 17:45:00 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C39E16B00A1; Fri, 5 May 2023 13:44:56 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id BA2936B00A4; Fri, 5 May 2023 13:44:56 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 824666B00A6; Fri, 5 May 2023 13:44:56 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by kanga.kvack.org (Postfix) with ESMTP id 48A246B00A1 for ; Fri, 5 May 2023 13:44:56 -0400 (EDT) Received: from pps.filterd (m0246630.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 345HhMLV014811; Fri, 5 May 2023 17:44:56 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=CA7TjhYz/vx59Q/uHiOAJePZOs9K1Q07auxG39Vh9+I=; b=QMLIVu7S015P2YmiLXMZYSvyTMbWFvh6TOFhVhDo/Bi63VABFde+C21m2RqmUhysajgn TdhbveLz/i9+S10VEWv1sNdRnVXBectqasX1QPkseja1wqxD8WqnBGjZ6rkR3pHYKMH2 Vrsfr5OZE3t26ykRQLl7RCmTIiw9guorzlYYp96dDlG/Sx6ZzfuiUT1ojsMclK0uVNfB bIhkQdiAp21wjBDW8YpLyB5JhFujJZe2n03yRuF/2RuCabgOVKd+S5dne2zGC6IBOkdY 2t9uzY7i9wzxKJH7i0wTx+eEVpXU15SLbgF6R2P4lEFT7jqekCu0OUfJHBlNeJwbb5eU aA== Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3q8snede0b-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 05 May 2023 17:44:55 +0000 Received: from pps.filterd (iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 345HJ4n4040541; Fri, 5 May 2023 17:44:54 GMT Received: from nam10-dm6-obe.outbound.protection.outlook.com (mail-dm6nam10lp2108.outbound.protection.outlook.com [104.47.58.108]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3q8spa74pk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 05 May 2023 17:44:54 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nGonLsfDzPaPppP9YU8ESmClONIw1qpSVIFxo33Y7jsrpxJD3DoExAomVcc4kpIBhA2VBUHD/eczn3YbmYeM8sguib3zU4lzJo38m9nACSuKv8HY6UYBnzLym+RnGqH5dI1YTEN+7ShAEtxmCp5gObMRPcxR97FGavNZDdacK0hESTVTTsgjELXVZTvPtIIWWS/REJu98JbOV2c479VfEpT/HzT6JyBhWIp6/Pks+IVv7/NHrD4Sy8DGmpHYL41Z9zG8nMshy3RvNpkIIHX1SK3RE0sGsGXWImxyURyOykAy8St8JlfKzB+wkx/GHCFkuFvbvlNiBBhnbmXFwwA2bQ== 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=CA7TjhYz/vx59Q/uHiOAJePZOs9K1Q07auxG39Vh9+I=; b=HI7bFEy4tQ7NLiWH/6xLsk4VZTLInF9OKkemQvNwJHldtunWaaWIIDtg/J6ecuqimOBaO9x2fkwd7/qmZ2Lx8Mu98gkfHRdV3tbp5igtKskAw+KOwfEZa/Z75b9SnDvKavXzh0bg216L7XZf/K4nWBEKX6y7ezRBuOMKB8ocL8m3yaZGeW8QMCabBJW9XLNN+jAB434W6RZCxa7cpzfHDExuloCn8bmk6p7fmKuAJ7+Um/2lRhgYLtHysRKmbOw8Q8KJJXKK4xeoG5RVCezcN1N9jd3QRemTxyFQ4nQCTPJoCoiMdfNeV0PXJnqj+lhgJPaVy1EaKIaJRGUVzPzi7A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=CA7TjhYz/vx59Q/uHiOAJePZOs9K1Q07auxG39Vh9+I=; b=PUA79E2pLy+w14SDM7hdXefovq74KBt80nGWz7eegRN7LMo+fFuNPxwPSUUyXppgxWDUxljWGtv3p3novyG8M8Pk7Sg5VHG9ZcrwsM6hjbTbFzHhWDMK6nyXNjHf140cLzITOydjAQBbs62fMp4Bd5tyd8aqBJMHwXkJBHD14FU= Received: from SN6PR10MB3022.namprd10.prod.outlook.com (2603:10b6:805:d8::25) by DS0PR10MB6895.namprd10.prod.outlook.com (2603:10b6:8:134::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6363.27; Fri, 5 May 2023 17:44:53 +0000 Received: from SN6PR10MB3022.namprd10.prod.outlook.com ([fe80::8bb9:2bb7:3930:b5da]) by SN6PR10MB3022.namprd10.prod.outlook.com ([fe80::8bb9:2bb7:3930:b5da%7]) with mapi id 15.20.6363.022; Fri, 5 May 2023 17:44:52 +0000 From: "Liam R. Howlett" To: Andrew Morton Cc: maple-tree@lists.infradead.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, "Liam R. Howlett" Subject: [PATCH v2 30/36] maple_tree: Introduce mas_prev_slot() interface Date: Fri, 5 May 2023 13:41:58 -0400 Message-Id: <20230505174204.2665599-31-Liam.Howlett@oracle.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230505174204.2665599-1-Liam.Howlett@oracle.com> References: <20230505174204.2665599-1-Liam.Howlett@oracle.com> X-ClientProxiedBy: YT3PR01CA0027.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:86::13) To SN6PR10MB3022.namprd10.prod.outlook.com (2603:10b6:805:d8::25) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN6PR10MB3022:EE_|DS0PR10MB6895:EE_ X-MS-Office365-Filtering-Correlation-Id: ade42863-8341-42fe-68e8-08db4d906e7a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: RVAqzFOS50BD0j6sifO54mDOVa+Y0xP4yxIS6jtH+SZ1hY42OCp8Z8BtOBd2RqlowJ2kQ8+YoMRehm3zRZB8C8tJ8zg8RA+jhgtiZXBACEUHOwdVbBg9AbWXv4OtxPcgV+9UCxVZAK4dKj+p5kDMjs6tL9VEhtU8DM55KGgs+XYnhFvIvFUHJlyAwaTGa7ptJNK80lCizVcoD6CDVOjtTUq66T5V06YxQTFzmBDKqnFiLaH5cm+mGWXiFV9MmH8t8vJwY8WGONgPesza0wHZJUxHVzfUadtDUzbPyMIL/gFjaD8BvSOjduE/hCSR8mNlWkQGUZ2SlQTmIXQk/Hwz47tXp3utSKVpGGlVO9+pfdRyCvOyQUtqN/VkglW/3nzkZgCNGgZ0h+NT5ifBDNcD8WYjI/thADZJ5QgT3rwNa/IFvegvtgEQsE0nQgWg708uX/FjLebP/H1NbW2lVjONdExeJfFyQ4f71mr+HowGJxCpeRsnZTH5SY4cLEK5GnNoQyvgywd2NU0fx/fyqcAAhMXotbySZiroI9cjQAXNI2FoJNjSUQyt51if/mgSYJEe X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SN6PR10MB3022.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(136003)(376002)(346002)(396003)(39860400002)(366004)(451199021)(4326008)(6916009)(66946007)(66476007)(66556008)(41300700001)(8936002)(5660300002)(8676002)(6512007)(26005)(6506007)(1076003)(316002)(478600001)(6486002)(107886003)(2906002)(186003)(2616005)(83380400001)(86362001)(36756003)(38100700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: /2JdCCRyFEuE39RCezX04HYkKltHrZ0x4Oboo6i7pE678fIulTNOrSMYQGcGy9F+BFCkPVIUWuQCnVeoH6VCU+BUPZZ4yGCu1ECaIopRs/qOh52uC1+A55iz1FLqccWu/gFYr92UILYigtNMTAa4yWzKduqp5G8seIEZ1dX2ARk4gSx3grPAjxUrNlpaPL3gU2j6cLvZ/y7cAqvipsYZddZ9qg5cxP2oDVcXeJ3jjgpcQ8g8X0BhHn6eSn+5bXqgsdJ9qvT3A240SEYdlQjYm8hGgnfatR7NB5LhC0p6nul3j6vICzP6oGkWBw2Lv9ZO3qXd7xI0kL3hXnSXscWaoXAMHibK7I0xYKl7EnbbaMAs5Qjs7sj+StHjRnDoXfW0Yfzozq2uVGi3clpNeuqtA+JUbUNDqsjVWtqGEnkJXi92GvcPsTQqDceDziciTKqsENEdCB/2l1ylVp9VdVnsjrKG/bCndxOPDKaFvLybNtRyxceaytAT2remv3uHUtXBpHE8qoD268aCfNGsXnE3bXWULetQBbNzhCd9RcqWHaosRydKEaN6suOywFhu8epr4rckIQ8AeP7jBbsP6pustfu7xdF0V+3z4sMerQDBSz1fYwBuwDMJnkR8lDODqWIvz21ksn/cJ46UhPpJuv25sFxey7d3KrNm8zL4ZcfBghqDplc6vMAMtOL4yEwSVTyL9Wc6t0Yp/uGrzbOI+OdhLEAzwrXg7VuCsI9Uk4xRCkJ5DhxXaUu14fa05emsjNUjjmRJxqJEpNGb7z094HcE80JtPe4/A1B1G5YfrzJddKeqoWPR3tuEi73UL+6LJWqIhLX5DR5ObvAt6hULxLEckw1ydewunxD2luzXec+BPRuAcRfWGdoc5OEnUfHGOLjKYquKUeZGgP1BO037dCs2egE0VVF7bUWCvqlitxA1SaO7WrtC3x8XgBzQzMOK1MUudP5lMve28qh+j3cpbFWCeGMrqABGE2beD0S4nRZpXVrE1KCO0DvJlH8cm+tszgOevJNWB669ErEA8q7ez9UmGC8flXgNNjrTcXzY6ANM6o3Mkuw9eE2VXhE+wakI1f0xhAfuAAf7miv3W7scixizbA1WeM0FpnJWeqLD1XV4P9poqxGo+nJzouAVinAJjmR5ELmj8y/KOt+zaO7cKuZYej2NU6HUNezTIw+pVoVS7m/LkAOzof8+EyVniy6ysUr8eqQl2j3+lpt5iwWV6FwvrhoWDA04D8v4XVDCT2muxoM+VGPxLiJPODsTm/OyjUoOdp5jElIAp60sJChAgV/abjWFEX9qmYiArFAkgmtNrMVohEuUalAYgszoozrcVCgC+E/s5PdWRecbaEv9f4tvLil0in1jEpStfD+BfbbG8h8oaAEdEaUda1zyRN2pU4L/EmpKpFwVD46xhAALtM2NjzXtApzrolwum1SpqMFPAohiXO5wWAFPIrO8sT3PvjoUS0df8iRU4BiuEV1NzYlSnHSrDq9Ge0sa0Fn2mov8S8jqBFrz/+/imamdtFytXK/QVgNUEw8SW2rNDWcyH/F6/aUEZC/fUzcrGC9sYqG1aVSoKQtQekVlSOvVNV0IM0XDjRH4qzkB+zBnlNPVSdPs2g== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: 8eW3+kgvy95HdpjqmCWK/I2aH0g4ACQ0z8NFYKsTdihXT0/yCz2ydfS6yGL6Mujkok0YjmnEgeoaVMAkcXHR+9vfU7Sd/fyug+FP0ZgfwvRAESsa7T5KvHQt5szpeh1TQfwFi4wH7d9X5UQm4j37cA8WEHP6SeTGqIDSsnPmnLR8rnJtaoRffj9Bni8MeiIxzFTbP2ZH34NIzyYbhFusLJCOYfDPj8UEAiH4+RTso+QcCUhD4wjRJZsQ625j9YxUa+XCSHo4kki9PcBWwSyFct30LQ8EjA2IM4BYQFOmEby/GAN7Twoq5uLMcYX94U4910CNq5M9g0HKZUiNYSuvRTroPG1FQ/wp0YHGjAHhfB6jb/78ny7vSvhZ+j9Eo2gBLPGRSWfAltzOZ01KFXOsQW5XQwJuqNRZfwXm+X8UoQeUmH/VPiIgKoB3UOSnPvl8OBtK0vHUSgAB8d+3k8pb9dlk3uHgBb9Vq/ifDgyGctmcIJuCm4A5RXO2S4oOQgUmSDMQem2JNQIcSWr/jg8hJOba2tosbZ9TcTRvNq6KycfbrL0Ya2I3EG4Kz6zZ5quyUycfGrcPkV/DoEaYiVOTKmkuQLpnwPGEfqNAhBrCTdUSa9Ey5g+cZXPvNfBmFeOPfOyj3StIuJzHOm0mxv+RSbAMLIPb2LA8ZhBm/60Fq289Q4SLpbzHzowtRPku/dNYUHPRypY4uo9ZGoHxpys/VcLG9oi5/bF6xgm09Z2FGs5xHV6bVm5v0rkEQAosjz9pjrw/r6q3Ja/NHb620rVybFetrw3KJqWcohFHZUDGNyH30AY7p9PlDzml18gyU+/myza57Aqt+h+74AsZ+i7aR0j0K6m9D4Wc5xxAocuu05fTD1Cbj3e0r+M5awBWl5zwy0jWbkt7z/iAhtmnk77ZSg== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: ade42863-8341-42fe-68e8-08db4d906e7a X-MS-Exchange-CrossTenant-AuthSource: SN6PR10MB3022.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 May 2023 17:44:52.8658 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: ucTWXRalRWLhz3gKCXAoBw56D4iMTnd7X9mk2NsWnlLFM8eqrP8dgjuvM22zcXzK6KRH6BQrPkKGs9xWHQB1AQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR10MB6895 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-05-05_24,2023-05-05_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 mlxlogscore=999 phishscore=0 bulkscore=0 suspectscore=0 mlxscore=0 spamscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303200000 definitions=main-2305050146 X-Proofpoint-GUID: c9cf0CTyHw6iQVJsRmQKihWYchOaB9LM X-Proofpoint-ORIG-GUID: c9cf0CTyHw6iQVJsRmQKihWYchOaB9LM X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Sometimes the user needs to revert to the previous slot, regardless of if it is empty or not. Add an interface to go to the previous slot. Since there can't be two consecutive NULLs in the tree, the mas_prev() function can be implemented by calling mas_prev_slot() a maximum of 2 times. Change the underlying interface to use mas_prev_slot() to align the code. Signed-off-by: Liam R. Howlett --- lib/maple_tree.c | 232 ++++++++++++++++++----------------------------- 1 file changed, 90 insertions(+), 142 deletions(-) diff --git a/lib/maple_tree.c b/lib/maple_tree.c index b0f185a8154b4..e050fd1f7cce8 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -4531,15 +4531,19 @@ static inline int mas_prev_node(struct ma_state *mas, unsigned long min) int offset, level; void __rcu **slots; struct maple_node *node; - struct maple_enode *enode; unsigned long *pivots; + unsigned long max; - if (mas_is_none(mas)) - return 0; + node = mas_mn(mas); + if (!mas->min) + goto no_entry; + + max = mas->min - 1; + if (max < min) + goto no_entry; level = 0; do { - node = mas_mn(mas); if (ma_is_root(node)) goto no_entry; @@ -4548,64 +4552,41 @@ static inline int mas_prev_node(struct ma_state *mas, unsigned long min) return 1; offset = mas->offset; level++; + node = mas_mn(mas); } while (!offset); offset--; mt = mte_node_type(mas->node); - node = mas_mn(mas); - slots = ma_slots(node, mt); - pivots = ma_pivots(node, mt); - if (unlikely(ma_dead_node(node))) - return 1; - - mas->max = pivots[offset]; - if (offset) - mas->min = pivots[offset - 1] + 1; - if (unlikely(ma_dead_node(node))) - return 1; - - if (mas->max < min) - goto no_entry_min; - while (level > 1) { level--; - enode = mas_slot(mas, slots, offset); + slots = ma_slots(node, mt); + mas->node = mas_slot(mas, slots, offset); if (unlikely(ma_dead_node(node))) return 1; - mas->node = enode; mt = mte_node_type(mas->node); node = mas_mn(mas); - slots = ma_slots(node, mt); pivots = ma_pivots(node, mt); - offset = ma_data_end(node, mt, pivots, mas->max); + offset = ma_data_end(node, mt, pivots, max); if (unlikely(ma_dead_node(node))) return 1; - - if (offset) - mas->min = pivots[offset - 1] + 1; - - if (offset < mt_pivots[mt]) - mas->max = pivots[offset]; - - if (mas->max < min) - goto no_entry; } + slots = ma_slots(node, mt); mas->node = mas_slot(mas, slots, offset); + pivots = ma_pivots(node, mt); if (unlikely(ma_dead_node(node))) return 1; + if (likely(offset)) + mas->min = pivots[offset - 1] + 1; + mas->max = max; mas->offset = mas_data_end(mas); if (unlikely(mte_dead_node(mas->node))) return 1; return 0; -no_entry_min: - mas->offset = offset; - if (offset) - mas->min = pivots[offset - 1] + 1; no_entry: if (unlikely(ma_dead_node(node))) return 1; @@ -4614,6 +4595,76 @@ static inline int mas_prev_node(struct ma_state *mas, unsigned long min) return 0; } +/* + * mas_prev_slot() - Get the entry in the previous slot + * + * @mas: The maple state + * @max: The minimum starting range + * + * Return: The entry in the previous slot which is possibly NULL + */ +void *mas_prev_slot(struct ma_state *mas, unsigned long min, bool empty) +{ + void *entry; + void __rcu **slots; + unsigned long pivot; + enum maple_type type; + unsigned long *pivots; + struct maple_node *node; + unsigned long save_point = mas->index; + +retry: + node = mas_mn(mas); + type = mte_node_type(mas->node); + pivots = ma_pivots(node, type); + if (unlikely(mas_rewalk_if_dead(mas, node, save_point))) + goto retry; + +again: + if (mas->min <= min) { + pivot = mas_safe_min(mas, pivots, mas->offset); + + if (unlikely(mas_rewalk_if_dead(mas, node, save_point))) + goto retry; + + if (pivot <= min) + return NULL; + } + + if (likely(mas->offset)) { + mas->offset--; + mas->last = mas->index - 1; + mas->index = mas_safe_min(mas, pivots, mas->offset); + } else { + if (mas_prev_node(mas, min)) { + mas_rewalk(mas, save_point); + goto retry; + } + + if (mas_is_none(mas)) + return NULL; + + mas->last = mas->max; + node = mas_mn(mas); + type = mte_node_type(mas->node); + pivots = ma_pivots(node, type); + mas->index = pivots[mas->offset - 1] + 1; + } + + slots = ma_slots(node, type); + entry = mas_slot(mas, slots, mas->offset); + if (unlikely(mas_rewalk_if_dead(mas, node, save_point))) + goto retry; + + if (likely(entry)) + return entry; + + if (!empty) + goto again; + + return entry; +} + /* * mas_next_node() - Get the next node at the same level in the tree. * @mas: The maple state @@ -4798,109 +4849,6 @@ static inline void *mas_next_entry(struct ma_state *mas, unsigned long limit) return mas_next_slot(mas, limit, false); } -/* - * mas_prev_nentry() - Get the previous node entry. - * @mas: The maple state. - * @limit: The lower limit to check for a value. - * - * Return: the entry, %NULL otherwise. - */ -static inline void *mas_prev_nentry(struct ma_state *mas, unsigned long limit, - unsigned long index) -{ - unsigned long pivot, min; - unsigned char offset, count; - struct maple_node *mn; - enum maple_type mt; - unsigned long *pivots; - void __rcu **slots; - void *entry; - -retry: - if (!mas->offset) - return NULL; - - mn = mas_mn(mas); - mt = mte_node_type(mas->node); - offset = mas->offset - 1; - slots = ma_slots(mn, mt); - pivots = ma_pivots(mn, mt); - count = ma_data_end(mn, mt, pivots, mas->max); - if (unlikely(mas_rewalk_if_dead(mas, mn, index))) - goto retry; - - offset = mas->offset - 1; - if (offset >= mt_slots[mt]) - offset = mt_slots[mt] - 1; - - if (offset >= count) { - pivot = mas->max; - offset = count; - } else { - pivot = pivots[offset]; - } - - if (unlikely(mas_rewalk_if_dead(mas, mn, index))) - goto retry; - - while (offset && !mas_slot(mas, slots, offset)) { - pivot = pivots[--offset]; - if (pivot >= limit) - break; - } - - /* - * If the slot was null but we've shifted outside the limits, then set - * the range to the last NULL. - */ - if (unlikely((pivot < limit) && (offset < mas->offset))) - pivot = pivots[++offset]; - - min = mas_safe_min(mas, pivots, offset); - entry = mas_slot(mas, slots, offset); - if (unlikely(mas_rewalk_if_dead(mas, mn, index))) - goto retry; - - mas->offset = offset; - mas->last = pivot; - mas->index = min; - return entry; -} - -static inline void *mas_prev_entry(struct ma_state *mas, unsigned long min) -{ - void *entry; - struct maple_enode *prev_enode; - unsigned char prev_offset; - - if (mas->index < min) - return NULL; - -retry: - prev_enode = mas->node; - prev_offset = mas->offset; - while (likely(!mas_is_none(mas))) { - entry = mas_prev_nentry(mas, min, mas->index); - - if (likely(entry)) - return entry; - - if (unlikely(mas->index <= min)) - return NULL; - - if (unlikely(mas_prev_node(mas, min))) { - mas_rewalk(mas, mas->index); - goto retry; - } - - mas->offset++; - } - - mas->node = prev_enode; - mas->offset = prev_offset; - return NULL; -} - /* * mas_rev_awalk() - Internal function. Reverse allocation walk. Find the * highest gap address of a given size in a given node and descend. @@ -6017,7 +5965,7 @@ void *mas_prev(struct ma_state *mas, unsigned long min) } return NULL; } - return mas_prev_entry(mas, min); + return mas_prev_slot(mas, min, false); none: mas->node = MAS_NONE; @@ -6229,8 +6177,8 @@ void *mas_find_rev(struct ma_state *mas, unsigned long min) if (mas->index < min) return NULL; - /* Retries on dead nodes handled by mas_prev_entry */ - return mas_prev_entry(mas, min); + /* Retries on dead nodes handled by mas_prev_slot */ + return mas_prev_slot(mas, min, false); none: mas->node = MAS_NONE; From patchwork Fri May 5 17:41:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Liam R. Howlett" X-Patchwork-Id: 13232913 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id DAF6EC77B7C for ; Fri, 5 May 2023 17:45:01 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 337306B00A6; Fri, 5 May 2023 13:44:59 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 2EC1A6B00A5; Fri, 5 May 2023 13:44:59 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 076496B00A6; Fri, 5 May 2023 13:44:59 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by kanga.kvack.org (Postfix) with ESMTP id D7D926B00A4 for ; Fri, 5 May 2023 13:44:58 -0400 (EDT) Received: from pps.filterd (m0246630.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 345HhLc8014779; Fri, 5 May 2023 17:44:58 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=tPa63bPANKHAc8JBFv1ND1h+aRJpGkxzv6Wn7eeYyIg=; b=R0aSZ1ZitY5LiXrrBtuAp1RFmIIYDMY2e+SCtnUFQ1SccRxnjerB65dSPyMYQSOoh6Y7 TwzxW3SmrR4BqUuGMr6YMFFBKIuW65r2B05/K7voGNWFWivzpjMoesBOSuh/K5rg5bhK eWvvBsn6JbG9WsHHvJ/mZfxm6ETn8yxNH45B6CzUaLcox8wOUc7x8D+otzUjZjz/4mKc w5650dfQ3Hd5w16QnPI7h00zWBIwoT5r1c8Wqtvm2iZhn3rdJQiOishpLWBOR/WM2oRy nzLZz+C8w9Lgnpuv9gEX5ZQzy8UskytIqZxOW/G0l4YIosw/pt/hs7Wosazzatfc3Vt0 0g== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3q8snede0d-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 05 May 2023 17:44:58 +0000 Received: from pps.filterd (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 345H1IYa009860; Fri, 5 May 2023 17:44:57 GMT Received: from nam10-dm6-obe.outbound.protection.outlook.com (mail-dm6nam10lp2102.outbound.protection.outlook.com [104.47.58.102]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3q8spankkq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 05 May 2023 17:44:57 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hEAf6IOZXJ6mtGKq/Hg+/DaKljRLW/jrHZgPFvRbcYaTqme7LNdVRJ4oQqRLCDutwJXfdsQazRoiTS2jZgjk6pHGzl+ERpSBecuDPunsnuCuKvdbrdTGq9nAMjgYwx3ICHlkwckWaal71dRp6jg5bann7bfXjWaeTfqNC56dESpKBY2TOBec3UnxHPF0Wn2CEcNc7WyUNcsUdF1zKtzIk+VU0CaLed4D7ASbe+Is/tcoYaCUl6cMI35uc6BtxSBbvaQjIZYag2d1IgfSowUO7QFvKtfRoFE13dDOKBaxMDMea2CMkUq8Ri9dJnsqfcUTh38CcKbPngGg8aaO0pCVrg== 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=tPa63bPANKHAc8JBFv1ND1h+aRJpGkxzv6Wn7eeYyIg=; b=O0WI8mU1JNq7htOfssJMMhD+Sr7JnbOTB4YjirdDz6EXSSc7VVzEjU1PN9VxuPUDGvD3R2J8QRtaXQi6GMyvfhBQ79AdZSM8QbGy29psxzAYM1nxxLhDwqfaytzXNpKitQfpRXfe6jOcABkYHjHZElrnBTub4R+XsA1BUi/hPPYQ/ZvK4k13c7dPHQ06FO/q2nh+45RpJ/7PBhkbuyi5ACTuDNtXe9NhS9GE8suASGI2zXRivgbF29v1sEBUeb/+BdFUWWzSCcJNzQ3QfOvZ9JFwojvHQ7pe3BDellLQFfd5ir2OXG2t8f1rdTR+iMl4wl4fB0EKPvrLpAxxONLKuA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=tPa63bPANKHAc8JBFv1ND1h+aRJpGkxzv6Wn7eeYyIg=; b=GYPIfb1usVhgbyewh3HpFbVkiFnVELQh1c9xFwB1MudicWv5jfMGBMiFaQv+8W4BN5BF1kETzgukKFDAjVxWXSD3hOW5cd9rE/RhYAR773oJSgUvxUMScCCIRWmy72xqz3moH75fFukOszIcnudCTpezUVqspNG/QiXdtNxvKDI= Received: from SN6PR10MB3022.namprd10.prod.outlook.com (2603:10b6:805:d8::25) by DS0PR10MB6895.namprd10.prod.outlook.com (2603:10b6:8:134::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6363.27; Fri, 5 May 2023 17:44:55 +0000 Received: from SN6PR10MB3022.namprd10.prod.outlook.com ([fe80::8bb9:2bb7:3930:b5da]) by SN6PR10MB3022.namprd10.prod.outlook.com ([fe80::8bb9:2bb7:3930:b5da%7]) with mapi id 15.20.6363.022; Fri, 5 May 2023 17:44:54 +0000 From: "Liam R. Howlett" To: Andrew Morton Cc: maple-tree@lists.infradead.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, "Liam R. Howlett" Subject: [PATCH v2 31/36] maple_tree: Add mas_prev_range() and mas_find_range_rev interface Date: Fri, 5 May 2023 13:41:59 -0400 Message-Id: <20230505174204.2665599-32-Liam.Howlett@oracle.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230505174204.2665599-1-Liam.Howlett@oracle.com> References: <20230505174204.2665599-1-Liam.Howlett@oracle.com> X-ClientProxiedBy: YT4PR01CA0414.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:10b::22) To SN6PR10MB3022.namprd10.prod.outlook.com (2603:10b6:805:d8::25) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN6PR10MB3022:EE_|DS0PR10MB6895:EE_ X-MS-Office365-Filtering-Correlation-Id: 2cbc96bf-1e3a-491a-1a01-08db4d906fb5 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Ksz/gHHU1Ju6pYWKqJcqBUewojUUs5+cXPjlMsdMuZU331qWsSYCZKr6z/9Gjtk4NQJVMK+90S4qnSiFxHxfab3O2937kgYJGjG8kBQlZ7kOP/w9w52/m/b8Jrs+MqdFUPhnbfobX1xeIfWyp5rrCrYF9zcwKe/tHOvaUbqNIhHEac2gmsrWAvZjNfTmjMSIRojgZwWFz5lLZXn3yjOEIT9RIaWtvlkv4UufZaJACWPDQ+WADZf2dtL4baQZmuVeStHg2/ZcciKOxeYnnnG2SgwVvg8YfYAoUfs1T/ly61t1M8vPrOlpVptEhSwlmk/iRZ3otb8bsOFT0Xdj8mUskQx1MlJZmijTLR6GErWGUaUv+9QBTclc9/6sS29v67FBYo4jg+zuety/TOZlLLgZpxIwFwJXL6Di/9i4yNnIBbFHAl4OhNUBZfU1BIJVd6bU01kuN3t/W7BqkhWEuLuUyOHqD/1KQrrNqORCxvA5vlaQbN7XHcZZT/EygzrjDt0bLSzEaubM6b2Fba65MLIik6n7cEK0yCZ7m3GUZIMsLHBz2VSj2CZuf7Up4ys+vpOc X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SN6PR10MB3022.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(136003)(376002)(346002)(396003)(39860400002)(366004)(451199021)(4326008)(6916009)(66946007)(66476007)(66556008)(41300700001)(8936002)(5660300002)(8676002)(6512007)(26005)(6506007)(1076003)(316002)(478600001)(6486002)(107886003)(2906002)(186003)(2616005)(83380400001)(86362001)(36756003)(38100700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: H2+py5iNpvfm2ZMC/+kQNxjdOPAUeYKQsXbwXpRJFCwlK1H9nVsJuLJiT0VwU7gNqSyxLQ4eBaG9/V/rJYFjEnfP0IydUHGgGxjBfgUN3NFYlclGKmDm/ipV4Gi1nJQ3Cxh9trRse9lxeHd3gVemN5Mz7SWqGV3mK+F5eZlNWI6Agzmb+sPW1K1U/SWizqsRQXLyDzxDHK5AFVpIdZU51UzgvYa77UX/SuZrSvFcRk+LpxF7Co5lAuq1/1S9bhAjF4L2i+4hH1wL/CmmlN16y8JgiewbXtyk/Fb4LapF0aLKef5shzdEnUaAUuC0r6b9+EF2bGY8sRPNT8LCWOlXxGLyfuTWwHnoPNoq2CB0jDZYPPS7uhMqFN+YTcSfvBt8BJ9fJOJBFTWBxR/sr4p6Tq79NcmsAZ7Dr3k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kXbTHVKhiY4qSsrfwz8dS08NYmrIDwv//nfvjlWO2g== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2cbc96bf-1e3a-491a-1a01-08db4d906fb5 X-MS-Exchange-CrossTenant-AuthSource: SN6PR10MB3022.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 May 2023 17:44:54.9124 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: khXMpdc/AlxjUbA2LahjqL8JJ2PTgY8aPzLRriYhjjSkFB8IdBJ5nYhDjkC7OKsq0gdIyNkWipVEYCIo/iJRNQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR10MB6895 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-05-05_24,2023-05-05_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 phishscore=0 spamscore=0 mlxlogscore=999 bulkscore=0 suspectscore=0 mlxscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303200000 definitions=main-2305050146 X-Proofpoint-GUID: p4grx47VenGKBkVqCEzh_UixfyMyIDKp X-Proofpoint-ORIG-GUID: p4grx47VenGKBkVqCEzh_UixfyMyIDKp X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Some users of the maple tree may want to move to the previous range regardless of the value stored there. Add this interface as well as the 'find' variant to support walking to the first value, then iterating over the previous ranges. Signed-off-by: Liam R. Howlett --- include/linux/maple_tree.h | 1 + lib/maple_tree.c | 160 +++++++++++++++++++++++++++---------- 2 files changed, 121 insertions(+), 40 deletions(-) diff --git a/include/linux/maple_tree.h b/include/linux/maple_tree.h index a4cd8f891a090..542b09118a09f 100644 --- a/include/linux/maple_tree.h +++ b/include/linux/maple_tree.h @@ -467,6 +467,7 @@ void mas_destroy(struct ma_state *mas); int mas_expected_entries(struct ma_state *mas, unsigned long nr_entries); void *mas_prev(struct ma_state *mas, unsigned long min); +void *mas_prev_range(struct ma_state *mas, unsigned long max); void *mas_next(struct ma_state *mas, unsigned long max); void *mas_next_range(struct ma_state *mas, unsigned long max); diff --git a/lib/maple_tree.c b/lib/maple_tree.c index e050fd1f7cce8..f060c71965c0d 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -5924,18 +5924,8 @@ void *mt_next(struct maple_tree *mt, unsigned long index, unsigned long max) } EXPORT_SYMBOL_GPL(mt_next); -/** - * mas_prev() - Get the previous entry - * @mas: The maple state - * @min: The minimum value to check. - * - * Must hold rcu_read_lock or the write lock. - * Will reset mas to MAS_START if the node is MAS_NONE. Will stop on not - * searchable nodes. - * - * Return: the previous value or %NULL. - */ -void *mas_prev(struct ma_state *mas, unsigned long min) +static inline bool mas_prev_setup(struct ma_state *mas, unsigned long min, + void **entry) { if (mas->index <= min) goto none; @@ -5953,7 +5943,8 @@ void *mas_prev(struct ma_state *mas, unsigned long min) if (!mas->index) goto none; mas->index = mas->last = 0; - return mas_root(mas); + *entry = mas_root(mas); + return true; } if (mas_is_none(mas)) { @@ -5961,18 +5952,64 @@ void *mas_prev(struct ma_state *mas, unsigned long min) /* Walked to out-of-range pointer? */ mas->index = mas->last = 0; mas->node = MAS_ROOT; - return mas_root(mas); + *entry = mas_root(mas); + return true; } - return NULL; + return true; } - return mas_prev_slot(mas, min, false); + + return false; none: mas->node = MAS_NONE; - return NULL; + return true; +} + +/** + * mas_prev() - Get the previous entry + * @mas: The maple state + * @min: The minimum value to check. + * + * Must hold rcu_read_lock or the write lock. + * Will reset mas to MAS_START if the node is MAS_NONE. Will stop on not + * searchable nodes. + * + * Return: the previous value or %NULL. + */ +void *mas_prev(struct ma_state *mas, unsigned long min) +{ + void *entry = NULL; + + if (mas_prev_setup(mas, min, &entry)) + return entry; + + return mas_prev_slot(mas, min, false); } EXPORT_SYMBOL_GPL(mas_prev); +/** + * mas_prev_range() - Advance to the previous range + * @mas: The maple state + * @min: The minimum value to check. + * + * Sets @mas->index and @mas->last to the range. + * Must hold rcu_read_lock or the write lock. + * Will reset mas to MAS_START if the node is MAS_NONE. Will stop on not + * searchable nodes. + * + * Return: the previous value or %NULL. + */ +void *mas_prev_range(struct ma_state *mas, unsigned long min) +{ + void *entry = NULL; + + if (mas_prev_setup(mas, min, &entry)) + return entry; + + return mas_prev_slot(mas, min, true); +} +EXPORT_SYMBOL_GPL(mas_prev_slot); + /** * mt_prev() - get the previous value in the maple tree * @mt: The maple tree @@ -6116,20 +6153,15 @@ void *mas_find_range(struct ma_state *mas, unsigned long max) EXPORT_SYMBOL_GPL(mas_find_range); /** - * mas_find_rev: On the first call, find the first non-null entry at or below - * mas->index down to %min. Otherwise find the first non-null entry below - * mas->index down to %min. - * @mas: The maple state - * @min: The minimum value to check. + * mas_find_rev_setup() - Internal function to set up mas_find_*_rev() * - * Must hold rcu_read_lock or the write lock. - * If an entry exists, last and index are updated accordingly. - * May set @mas->node to MAS_NONE. - * - * Return: The entry or %NULL. + * Returns: True if entry is the answer, false otherwise. */ -void *mas_find_rev(struct ma_state *mas, unsigned long min) +static inline bool mas_find_rev_setup(struct ma_state *mas, unsigned long min, + void **entry) { + *entry = NULL; + if (unlikely(mas_is_none(mas))) { if (mas->index <= min) goto none; @@ -6141,7 +6173,7 @@ void *mas_find_rev(struct ma_state *mas, unsigned long min) if (unlikely(mas_is_paused(mas))) { if (unlikely(mas->index <= min)) { mas->node = MAS_NONE; - return NULL; + return true; } mas->node = MAS_START; mas->last = --mas->index; @@ -6149,14 +6181,12 @@ void *mas_find_rev(struct ma_state *mas, unsigned long min) if (unlikely(mas_is_start(mas))) { /* First run or continue */ - void *entry; - if (mas->index < min) - return NULL; + return true; - entry = mas_walk(mas); - if (entry) - return entry; + *entry = mas_walk(mas); + if (*entry) + return true; } if (unlikely(!mas_searchable(mas))) { @@ -6170,22 +6200,72 @@ void *mas_find_rev(struct ma_state *mas, unsigned long min) */ mas->last = mas->index = 0; mas->node = MAS_ROOT; - return mas_root(mas); + *entry = mas_root(mas); + return true; } } if (mas->index < min) - return NULL; + return true; - /* Retries on dead nodes handled by mas_prev_slot */ - return mas_prev_slot(mas, min, false); + return false; none: mas->node = MAS_NONE; - return NULL; + return true; +} + +/** + * mas_find_rev: On the first call, find the first non-null entry at or below + * mas->index down to %min. Otherwise find the first non-null entry below + * mas->index down to %min. + * @mas: The maple state + * @min: The minimum value to check. + * + * Must hold rcu_read_lock or the write lock. + * If an entry exists, last and index are updated accordingly. + * May set @mas->node to MAS_NONE. + * + * Return: The entry or %NULL. + */ +void *mas_find_rev(struct ma_state *mas, unsigned long min) +{ + void *entry; + + if (mas_find_rev_setup(mas, min, &entry)) + return entry; + + /* Retries on dead nodes handled by mas_prev_slot */ + return mas_prev_slot(mas, min, false); + } EXPORT_SYMBOL_GPL(mas_find_rev); +/** + * mas_find_range_rev: On the first call, find the first non-null entry at or + * below mas->index down to %min. Otherwise advance to the previous slot after + * mas->index down to %min. + * @mas: The maple state + * @min: The minimum value to check. + * + * Must hold rcu_read_lock or the write lock. + * If an entry exists, last and index are updated accordingly. + * May set @mas->node to MAS_NONE. + * + * Return: The entry or %NULL. + */ +void *mas_find_range_rev(struct ma_state *mas, unsigned long min) +{ + void *entry; + + if (mas_find_rev_setup(mas, min, &entry)) + return entry; + + /* Retries on dead nodes handled by mas_prev_slot */ + return mas_prev_slot(mas, min, true); +} +EXPORT_SYMBOL_GPL(mas_find_range_rev); + /** * mas_erase() - Find the range in which index resides and erase the entire * range. From patchwork Fri May 5 17:42:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Liam R. Howlett" X-Patchwork-Id: 13232914 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 73B1BC77B7F for ; Fri, 5 May 2023 17:45:03 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id BEA0E6B0099; Fri, 5 May 2023 13:45:01 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B72556B00A4; Fri, 5 May 2023 13:45:01 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 950516B009F; Fri, 5 May 2023 13:45:01 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by kanga.kvack.org (Postfix) with ESMTP id 628E36B0099 for ; Fri, 5 May 2023 13:45:01 -0400 (EDT) Received: from pps.filterd (m0333521.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 345Hh61u027900; Fri, 5 May 2023 17:45:01 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=DLizGfG6RsPpK6kYK/8TgPTR+rIq7alrCR/2NcjSElk=; b=JJ7eDEXjw+6rfsSL1OHz4/epsCLYQugMVI8UWNYNP38D+YZQ9NxfFs9ov3i/Swxx0dBT vGFB2ussI8AnEfcOSA+G3k94xQGeXjjRXfc0BIzQuzdKTHRgnFD4f4LOemy6RMePbpbn iCz0j09mh9jbuvSXDq7uYrhuYcfjJ3HzEkesFwLjvMtbVBZI3mqjCJR0h3Gwa5ej+pMD 4V2d2gvNSI5dqp3ky25nfyQjdTz0/7dbtMbNfBr83zxxqdKSB2AR5+iKQ8T3xQzLxNgs fkJ9wELwf4X7P5f0e0jzq6CKW19nhlIrinTcqpp/pi+Uf6i6tKh/F7l19nDGCaiBQv/j uQ== Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3q8t5fwf4s-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 05 May 2023 17:45:00 +0000 Received: from pps.filterd (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 345G4EtF027652; Fri, 5 May 2023 17:44:59 GMT Received: from nam10-dm6-obe.outbound.protection.outlook.com (mail-dm6nam10lp2102.outbound.protection.outlook.com [104.47.58.102]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3q8spgetws-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 05 May 2023 17:44:59 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bw1k3p/tv/llIQl8kZvEVLB/+hndea968yXQ/Ys8iN0CsKQmpc0mnP48UP8C523boU01Qaozcd2iacZW/bRyHj+C14yI2uIIqN4DDP1h513eADicHFCe92VMUNFeLDyvurO1LhsAjTSqfVg3m+xD+RFtinFlm7liSTP9Dk0+Ex9pUDuE3c6c+KgUyd4eRwz7SHD1tJwoX8ViU33iGmJJW+cLE9QKWuXAV2z6Ggavp2o8IBaNOGIVX7g77CyXJUXTJBIxuvfUJW4lN+lA99TsH3KTn47umXKl6BdOFwkfmKYD08Kf3kS09wZ+tmehJFsPWOyLtBe/u8B9Z6Ycv2W63Q== 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=DLizGfG6RsPpK6kYK/8TgPTR+rIq7alrCR/2NcjSElk=; b=XyfzxuCeOYT3DU0ERF0GwdqVeYK4yVwlvJDxf0fqSmQcSGiBC+OJla/6hLgPaQkrv5c4/pXCMNQZZ7wlHIRy5dCH5GNicFic4CERolxQXXlZVC2lhsTRErVZhgeVE4JD82RRS3kP69ECnHf4EMBQaiYoaRHOZWHcpXzY9MiLSd89LXZTSRRtCim2yz7nEMoSDCfkKf4p8+E2UF0mk1jzghFvkiKuGS7j53dEn7jvUGHFGhi8YqewvpA+G77nXFzpPvK+Z9OVyY6EBoQL3SMSMe8dUDxirqbO7www+2C2haSomnnLfjw3mhqequonGab+l2V2Xcx93zLtjWTmUeoRKg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=DLizGfG6RsPpK6kYK/8TgPTR+rIq7alrCR/2NcjSElk=; b=jwCCgu8LhglGmr+r9fDbY5VLPKanUNWtGuB+KoRwnoFx+Ss3q/C1xyhTb722sh4gTwbxc2Pc9qU3JiqMvIC2a8mfI1U/9abQhnVyarKhkn2TAbxPYUjzZ2JGM5t1VwaPg5/lzs6OMj3gGGxuXA3egK3383UeVq+KwQocmB3ZhtU= Received: from SN6PR10MB3022.namprd10.prod.outlook.com (2603:10b6:805:d8::25) by DS0PR10MB6895.namprd10.prod.outlook.com (2603:10b6:8:134::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6363.27; Fri, 5 May 2023 17:44:57 +0000 Received: from SN6PR10MB3022.namprd10.prod.outlook.com ([fe80::8bb9:2bb7:3930:b5da]) by SN6PR10MB3022.namprd10.prod.outlook.com ([fe80::8bb9:2bb7:3930:b5da%7]) with mapi id 15.20.6363.022; Fri, 5 May 2023 17:44:57 +0000 From: "Liam R. Howlett" To: Andrew Morton Cc: maple-tree@lists.infradead.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, "Liam R. Howlett" Subject: [PATCH v2 32/36] maple_tree: Clear up index and last setting in single entry tree Date: Fri, 5 May 2023 13:42:00 -0400 Message-Id: <20230505174204.2665599-33-Liam.Howlett@oracle.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230505174204.2665599-1-Liam.Howlett@oracle.com> References: <20230505174204.2665599-1-Liam.Howlett@oracle.com> X-ClientProxiedBy: YT4PR01CA0251.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:10f::19) To SN6PR10MB3022.namprd10.prod.outlook.com (2603:10b6:805:d8::25) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN6PR10MB3022:EE_|DS0PR10MB6895:EE_ X-MS-Office365-Filtering-Correlation-Id: 7bd5c748-5c0d-4b33-d9a0-08db4d907140 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: V7U1IRfBfvxzh5zAFl7bwlWU/oL6xbbgP5/lGIVQd5USGjcRaAQjGSuWIE9E9mVoeVqdh+G1eidk77K5EI/ZTqjZYkve3lvapQydWyUV4aJWAFNf9EBpYmh/jYOna+8yNG6g0TBCWkzZJe4ZwCkMl+ZseckmGpCJtC6hYSzWxaWQaVKWb4YPsX7VJ3SJnTw2j3JfpWcRb2nOoQWLUT6FA+iETqTmmJV8B8E5gqtiA0/IJRRlAEzIimz8p8DpweHy9h7TBt8OkeFBuVmTYZ6w6Hbf+2RBQfkkjyFDjiWarFTNOjUr6gPjd/IL19DRg//hu+Y71Erl7TS8lRSwo/dfbYjwrUWCqEHarhCBCqDNPypa685HbtADAeZfXxrj0VdGrXNacyXtN1KPFmsD8gPwYuQX1YbN+yRFlu2AU19t6t6wrdbWhyF1reUNAKJG/ySkwlxfFq6IaDW/fYv2pNojV4WfjwOz07nltxX3pI9FtwrE18JewVJNZrUAo+OJpQW8BReBODYaVKIkqsu7RH+jYHsER4vs7cVVSLP/HK91k2qLxz4pVdY3o9yq3JRXDWJW X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SN6PR10MB3022.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(136003)(376002)(346002)(396003)(39860400002)(366004)(451199021)(4326008)(6916009)(66946007)(66476007)(66556008)(41300700001)(8936002)(5660300002)(8676002)(6512007)(26005)(6506007)(1076003)(316002)(478600001)(6666004)(6486002)(107886003)(2906002)(186003)(2616005)(83380400001)(86362001)(36756003)(38100700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: D7dBLONcqYLjARsooyVd65lOPLZ03jlYoVPhnhHHb3G7OnPj9mKFbx5CrEXyBiNvb/ScWgxRlnK0xgpV/j9WtgW8wk0hRjPgggicpIyeZjrNG7bCdKvKVIlza+pyS0Gga7a6cU80yvwbAQ/sI//h/fe9utJSAuID0LEOidexLgKk2AoSSamQcjl9CItq2AoCugrJJhWIlF5W2O/lcLO+goz/u2NXbKDiy6SomDqLVZYr8ByuW0vpsiEew2RVAxDkjaBc9gtzg++TxMLjyMW4IkdrD8SOXQdyuVuJdZK1IaCTIBgHIJO0FkuQOCkmu4Kfo0LGWdiOudQ+KL9/s1tYMJvfaSWbuCcu0rXcCYf/GafAyk+hO8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E3sCwxvQmNfCBwTKjtw7quSQ8Nx7lkDC33X1u7byzk6YpnbCjCrdfO9msWO8rlXi+bVJ5bkGA3S2GgsILS7fhPY335UZb5o/Y7yFkjsM7ZKGxLl2SJt3unKVQV35WioWkhY6CtwNKsxSNynu7ND1RKQftuE0Vsyui7Vg== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: MoC6P2vwQKtePk+mWPcGlHe8T5QGhozThSs0gA5j1cq8hsW2THkfeDvDYUhxnmMcghe8Fmx02FpUKm+99wLXf60epT524qIRI5uroQgky98AEhaB1NFXEmqipBBn4LUk6952PJ7P0hXfKzkG0WUhgvb5sPFN/3aQ6uVZUrJio6HuDEqh02WWjtHSLevgB5/q3i/xAzYIb9Qvu5bCuQF+8b/G6cyJyrQOYslUFhEj4D7t8+NtrcrULaKRrE0BIhogfkX5kHqvjPOYtiNPUMqV032xHQAUmtu8wd45300w7L3EH8mLLTOtroQPiTGM0OVKOz/zkA++UQjXHp1/SsXo5lxIO4CZzOUTUzZnSDTVAua4tNVXuM9jx2ANQIav56rWsn1cPfESc8S/T2/PsC3RUxF/gVxUl1Dxx3j+j0o1mL/xGfLOUKBHKHz49bNjNv1ajwJquDTumUBMsjMDDULsRlOs8n82RVR3rhDVNY1XlQNQjJV/BOtZrUF3bzAfGnzN6/3GbBZS1cNoYSRqjiRCwc9H++PRhpB9LfaW1PijEpOIZo3uwKKlWv7rJSdhBBs6SkauMnziJ5ij7pIVVHWv4Oqo7HTjBoowD80YwS74ivp04GJvL4AlFVr67BPjMEPShPunCFEJ2DpfIRkJJVU/vuWDEePj9tILwMy52Ro2QMRXxfXeNhKlB4OkkbB1YiUG/mrIK3kmR82W6Uc12oURSuLmE00byXdmS49x4b0hgJGjyqzKMLnyoQFN+hSYBXdwcaatHV9gemDohkq5TTuXRFoTbzHLl/+8fVn8XDCain4ERQY3ia+19Qr5q9IwbYZnPC0PpqgUOCxsIGhgs6FQPPB5wzvQ6Sv9qSlvYYr3enHKD5EdX1Psnbx18pYNVq5E4TuPMX7SjEmcIV/mdg6kfA== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7bd5c748-5c0d-4b33-d9a0-08db4d907140 X-MS-Exchange-CrossTenant-AuthSource: SN6PR10MB3022.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 May 2023 17:44:57.4888 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Pu6caMv+N1IXiYGAmcOi/fKGrx8BxenzDhgIMvcGGfWVisdREw1hjmQJW2mRr6MGWD/DPF7iAtDs5Lf7NvUj+w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR10MB6895 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-05-05_24,2023-05-05_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 malwarescore=0 adultscore=0 suspectscore=0 mlxlogscore=999 phishscore=0 mlxscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303200000 definitions=main-2305050146 X-Proofpoint-GUID: IWiT81jmCRPMkQ_TitPZY2Uewq18osnx X-Proofpoint-ORIG-GUID: IWiT81jmCRPMkQ_TitPZY2Uewq18osnx X-Bogosity: Ham, tests=bogofilter, spamicity=0.000001, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: When there is a single entry tree (range of 0-0 pointing to an entry), then ensure the limit is either 0-0 or 1-oo, depending on where the user walks. Ensure the correct node setting as well; either MAS_ROOT or MAS_NONE. Signed-off-by: Liam R. Howlett --- lib/maple_tree.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/lib/maple_tree.c b/lib/maple_tree.c index f060c71965c0d..914399519cf54 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -5022,24 +5022,25 @@ void *mas_walk(struct ma_state *mas) { void *entry; + if (mas_is_none(mas) || mas_is_paused(mas)) + mas->node = MAS_START; retry: entry = mas_state_walk(mas); - if (mas_is_start(mas)) + if (mas_is_start(mas)) { goto retry; - - if (mas_is_ptr(mas)) { + } else if (mas_is_none(mas)) { + mas->index = 0; + mas->last = ULONG_MAX; + } else if (mas_is_ptr(mas)) { if (!mas->index) { mas->last = 0; - } else { - mas->index = 1; - mas->last = ULONG_MAX; + return entry; } - return entry; - } - if (mas_is_none(mas)) { - mas->index = 0; + mas->index = 1; mas->last = ULONG_MAX; + mas->node = MAS_NONE; + return NULL; } return entry; From patchwork Fri May 5 17:42:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Liam R. Howlett" X-Patchwork-Id: 13232915 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1C466C77B7C for ; Fri, 5 May 2023 17:45:05 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8B67B6B0080; Fri, 5 May 2023 13:45:04 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 7F2146B009B; Fri, 5 May 2023 13:45:04 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5F8356B00A4; Fri, 5 May 2023 13:45:04 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by kanga.kvack.org (Postfix) with ESMTP id 123A56B0080 for ; Fri, 5 May 2023 13:45:04 -0400 (EDT) Received: from pps.filterd (m0246629.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 345HhDlx005916; Fri, 5 May 2023 17:45:03 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-type : content-transfer-encoding : mime-version; s=corp-2023-03-30; bh=Hn/nYxar4IbaGMbj+8NY36CmuEVAYXoKwA+YmgSPKBY=; b=FIZk3YcI8kszIVwhxxHtUjb2aN4UudYyZ1xYhAST25N5cwIhyIVdglor31xtexENAj7g eavAy62BBF/CNXhN3UMag0O4ER2Ob2BkoR4FoUN/6vyE2XWTg11Th+9DhorrteRO+D/6 kz8LpNzzcwQ1rkWeFLKDI+yawW3kM10IjWhUebpD+adJYUqwFhezRA+OXdaOIxHKKFEz Q0iuGWgM3/Fap/GXrxnCyhuHZiHHjDPubC24A7wKn2KBQ8zWsiXNrcH4KUMUCnCoYWOx 76kz4zIREELYUpvVdkQmzh7p5brtjPS/NpNqgIdzLxHPMiaresMEIC2buOfrkX8YKvSo Xg== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3q8u4awa0u-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 05 May 2023 17:45:03 +0000 Received: from pps.filterd (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 345GWSfs020775; Fri, 5 May 2023 17:45:02 GMT Received: from nam10-dm6-obe.outbound.protection.outlook.com (mail-dm6nam10lp2102.outbound.protection.outlook.com [104.47.58.102]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3q8spa5fve-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 05 May 2023 17:45:02 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZvOeC/n6kdWBA15jDJY0PEk+RKglmgZhDwqwVsevl+V4/Su3lUyRTJscDg7z/UNNWJStKvcEWHos+eRscB/IoBC58Bm45yE7UStSSSsnRfv4mRwiVignHE/WgUOA9NWKrfRA0Lfm2VaQ5sHUbBImRbPVX0gFNsPVHErgHLmEmJwYa771jNQ71x0veR9CdA1uGUqjhYk5BR3imXxx817CNYd2kd5GS63jYmWI2AqCUDZ5FqL30mAyzLQq6mcCunXvVnR4k/fi6NRdSn/AtRpS+7FJyFGRfYzyqOzqcDrPCL9cK2E1Vij4KI9c+8OAGA6wskfQxlSLQEx1RMnMR3C9eg== 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=Hn/nYxar4IbaGMbj+8NY36CmuEVAYXoKwA+YmgSPKBY=; b=cJEKos4OVTk8mLrCCHI01qmHPGSu0YreLaGuwX53Dzo7KPCcPxEo2/G5Gtj4uQCsxbES+MLIHW8A7zVMfiqjmuCrKDMQOTrtfguVmKZJVV31KlU4ZDnuk5Rlk0oAIWj7hK9c+vyuN2lZKBtk+5QUxh4Us0a28ay8YrDc1gDq7dgRl7c+eLQT1y6dzTxsD4h+UnrdiMdaPQLDv8f38R3eE64vT0a5d8FWqPaKKAWx3nHHxdxSpgJPckpDkS/iNsKIV2IWBUS2gS8344JJFY1i5sM3VRHAC9kYqmnMeZG5bPsaT1SB7Oeq/30CmneMLFRVtTM5lgAIt6AJi9YDWzcfGg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Hn/nYxar4IbaGMbj+8NY36CmuEVAYXoKwA+YmgSPKBY=; b=OGrvmqdjsCGFaIMFS6RFEBroNr4usdhRTW4HQSXrl5m+4TOCewila9hk4aXdO46YgHyWC8B9kraL3razBel/AzWro1z56vg/9k7Z8LTVrH6egXbCc7ofQ195zIFo2Rk/4k5ryuTTg7fh2AIEHDgZ2eMt6ksKlXZ+IfTeDil8B60= Received: from SN6PR10MB3022.namprd10.prod.outlook.com (2603:10b6:805:d8::25) by DS0PR10MB6895.namprd10.prod.outlook.com (2603:10b6:8:134::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6363.27; Fri, 5 May 2023 17:44:59 +0000 Received: from SN6PR10MB3022.namprd10.prod.outlook.com ([fe80::8bb9:2bb7:3930:b5da]) by SN6PR10MB3022.namprd10.prod.outlook.com ([fe80::8bb9:2bb7:3930:b5da%7]) with mapi id 15.20.6363.022; Fri, 5 May 2023 17:44:59 +0000 From: "Liam R. Howlett" To: Andrew Morton Cc: maple-tree@lists.infradead.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, "Liam R. Howlett" Subject: [PATCH v2 33/36] maple_tree: Update testing code for mas_{next,prev,walk} Date: Fri, 5 May 2023 13:42:01 -0400 Message-Id: <20230505174204.2665599-34-Liam.Howlett@oracle.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230505174204.2665599-1-Liam.Howlett@oracle.com> References: <20230505174204.2665599-1-Liam.Howlett@oracle.com> X-ClientProxiedBy: YT1P288CA0017.CANP288.PROD.OUTLOOK.COM (2603:10b6:b01::30) To SN6PR10MB3022.namprd10.prod.outlook.com (2603:10b6:805:d8::25) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN6PR10MB3022:EE_|DS0PR10MB6895:EE_ X-MS-Office365-Filtering-Correlation-Id: 7b0d458e-83e3-4b2f-88c3-08db4d90729a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: IuRMSR0OXhz8RrvBq2oiGflK9f/xd0qDnZCdu+dBgXEsD6Uzv6bHO13q83vV54zcgpSubqqJviBIsbRcc8qLp3Bl6gfRQMImGX6VIeGPEAwRrxXXGpJhy3Hm1pWgDlIcf9JWK6fr3fFBSCdOoGuRolz4XA4oWQu3C32RmlevCCzj3XFPmE0zXxXu0+qoxLh05K5B/y7yfw6+qzVj66fFPXA2tDmuAXSLeg8xaV0CGqny4wB7xt5kxwTACKohrno2QQs8n4BIMqPlRR5z+L2xBJXsMdS+Tfv+lqzw1ZO8wwSbk8m9EUPc2Rd53NiThsUJD4ij2brYZKtFm5q87xCyEzNBLGHtuGzQX2wx++PonG9xu5c2b+VvgsgguYjtamANhN7c8yntUwB8Lg7xKyuhuZOjjLH+JaZqCK/jZ2j+ULD6zhPkWka5sKtXPSVv4oFeSdvPUFEy56Ya3dKIDf5EUURqFeUmanZ0Pl0lgzE++1ZFgPuxavbaiLxBHWUaCY5/KnOkwLgua3GjB2miRFH6uDCK/S9ppnLM0HZdhQ3S3VxyKn7vpET9BCyzaBjnhq2g X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SN6PR10MB3022.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(136003)(376002)(346002)(396003)(39860400002)(366004)(451199021)(4326008)(6916009)(66946007)(66476007)(66556008)(41300700001)(8936002)(5660300002)(8676002)(6512007)(26005)(6506007)(15650500001)(1076003)(316002)(478600001)(6666004)(6486002)(107886003)(2906002)(30864003)(186003)(2616005)(83380400001)(86362001)(36756003)(38100700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?cSyfYjxdGYG8vuN227rk1FGH7sm1?= =?utf-8?q?4kaEDj4kCHF3ZadTWuZRC1kJpXabWxWSkXnC11wHELDsCvvW7rlAI/AdN5ellHMce?= =?utf-8?q?OOAmsQ2jZ4OGr75umJIH2Z5snkFza4pJlJ6rJZiywqkBYlYS5+17gBV3jT/sc4jD6?= =?utf-8?q?2VVQG3u2Vhp4DormZ/sDKiKKl52c6RwO+byOj92fOaib6QTqubho2H9RaFm/r8oyL?= =?utf-8?q?RLe427opxcN1vvGtMmpjQMR11bnfizdrirmMdxCdH9bASvrLSZHm5/Bxzhf4fL7yw?= =?utf-8?q?0F+d16a8b9swVagEIJyssvLKfcD1S8CU4VrJXlXKWkGGJj+CEHQCmuVGdjJ8NmXWu?= =?utf-8?q?ZDNoqWoEREAqUp4miUz3A0OZwfqdpNbOVrZ10vH3JDyaO/VZIAoCM0k+rJYYn55K7?= =?utf-8?q?c18tzX4mht4nGPyQFPxp0nUN3WluP6MjahbRmDDDCrmge/vyCeuhkJXhp+Bbsze0M?= =?utf-8?q?kaS1XVjYQ/5pDfMke3odvCqwstFG0uTHeOo0i/nE34mw0QbmnOGWT/8Hy1zOlKkeY?= =?utf-8?q?PGCyF6E4DkHcpecM8SUvOsjFeNOfncVAD8Ij/IP71aPyNYB8PxLiCXLzixaGYxJeD?= =?utf-8?q?0TkfpZXdp50nyD9Yn182qXytE4aLm+vdzdIlv4OQ7C3XCkQ04arVKWsFXbwsSwDzl?= =?utf-8?q?9+vnstymfVfwWCQrMMOkDHMYUJDykjFfwhkdWS4J3Xrb576Kynyev7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ntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: hO2miMZ7U9apwHGfcPX8SRzZ9Gd46SY6ZJty/eTDa9S+N+fzpAHvqPVByIY34zAGL3mbDwZlr/Dckm9whHEgXkDo714FFqMdDTcPQfn2nPDgurdCDOZTgvl3XQWo5YZ0PPyzKNeBwYkn9AkrUqgLo9e+/5vHEfFLxLlnlwgNrs9WMYXb7XjS9acoKRJJ34+QL95KQg+U7zXnPmHsgNSikpPMWnb9dbY7uh6ESRNdZgB2KldvdTRoRO2oRRUQoYrh1ZPZNxAjh0rouFJVjF145IcgAkxJojhcb8lWTtzCoUgr/9Q6czBiHz5IzWcpKY4pDPICKfy8wYxknqmxKlmO5/DkomB5wH70Ec/WA8xyQP0+RU1WUQ4JLpX4O3LxE0IkuPt1X12vcjjf//VL5JPhon2rT5/Llx3lbz7fdyJ3bBau3pENp1FGetb/206fID+84SuJnAUfyZky99s//1B2UPmvXy0rNJhf1M0xaLL2Oh9MnFMn+/djubtULfC7Aj9yodbFJoakyaKOx/tqo7IXhVaSTWtbLJSPLJCOpbi1CmyoBJnTZVN7WhG0qfnHZrj3OYy0uE6xP9JC9qi+crTSnPpAIxhCAqf0LuEEsLEE5/9tGyW+5ca6k7pxS+ouHJKOCA9g6BhPVlGu8gmvNavmS2uwgKa1e16NMn0aiGsQv6xaBiYKgG42FqxW5VmQGRsNGTYdJ/ciNxcvrFqJwA3hcBP5B4x5/yS6hS74j2IQJHZKwf9Ayvcj8CW4q/5IN0+tqGksZhGuW04aDucDn3FJycHEQZaKx2R27JhlNYRbA6hKDu8kxq2lq52/YHistTKYb2yQZS8iDvhhR5oPpTzKR3xcLos9WKOftEAvVqQo/0ysTvsGtxHHia6eo1WZk0csG3XZt+cxLZ2JShEdfogw6A== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7b0d458e-83e3-4b2f-88c3-08db4d90729a X-MS-Exchange-CrossTenant-AuthSource: SN6PR10MB3022.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 May 2023 17:44:59.8204 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 3engNdS7npSA2LJY9nDPZAJ/I81xM6K+Khxv842ovWcWtuofWlJqsjb5IowAlRmRLmpuWsMH/dV5ZTOW2G9GGA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR10MB6895 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-05-05_24,2023-05-05_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 mlxscore=0 spamscore=0 mlxlogscore=999 phishscore=0 malwarescore=0 adultscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303200000 definitions=main-2305050146 X-Proofpoint-GUID: w2KiPniuZ02oUGLGtcYhsRB9Z_swudA4 X-Proofpoint-ORIG-GUID: w2KiPniuZ02oUGLGtcYhsRB9Z_swudA4 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Now that the functions have changed the limits, update the testing of the maple tree to test these new settings. Signed-off-by: Liam R. Howlett --- lib/test_maple_tree.c | 638 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 633 insertions(+), 5 deletions(-) diff --git a/lib/test_maple_tree.c b/lib/test_maple_tree.c index 48bc4ad984c86..aa3c4fb9175ed 100644 --- a/lib/test_maple_tree.c +++ b/lib/test_maple_tree.c @@ -1321,6 +1321,7 @@ static noinline void __init check_root_expand(struct maple_tree *mt) mas_lock(&mas); mas_set(&mas, 3); ptr = mas_walk(&mas); + MT_BUG_ON(mt, mas.index != 0); MT_BUG_ON(mt, ptr != NULL); MT_BUG_ON(mt, mas.index != 0); MT_BUG_ON(mt, mas.last != ULONG_MAX); @@ -1390,7 +1391,7 @@ static noinline void __init check_root_expand(struct maple_tree *mt) mas_store_gfp(&mas, ptr, GFP_KERNEL); ptr = mas_next(&mas, ULONG_MAX); MT_BUG_ON(mt, ptr != NULL); - MT_BUG_ON(mt, (mas.index != 1) && (mas.last != ULONG_MAX)); + MT_BUG_ON(mt, (mas.index != ULONG_MAX) && (mas.last != ULONG_MAX)); mas_set(&mas, 1); ptr = mas_prev(&mas, 0); @@ -1799,7 +1800,6 @@ static noinline void __init check_iteration(struct maple_tree *mt) mas.index = 760; mas.last = 765; mas_store(&mas, val); - mas_next(&mas, ULONG_MAX); } i++; } @@ -2010,7 +2010,7 @@ static noinline void __init next_prev_test(struct maple_tree *mt) val = mas_next(&mas, ULONG_MAX); MT_BUG_ON(mt, val != NULL); - MT_BUG_ON(mt, mas.index != ULONG_MAX); + MT_BUG_ON(mt, mas.index != 0x7d6); MT_BUG_ON(mt, mas.last != ULONG_MAX); val = mas_prev(&mas, 0); @@ -2034,7 +2034,8 @@ static noinline void __init next_prev_test(struct maple_tree *mt) val = mas_prev(&mas, 0); MT_BUG_ON(mt, val != NULL); MT_BUG_ON(mt, mas.index != 0); - MT_BUG_ON(mt, mas.last != 0); + MT_BUG_ON(mt, mas.last != 5); + MT_BUG_ON(mt, mas.node != MAS_NONE); mas.index = 0; mas.last = 5; @@ -2046,7 +2047,7 @@ static noinline void __init next_prev_test(struct maple_tree *mt) val = mas_prev(&mas, 0); MT_BUG_ON(mt, val != NULL); MT_BUG_ON(mt, mas.index != 0); - MT_BUG_ON(mt, mas.last != 0); + MT_BUG_ON(mt, mas.last != 9); mas_unlock(&mas); mtree_destroy(mt); @@ -2749,6 +2750,629 @@ static noinline void __init check_empty_area_fill(struct maple_tree *mt) mt_set_non_kernel(0); } +/* + * Check MAS_START, MAS_PAUSE, active (implied), and MAS_NONE transitions. + * + * The table below shows the single entry tree (0-0 pointer) and normal tree + * with nodes. + * + * Function ENTRY Start Result index & last + * ┬ ┬ ┬ ┬ ┬ + * │ │ │ │ └─ the final range + * │ │ │ └─ The node value after execution + * │ │ └─ The node value before execution + * │ └─ If the entry exists or does not exists (DNE) + * └─ The function name + * + * Function ENTRY Start Result index & last + * mas_next() + * - after last + * Single entry tree at 0-0 + * ------------------------ + * DNE MAS_START MAS_NONE 1 - oo + * DNE MAS_PAUSE MAS_NONE 1 - oo + * DNE MAS_ROOT MAS_NONE 1 - oo + * when index = 0 + * DNE MAS_NONE MAS_ROOT 0 + * when index > 0 + * DNE MAS_NONE MAS_NONE 1 - oo + * + * Normal tree + * ----------- + * exists MAS_START active range + * DNE MAS_START active set to last range + * exists MAS_PAUSE active range + * DNE MAS_PAUSE active set to last range + * exists MAS_NONE active range + * exists active active range + * DNE active active set to last range + * + * Function ENTRY Start Result index & last + * mas_prev() + * - before index + * Single entry tree at 0-0 + * ------------------------ + * if index > 0 + * exists MAS_START MAS_ROOT 0 + * exists MAS_PAUSE MAS_ROOT 0 + * exists MAS_NONE MAS_ROOT 0 + * + * if index == 0 + * DNE MAS_START MAS_NONE 0 + * DNE MAS_PAUSE MAS_NONE 0 + * DNE MAS_NONE MAS_NONE 0 + * DNE MAS_ROOT MAS_NONE 0 + * + * Normal tree + * ----------- + * exists MAS_START active range + * DNE MAS_START active set to min + * exists MAS_PAUSE active range + * DNE MAS_PAUSE active set to min + * exists MAS_NONE active range + * DNE MAS_NONE MAS_NONE set to min + * any MAS_ROOT MAS_NONE 0 + * exists active active range + * DNE active active last range + * + * Function ENTRY Start Result index & last + * mas_find() + * - at index or next + * Single entry tree at 0-0 + * ------------------------ + * if index > 0 + * DNE MAS_START MAS_NONE 0 + * DNE MAS_PAUSE MAS_NONE 0 + * DNE MAS_ROOT MAS_NONE 0 + * DNE MAS_NONE MAS_NONE 0 + * if index == 0 + * exists MAS_START MAS_ROOT 0 + * exists MAS_PAUSE MAS_ROOT 0 + * exists MAS_NONE MAS_ROOT 0 + * + * Normal tree + * ----------- + * exists MAS_START active range + * DNE MAS_START active set to max + * exists MAS_PAUSE active range + * DNE MAS_PAUSE active set to max + * exists MAS_NONE active range + * exists active active range + * DNE active active last range (max < last) + * + * Function ENTRY Start Result index & last + * mas_find_rev() + * - at index or before + * Single entry tree at 0-0 + * ------------------------ + * if index > 0 + * exists MAS_START MAS_ROOT 0 + * exists MAS_PAUSE MAS_ROOT 0 + * exists MAS_NONE MAS_ROOT 0 + * if index == 0 + * DNE MAS_START MAS_NONE 0 + * DNE MAS_PAUSE MAS_NONE 0 + * DNE MAS_NONE MAS_NONE 0 + * DNE MAS_ROOT MAS_NONE 0 + * + * Normal tree + * ----------- + * exists MAS_START active range + * DNE MAS_START active set to min + * exists MAS_PAUSE active range + * DNE MAS_PAUSE active set to min + * exists MAS_NONE active range + * exists active active range + * DNE active active last range (min > index) + * + * Function ENTRY Start Result index & last + * mas_walk() + * - Look up index + * Single entry tree at 0-0 + * ------------------------ + * if index > 0 + * DNE MAS_START MAS_ROOT 1 - oo + * DNE MAS_PAUSE MAS_ROOT 1 - oo + * DNE MAS_NONE MAS_ROOT 1 - oo + * DNE MAS_ROOT MAS_ROOT 1 - oo + * if index == 0 + * exists MAS_START MAS_ROOT 0 + * exists MAS_PAUSE MAS_ROOT 0 + * exists MAS_NONE MAS_ROOT 0 + * exists MAS_ROOT MAS_ROOT 0 + * + * Normal tree + * ----------- + * exists MAS_START active range + * DNE MAS_START active range of NULL + * exists MAS_PAUSE active range + * DNE MAS_PAUSE active range of NULL + * exists MAS_NONE active range + * DNE MAS_NONE active range of NULL + * exists active active range + * DNE active active range of NULL + */ + +#define mas_active(x) (((x).node != MAS_ROOT) && \ + ((x).node != MAS_START) && \ + ((x).node != MAS_PAUSE) && \ + ((x).node != MAS_NONE)) +static noinline void __init check_state_handling(struct maple_tree *mt) +{ + MA_STATE(mas, mt, 0, 0); + void *entry, *ptr = (void *) 0x1234500; + void *ptr2 = &ptr; + void *ptr3 = &ptr2; + + /* Check MAS_ROOT First */ + mtree_store_range(mt, 0, 0, ptr, GFP_KERNEL); + + mas_lock(&mas); + /* prev: Start -> none */ + entry = mas_prev(&mas, 0); + MT_BUG_ON(mt, entry != NULL); + MT_BUG_ON(mt, mas.node != MAS_NONE); + + /* prev: Start -> root */ + mas_set(&mas, 10); + entry = mas_prev(&mas, 0); + MT_BUG_ON(mt, entry != ptr); + MT_BUG_ON(mt, mas.index != 0); + MT_BUG_ON(mt, mas.last != 0); + MT_BUG_ON(mt, mas.node != MAS_ROOT); + + /* prev: pause -> root */ + mas_set(&mas, 10); + mas_pause(&mas); + entry = mas_prev(&mas, 0); + MT_BUG_ON(mt, entry != ptr); + MT_BUG_ON(mt, mas.index != 0); + MT_BUG_ON(mt, mas.last != 0); + MT_BUG_ON(mt, mas.node != MAS_ROOT); + + /* next: start -> none */ + mas_set(&mas, 0); + entry = mas_next(&mas, ULONG_MAX); + MT_BUG_ON(mt, mas.index != 1); + MT_BUG_ON(mt, mas.last != ULONG_MAX); + MT_BUG_ON(mt, entry != NULL); + MT_BUG_ON(mt, mas.node != MAS_NONE); + + /* next: start -> none */ + mas_set(&mas, 10); + entry = mas_next(&mas, ULONG_MAX); + MT_BUG_ON(mt, mas.index != 1); + MT_BUG_ON(mt, mas.last != ULONG_MAX); + MT_BUG_ON(mt, entry != NULL); + MT_BUG_ON(mt, mas.node != MAS_NONE); + + /* find: start -> root */ + mas_set(&mas, 0); + entry = mas_find(&mas, ULONG_MAX); + MT_BUG_ON(mt, entry != ptr); + MT_BUG_ON(mt, mas.index != 0); + MT_BUG_ON(mt, mas.last != 0); + MT_BUG_ON(mt, mas.node != MAS_ROOT); + + /* find: root -> none */ + entry = mas_find(&mas, ULONG_MAX); + MT_BUG_ON(mt, entry != NULL); + MT_BUG_ON(mt, mas.index != 1); + MT_BUG_ON(mt, mas.last != ULONG_MAX); + MT_BUG_ON(mt, mas.node != MAS_NONE); + + /* find: none -> none */ + entry = mas_find(&mas, ULONG_MAX); + MT_BUG_ON(mt, entry != NULL); + MT_BUG_ON(mt, mas.index != 1); + MT_BUG_ON(mt, mas.last != ULONG_MAX); + MT_BUG_ON(mt, mas.node != MAS_NONE); + + /* find: start -> none */ + mas_set(&mas, 10); + entry = mas_find(&mas, ULONG_MAX); + MT_BUG_ON(mt, entry != NULL); + MT_BUG_ON(mt, mas.index != 1); + MT_BUG_ON(mt, mas.last != ULONG_MAX); + MT_BUG_ON(mt, mas.node != MAS_NONE); + + /* find_rev: none -> root */ + entry = mas_find_rev(&mas, 0); + MT_BUG_ON(mt, entry != ptr); + MT_BUG_ON(mt, mas.index != 0); + MT_BUG_ON(mt, mas.last != 0); + MT_BUG_ON(mt, mas.node != MAS_ROOT); + + /* find_rev: start -> root */ + mas_set(&mas, 0); + entry = mas_find_rev(&mas, 0); + MT_BUG_ON(mt, entry != ptr); + MT_BUG_ON(mt, mas.index != 0); + MT_BUG_ON(mt, mas.last != 0); + MT_BUG_ON(mt, mas.node != MAS_ROOT); + + /* find_rev: root -> none */ + entry = mas_find_rev(&mas, 0); + MT_BUG_ON(mt, entry != NULL); + MT_BUG_ON(mt, mas.index != 0); + MT_BUG_ON(mt, mas.last != 0); + MT_BUG_ON(mt, mas.node != MAS_NONE); + + /* find_rev: none -> none */ + entry = mas_find_rev(&mas, 0); + MT_BUG_ON(mt, entry != NULL); + MT_BUG_ON(mt, mas.index != 0); + MT_BUG_ON(mt, mas.last != 0); + MT_BUG_ON(mt, mas.node != MAS_NONE); + + /* find_rev: start -> root */ + mas_set(&mas, 10); + entry = mas_find_rev(&mas, 0); + MT_BUG_ON(mt, entry != ptr); + MT_BUG_ON(mt, mas.index != 0); + MT_BUG_ON(mt, mas.last != 0); + MT_BUG_ON(mt, mas.node != MAS_ROOT); + + /* walk: start -> none */ + mas_set(&mas, 10); + entry = mas_walk(&mas); + MT_BUG_ON(mt, entry != NULL); + MT_BUG_ON(mt, mas.index != 1); + MT_BUG_ON(mt, mas.last != ULONG_MAX); + MT_BUG_ON(mt, mas.node != MAS_NONE); + + /* walk: pause -> none*/ + mas_set(&mas, 10); + mas_pause(&mas); + entry = mas_walk(&mas); + MT_BUG_ON(mt, entry != NULL); + MT_BUG_ON(mt, mas.index != 1); + MT_BUG_ON(mt, mas.last != ULONG_MAX); + MT_BUG_ON(mt, mas.node != MAS_NONE); + + /* walk: none -> none */ + mas.index = mas.last = 10; + entry = mas_walk(&mas); + MT_BUG_ON(mt, entry != NULL); + MT_BUG_ON(mt, mas.index != 1); + MT_BUG_ON(mt, mas.last != ULONG_MAX); + MT_BUG_ON(mt, mas.node != MAS_NONE); + + /* walk: none -> none */ + entry = mas_walk(&mas); + MT_BUG_ON(mt, entry != NULL); + MT_BUG_ON(mt, mas.index != 1); + MT_BUG_ON(mt, mas.last != ULONG_MAX); + MT_BUG_ON(mt, mas.node != MAS_NONE); + + /* walk: start -> root */ + mas_set(&mas, 0); + entry = mas_walk(&mas); + MT_BUG_ON(mt, entry != ptr); + MT_BUG_ON(mt, mas.index != 0); + MT_BUG_ON(mt, mas.last != 0); + MT_BUG_ON(mt, mas.node != MAS_ROOT); + + /* walk: pause -> root */ + mas_set(&mas, 0); + mas_pause(&mas); + entry = mas_walk(&mas); + MT_BUG_ON(mt, entry != ptr); + MT_BUG_ON(mt, mas.index != 0); + MT_BUG_ON(mt, mas.last != 0); + MT_BUG_ON(mt, mas.node != MAS_ROOT); + + /* walk: none -> root */ + mas.node = MAS_NONE; + entry = mas_walk(&mas); + MT_BUG_ON(mt, entry != ptr); + MT_BUG_ON(mt, mas.index != 0); + MT_BUG_ON(mt, mas.last != 0); + MT_BUG_ON(mt, mas.node != MAS_ROOT); + + /* walk: root -> root */ + entry = mas_walk(&mas); + MT_BUG_ON(mt, entry != ptr); + MT_BUG_ON(mt, mas.index != 0); + MT_BUG_ON(mt, mas.last != 0); + MT_BUG_ON(mt, mas.node != MAS_ROOT); + + /* walk: root -> none */ + mas_set(&mas, 10); + entry = mas_walk(&mas); + MT_BUG_ON(mt, entry != NULL); + MT_BUG_ON(mt, mas.index != 1); + MT_BUG_ON(mt, mas.last != ULONG_MAX); + MT_BUG_ON(mt, mas.node != MAS_NONE); + + /* walk: none -> root */ + mas.index = mas.last = 0; + entry = mas_walk(&mas); + MT_BUG_ON(mt, entry != ptr); + MT_BUG_ON(mt, mas.index != 0); + MT_BUG_ON(mt, mas.last != 0); + MT_BUG_ON(mt, mas.node != MAS_ROOT); + + mas_unlock(&mas); + + /* Check when there is an actual node */ + mtree_store_range(mt, 0, 0, NULL, GFP_KERNEL); + mtree_store_range(mt, 0x1000, 0x1500, ptr, GFP_KERNEL); + mtree_store_range(mt, 0x2000, 0x2500, ptr2, GFP_KERNEL); + mtree_store_range(mt, 0x3000, 0x3500, ptr3, GFP_KERNEL); + + mas_lock(&mas); + + /* next: start ->active */ + mas_set(&mas, 0); + entry = mas_next(&mas, ULONG_MAX); + MT_BUG_ON(mt, entry != ptr); + MT_BUG_ON(mt, mas.index != 0x1000); + MT_BUG_ON(mt, mas.last != 0x1500); + MT_BUG_ON(mt, !mas_active(mas)); + + /* next: pause ->active */ + mas_set(&mas, 0); + mas_pause(&mas); + entry = mas_next(&mas, ULONG_MAX); + MT_BUG_ON(mt, entry != ptr); + MT_BUG_ON(mt, mas.index != 0x1000); + MT_BUG_ON(mt, mas.last != 0x1500); + MT_BUG_ON(mt, !mas_active(mas)); + + /* next: none ->active */ + mas.index = mas.last = 0; + mas.offset = 0; + mas.node = MAS_NONE; + entry = mas_next(&mas, ULONG_MAX); + MT_BUG_ON(mt, entry != ptr); + MT_BUG_ON(mt, mas.index != 0x1000); + MT_BUG_ON(mt, mas.last != 0x1500); + MT_BUG_ON(mt, !mas_active(mas)); + + /* next:active ->active */ + entry = mas_next(&mas, ULONG_MAX); + MT_BUG_ON(mt, entry != ptr2); + MT_BUG_ON(mt, mas.index != 0x2000); + MT_BUG_ON(mt, mas.last != 0x2500); + MT_BUG_ON(mt, !mas_active(mas)); + + /* next:active -> active out of range*/ + entry = mas_next(&mas, 0x2999); + MT_BUG_ON(mt, entry != NULL); + MT_BUG_ON(mt, mas.index != 0x2501); + MT_BUG_ON(mt, mas.last != 0x2fff); + MT_BUG_ON(mt, !mas_active(mas)); + + /* Continue after out of range*/ + entry = mas_next(&mas, ULONG_MAX); + MT_BUG_ON(mt, entry != ptr3); + MT_BUG_ON(mt, mas.index != 0x3000); + MT_BUG_ON(mt, mas.last != 0x3500); + MT_BUG_ON(mt, !mas_active(mas)); + + /* next:active -> active out of range*/ + entry = mas_next(&mas, ULONG_MAX); + MT_BUG_ON(mt, entry != NULL); + MT_BUG_ON(mt, mas.index != 0x3501); + MT_BUG_ON(mt, mas.last != ULONG_MAX); + MT_BUG_ON(mt, !mas_active(mas)); + + /* next: none -> active, skip value at location */ + mas_set(&mas, 0); + entry = mas_next(&mas, ULONG_MAX); + mas.node = MAS_NONE; + mas.offset = 0; + entry = mas_next(&mas, ULONG_MAX); + MT_BUG_ON(mt, entry != ptr2); + MT_BUG_ON(mt, mas.index != 0x2000); + MT_BUG_ON(mt, mas.last != 0x2500); + MT_BUG_ON(mt, !mas_active(mas)); + + /* prev:active ->active */ + entry = mas_prev(&mas, 0); + MT_BUG_ON(mt, entry != ptr); + MT_BUG_ON(mt, mas.index != 0x1000); + MT_BUG_ON(mt, mas.last != 0x1500); + MT_BUG_ON(mt, !mas_active(mas)); + + /* prev:active -> active out of range*/ + entry = mas_prev(&mas, 0); + MT_BUG_ON(mt, entry != NULL); + MT_BUG_ON(mt, mas.index != 0); + MT_BUG_ON(mt, mas.last != 0x0FFF); + MT_BUG_ON(mt, !mas_active(mas)); + + /* prev: pause ->active */ + mas_set(&mas, 0x3600); + entry = mas_prev(&mas, 0); + MT_BUG_ON(mt, entry != ptr3); + mas_pause(&mas); + entry = mas_prev(&mas, 0); + MT_BUG_ON(mt, entry != ptr2); + MT_BUG_ON(mt, mas.index != 0x2000); + MT_BUG_ON(mt, mas.last != 0x2500); + MT_BUG_ON(mt, !mas_active(mas)); + + /* prev:active -> active out of range*/ + entry = mas_prev(&mas, 0x1600); + MT_BUG_ON(mt, entry != NULL); + MT_BUG_ON(mt, mas.index != 0x1501); + MT_BUG_ON(mt, mas.last != 0x1FFF); + MT_BUG_ON(mt, !mas_active(mas)); + + /* prev: active ->active, continue*/ + entry = mas_prev(&mas, 0); + MT_BUG_ON(mt, entry != ptr); + MT_BUG_ON(mt, mas.index != 0x1000); + MT_BUG_ON(mt, mas.last != 0x1500); + MT_BUG_ON(mt, !mas_active(mas)); + + /* find: start ->active */ + mas_set(&mas, 0); + entry = mas_find(&mas, ULONG_MAX); + MT_BUG_ON(mt, entry != ptr); + MT_BUG_ON(mt, mas.index != 0x1000); + MT_BUG_ON(mt, mas.last != 0x1500); + MT_BUG_ON(mt, !mas_active(mas)); + + /* find: pause ->active */ + mas_set(&mas, 0); + mas_pause(&mas); + entry = mas_find(&mas, ULONG_MAX); + MT_BUG_ON(mt, entry != ptr); + MT_BUG_ON(mt, mas.index != 0x1000); + MT_BUG_ON(mt, mas.last != 0x1500); + MT_BUG_ON(mt, !mas_active(mas)); + + /* find: start ->active on value */; + mas_set(&mas, 1200); + entry = mas_find(&mas, ULONG_MAX); + MT_BUG_ON(mt, entry != ptr); + MT_BUG_ON(mt, mas.index != 0x1000); + MT_BUG_ON(mt, mas.last != 0x1500); + MT_BUG_ON(mt, !mas_active(mas)); + + /* find:active ->active */ + entry = mas_find(&mas, ULONG_MAX); + MT_BUG_ON(mt, entry != ptr2); + MT_BUG_ON(mt, mas.index != 0x2000); + MT_BUG_ON(mt, mas.last != 0x2500); + MT_BUG_ON(mt, !mas_active(mas)); + + + /* find:active -> active (NULL)*/ + entry = mas_find(&mas, 0x2700); + MT_BUG_ON(mt, entry != NULL); + MT_BUG_ON(mt, mas.index != 0x2501); + MT_BUG_ON(mt, mas.last != 0x2FFF); + MT_BUG_ON(mt, !mas_active(mas)); + + /* find: none ->active */ + entry = mas_find(&mas, 0x5000); + MT_BUG_ON(mt, entry != ptr3); + MT_BUG_ON(mt, mas.index != 0x3000); + MT_BUG_ON(mt, mas.last != 0x3500); + MT_BUG_ON(mt, !mas_active(mas)); + + /* find:active -> active (NULL) end*/ + entry = mas_find(&mas, ULONG_MAX); + MT_BUG_ON(mt, entry != NULL); + MT_BUG_ON(mt, mas.index != 0x3501); + MT_BUG_ON(mt, mas.last != ULONG_MAX); + MT_BUG_ON(mt, !mas_active(mas)); + + /* find_rev: active (END) ->active */ + entry = mas_find_rev(&mas, 0); + MT_BUG_ON(mt, entry != ptr3); + MT_BUG_ON(mt, mas.index != 0x3000); + MT_BUG_ON(mt, mas.last != 0x3500); + MT_BUG_ON(mt, !mas_active(mas)); + + /* find_rev:active ->active */ + entry = mas_find_rev(&mas, 0); + MT_BUG_ON(mt, entry != ptr2); + MT_BUG_ON(mt, mas.index != 0x2000); + MT_BUG_ON(mt, mas.last != 0x2500); + MT_BUG_ON(mt, !mas_active(mas)); + + /* find_rev: pause ->active */ + mas_pause(&mas); + entry = mas_find_rev(&mas, 0); + MT_BUG_ON(mt, entry != ptr); + MT_BUG_ON(mt, mas.index != 0x1000); + MT_BUG_ON(mt, mas.last != 0x1500); + MT_BUG_ON(mt, !mas_active(mas)); + + /* find_rev:active -> active */ + entry = mas_find_rev(&mas, 0); + MT_BUG_ON(mt, entry != NULL); + MT_BUG_ON(mt, mas.index != 0); + MT_BUG_ON(mt, mas.last != 0x0FFF); + MT_BUG_ON(mt, !mas_active(mas)); + + /* find_rev: start ->active */ + mas_set(&mas, 0x1200); + entry = mas_find_rev(&mas, 0); + MT_BUG_ON(mt, entry != ptr); + MT_BUG_ON(mt, mas.index != 0x1000); + MT_BUG_ON(mt, mas.last != 0x1500); + MT_BUG_ON(mt, !mas_active(mas)); + + /* mas_walk start ->active */ + mas_set(&mas, 0x1200); + entry = mas_walk(&mas); + MT_BUG_ON(mt, entry != ptr); + MT_BUG_ON(mt, mas.index != 0x1000); + MT_BUG_ON(mt, mas.last != 0x1500); + MT_BUG_ON(mt, !mas_active(mas)); + + /* mas_walk start ->active */ + mas_set(&mas, 0x1600); + entry = mas_walk(&mas); + MT_BUG_ON(mt, entry != NULL); + MT_BUG_ON(mt, mas.index != 0x1501); + MT_BUG_ON(mt, mas.last != 0x1fff); + MT_BUG_ON(mt, !mas_active(mas)); + + /* mas_walk pause ->active */ + mas_set(&mas, 0x1200); + mas_pause(&mas); + entry = mas_walk(&mas); + MT_BUG_ON(mt, entry != ptr); + MT_BUG_ON(mt, mas.index != 0x1000); + MT_BUG_ON(mt, mas.last != 0x1500); + MT_BUG_ON(mt, !mas_active(mas)); + + /* mas_walk pause -> active */ + mas_set(&mas, 0x1600); + mas_pause(&mas); + entry = mas_walk(&mas); + MT_BUG_ON(mt, entry != NULL); + MT_BUG_ON(mt, mas.index != 0x1501); + MT_BUG_ON(mt, mas.last != 0x1fff); + MT_BUG_ON(mt, !mas_active(mas)); + + /* mas_walk none -> active */ + mas_set(&mas, 0x1200); + mas.node = MAS_NONE; + entry = mas_walk(&mas); + MT_BUG_ON(mt, entry != ptr); + MT_BUG_ON(mt, mas.index != 0x1000); + MT_BUG_ON(mt, mas.last != 0x1500); + MT_BUG_ON(mt, !mas_active(mas)); + + /* mas_walk none -> active */ + mas_set(&mas, 0x1600); + mas.node = MAS_NONE; + entry = mas_walk(&mas); + MT_BUG_ON(mt, entry != NULL); + MT_BUG_ON(mt, mas.index != 0x1501); + MT_BUG_ON(mt, mas.last != 0x1fff); + MT_BUG_ON(mt, !mas_active(mas)); + + /* mas_walk active -> active */ + mas.index = 0x1200; + mas.last = 0x1200; + mas.offset = 0; + entry = mas_walk(&mas); + MT_BUG_ON(mt, entry != ptr); + MT_BUG_ON(mt, mas.index != 0x1000); + MT_BUG_ON(mt, mas.last != 0x1500); + MT_BUG_ON(mt, !mas_active(mas)); + + /* mas_walk active -> active */ + mas.index = 0x1600; + mas.last = 0x1600; + entry = mas_walk(&mas); + MT_BUG_ON(mt, entry != NULL); + MT_BUG_ON(mt, mas.index != 0x1501); + MT_BUG_ON(mt, mas.last != 0x1fff); + MT_BUG_ON(mt, !mas_active(mas)); + + mas_unlock(&mas); +} + static DEFINE_MTREE(tree); static int __init maple_tree_seed(void) { @@ -3010,6 +3634,10 @@ static int __init maple_tree_seed(void) mtree_destroy(&tree); + mt_init_flags(&tree, MT_FLAGS_ALLOC_RANGE); + check_state_handling(&tree); + mtree_destroy(&tree); + #if defined(BENCH) skip: #endif From patchwork Fri May 5 17:42:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Liam R. Howlett" X-Patchwork-Id: 13232916 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 05B83C77B75 for ; Fri, 5 May 2023 17:45:07 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3FCE36B009B; Fri, 5 May 2023 13:45:06 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 383916B00A4; Fri, 5 May 2023 13:45:06 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1FD146B00A5; Fri, 5 May 2023 13:45:06 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by kanga.kvack.org (Postfix) with ESMTP id E35616B009B for ; Fri, 5 May 2023 13:45:05 -0400 (EDT) Received: from pps.filterd (m0333521.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 345Hh67X027907; Fri, 5 May 2023 17:45:05 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=Gf/8bP5/7Y00ZHHg7g7YJwogjH7fdNlLAETXhQj1hlo=; b=JRz8UCeQg/lp+oANpW7FqbF0I9zKGRTP8PtjhoNtTIrlyhIVNR9nDw6e3x13bAxDfh3C /rQ7Y//Uil0gTmSZZhUqdeP4Y/Bl2IB6+D94SO+gybzPza1koN3dnMYATK+BjzQ2qqWF VYNc17/7Hhel51DxW4VGUv/6TjxftC6krX3NSBRehUeTatszuLy/Q9X1oh1OnStTL3PR sM5XfZ8r5KCV+FfCb74R9UECDXPDEslGZ5iN4dKoUQbA0VnNclkRt9epdVl4n7VB4Evx MfjWtWHcfkVKfqiLOmlXOmF5043SfG1vPDtWwBRu3YoLM4lilPLpEvOSPoPru8s+yDB5 2g== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3q8t5fwf4y-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 05 May 2023 17:45:05 +0000 Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 345HeiVr027286; Fri, 5 May 2023 17:45:03 GMT Received: from nam10-dm6-obe.outbound.protection.outlook.com (mail-dm6nam10lp2108.outbound.protection.outlook.com [104.47.58.108]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3q8spgf0g1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 05 May 2023 17:45:03 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gtQmmrVgCPCqKBM/Mwk0PMjZ4mj1giX5kBX+WRDUWzd17cJ/lF9F9u3wErvKVPGiQpnqUfXfyqchO2rRhHicy1QYLbCXFkzDVpi0v1XQkBLCXOc9lViS2XOGJPcLGjhe3gvHULPxumyAyFdxM2uGqYnBeuXdzKWLkZYDlgRfsTn+xXiIsrY3Dgg3mVljJ385p3K1DKU9Iqo5rsQe7v8n7cU55m5yW273fxGsJLzcUU1u4cbLTaJjX79VrCIQKl+8GDcd9z0i34R6mU1JpzzzrEA8QPyCQLspropNckd51ajsnADKQQC+oSSo/ANi395HhkEQnu8CORc3PIVVbUUbRw== 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=Gf/8bP5/7Y00ZHHg7g7YJwogjH7fdNlLAETXhQj1hlo=; b=JDam4/Y2nmBCagYrejtejkk++tVJ1cEikUm9d20H5bVrpvhFA+Ne8XwKF8nWyKznCf6Uu5Kcb8TrYMywdc5OUQmqFfoqeWfewGzVXXLy+2CU+htpG4+K9s/kcgUi9yIsziVDOcDY24wvMiOE1P2TsApzMLGUTv8jvHpEyUJorjw767MgNjhY36yT5YImSgvCEIeL+gnHpoXTbX4YwudbzxilXqYLOxR96em0I1LcQ1E1kLwu5uOS+G2J3LteiFN5HRvBM1mLsEXd2YYq73ayeXLGtPCImv4q5Ag92i2mY+bx5GpW94Pp8STjKWjMTiXPJmHl3SJ9JwvxO73K1sdhEQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Gf/8bP5/7Y00ZHHg7g7YJwogjH7fdNlLAETXhQj1hlo=; b=nnW2+GK9jfDBDBrdAOcai6p7rIUKiwAg/sp9DMWUJA/hZYNGv7w3a6pOrybqConfkVvPsoBxEsCsYBgc3tS6U/S3dcClDPH83rxcSvR0OK+Cw+xGKwKd+vH+xy7Jc4ORk3SCRrA1LB04bNv6JsSNduHaaINWivlUEiDRWTKzSik= Received: from SN6PR10MB3022.namprd10.prod.outlook.com (2603:10b6:805:d8::25) by DS0PR10MB6895.namprd10.prod.outlook.com (2603:10b6:8:134::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6363.27; Fri, 5 May 2023 17:45:01 +0000 Received: from SN6PR10MB3022.namprd10.prod.outlook.com ([fe80::8bb9:2bb7:3930:b5da]) by SN6PR10MB3022.namprd10.prod.outlook.com ([fe80::8bb9:2bb7:3930:b5da%7]) with mapi id 15.20.6363.022; Fri, 5 May 2023 17:45:01 +0000 From: "Liam R. Howlett" To: Andrew Morton Cc: maple-tree@lists.infradead.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, "Liam R. Howlett" Subject: [PATCH v2 34/36] mm: Add vma_iter_{next,prev}_range() to vma iterator Date: Fri, 5 May 2023 13:42:02 -0400 Message-Id: <20230505174204.2665599-35-Liam.Howlett@oracle.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230505174204.2665599-1-Liam.Howlett@oracle.com> References: <20230505174204.2665599-1-Liam.Howlett@oracle.com> X-ClientProxiedBy: YT4PR01CA0179.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:110::11) To SN6PR10MB3022.namprd10.prod.outlook.com (2603:10b6:805:d8::25) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN6PR10MB3022:EE_|DS0PR10MB6895:EE_ X-MS-Office365-Filtering-Correlation-Id: 082fbb04-6bb0-4457-c301-08db4d9073de X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: c4R1AYLlO2HIgmEZqnf6EzgJ2slSoP+fJ3gcm4v4I5zjNahTUQIqLbKy08M64xj24dLofEoRAtZLuCtcTxBX73XgCwinddV2kFxpdRtjyFmhQ0FaA4LW6Pz0qZzLG0Au4iv+fohUYyQtr5B672p3hVHVQ7IuYGbqAW2hPI85XtaCjyz3tSytF9265yofPBIeqZx8y3sk+Yo0BJ738p9upQipcSiH+zrwXqK2o/SW/s4sXooRu3v2Ng+kER+Fh/RgdELQPTXx0zo3C2vLdCaSsfG23xlk5vroT7kZP/sZPhhWlgNa1nlQFQq+Ik8JMUntEbgg9ja4HO7Y5PihaVmcNkMwiZyiUUaFyTu9DFiwRLdz6sSqOdBChvB8PyUy4gwBVVoxnc7pDTZ8QuPK/DRZi3ozEN8k2o17AYUITZjfZOmCg3x+ULaWbURdC66kAEg2av65327ZW6+laWkMlh28yo1ETeW4auNr0FTaf3n3h4qq2x8gSRO3UMb3Q9EQgdlvas7YsQBhmL7r3K2SFTu4JAd928hDqHzEAPG5OJHK8exfFZrDe60iG8m/No68lGDX X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SN6PR10MB3022.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(136003)(376002)(346002)(396003)(39860400002)(366004)(451199021)(4326008)(6916009)(66946007)(66476007)(66556008)(41300700001)(8936002)(5660300002)(8676002)(6512007)(26005)(6506007)(1076003)(316002)(478600001)(6486002)(107886003)(2906002)(4744005)(186003)(2616005)(86362001)(36756003)(38100700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: BbyZIeChTMfgnh+JEP5QMP+A6jyQlk0gCGp3nBzGw04/W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PEKbc1gm/20qfwUqTRgI5lbsp70qicr/Mb92YqEzA6MvDhVSh1DlqwZhLUAJWMZ1241c/GpcnrWc21eS4BYOdMLZJ2MBwyquJWG2IzeSFf+3fK6rAH7p85pRmN1uAuhBZvLUog3KGhPXSxZxYJI1otGOjy4oEv8DYYuY3nxQQCOR7BuryjOdd3amIRzOuhKseNFc0W8+UIslKWVjLFAFE29hzN51lXz2shw/NcVdannzLG+nf1Fi9ch+hH0VJHnqH3N8Kflp3oOiCIpN/w/Yykdhdr7dNvg776A2zRRzF7V2KmD31jQ4BqZfBK4uMi3WP4rUeQh3qmXaujzHhru40ShtUhMKcAMubADKa0LgMsFOhsl1de2dqfldjUEzMl9y3FVF0qRwMF4k5O0Z1DjFsSpQ== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 082fbb04-6bb0-4457-c301-08db4d9073de X-MS-Exchange-CrossTenant-AuthSource: SN6PR10MB3022.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 May 2023 17:45:01.8708 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Vz0jVpvArXQLicDcSg4mtkr4MZ8mq+xZQfljJ7ZYQxMLbcNK99eXgS/uYna9+kzEPe+COd7z2z564Ab7FXZnyQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR10MB6895 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-05-05_24,2023-05-05_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 bulkscore=0 spamscore=0 mlxlogscore=999 mlxscore=0 adultscore=0 phishscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303200000 definitions=main-2305050146 X-Proofpoint-GUID: LpADf2_88rKRJitF-YBJwtTXkl8Bpr2S X-Proofpoint-ORIG-GUID: LpADf2_88rKRJitF-YBJwtTXkl8Bpr2S X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Signed-off-by: Liam R. Howlett --- include/linux/mm.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/include/linux/mm.h b/include/linux/mm.h index 7b1d4e7393efd..1bd731a2972b0 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -866,11 +866,24 @@ static inline struct vm_area_struct *vma_next(struct vma_iterator *vmi) return mas_find(&vmi->mas, ULONG_MAX); } +static inline +struct vm_area_struct *vma_iter_next_range(struct vma_iterator *vmi) +{ + return mas_next_range(&vmi->mas, ULONG_MAX); +} + + static inline struct vm_area_struct *vma_prev(struct vma_iterator *vmi) { return mas_prev(&vmi->mas, 0); } +static inline +struct vm_area_struct *vma_iter_prev_range(struct vma_iterator *vmi) +{ + return mas_prev_range(&vmi->mas, 0); +} + static inline unsigned long vma_iter_addr(struct vma_iterator *vmi) { return vmi->mas.index; From patchwork Fri May 5 17:42:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Liam R. Howlett" X-Patchwork-Id: 13232917 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id E9C51C77B7F for ; Fri, 5 May 2023 17:45:08 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id BEB806B00A4; Fri, 5 May 2023 13:45:07 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B9A506B00A5; Fri, 5 May 2023 13:45:07 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A3B706B00A7; Fri, 5 May 2023 13:45:07 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by kanga.kvack.org (Postfix) with ESMTP id 7D5C16B00A4 for ; Fri, 5 May 2023 13:45:07 -0400 (EDT) Received: from pps.filterd (m0333520.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 345HhJg4031569; Fri, 5 May 2023 17:45:07 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=u3/zRZ2Ucre2QO+L/T9jdiOBbG7EEf5W3yMRjcw71Ww=; b=pahWxCYrDEghRdMvwuhc+oWonYau/MONHHYd+bJdqo7ybGwMiZUhWCDLJxTGd7TyGgS0 QQ5mwBrUDjNWXXBTnDawDt59++4l/vsWHKZ1bDcYAbwtCAaWO+fQNvUnCjFh3KoG2orq gX2DnQ0naMFNmsMd+OsUWNRiBDAe3Im/prVN5VE3CaME1SVmQBXamugQA2q/lDE5A+go TeaaSvh9hLwOGEb6rkxYNaU4SKVECBysnhew9TyiZHh+G3EELAP7LKaRzmSBc/MeXSEj bBcigmbGNiFs0qUwNCafQjmqk7rO9Tn4VYIUfwv+KRg/YDQTsbhME7T46HGmXJ2rDU8u dw== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3q8u9d5nfw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 05 May 2023 17:45:07 +0000 Received: from pps.filterd (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 345HbPfx020743; Fri, 5 May 2023 17:45:06 GMT Received: from nam11-dm6-obe.outbound.protection.outlook.com (mail-dm6nam11lp2174.outbound.protection.outlook.com [104.47.57.174]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3q8spa5fx9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 05 May 2023 17:45:06 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KmuSEypsqfAs1PYm/IsoZjKGl901Q98PCmAmAxhw6hc6E6mN9Di1XJWOVCsUpN15hVbTsu4yevAaHp5OBg9XcF84OuH6OxPMh/HaaqUPUT0vcWfzmRcqr4FJS8GLi8DaeaxYvdvdi/0FYizU4UmhBBcy1XdgHGLTIg1os5yDA6ocKSqPIU6Hr7lz01z+Ddw4s1N/LxZCALROpuOcdhx/wde0NKdDaTWSm5BhHjeDDBjZvBjVJv5T61yJFCNDm3YDG9K71ji5YqX+lWi0uzpGhFFgQwKofjVIKCoAQvwVnIPbM/3u1IehBIdgl1A4nrSACv8N4y6ZTXEYtPvv6dFvwg== 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=u3/zRZ2Ucre2QO+L/T9jdiOBbG7EEf5W3yMRjcw71Ww=; b=ZjeFbgHO3i8G15kei40q3cYZoaCOFKkRsPtpzW54MBJ1Rqggeh+iruftNcEBWD3GK7/NYJG6CyBb2F0uTYVkr3MG29FoCbQIVeBm4YJRmt19GsV+++bZH1s0/Qit4tRnwQKHqlvm2MCIcLqG1K0kUSX8aKHh0hgIMg3Ra/ToefbPFJycqa1KvbaBpMcOp6naxLBTRl6U/L2r555jN8Va5qwUNnFrJjsd3ZUQ1I3XUJQ+brMWWRVj8jebmaj4ono+9ERinR5Sv1Agmt1cGKbAvRSmKg9hNJUaM6LtxllaUo6MUFlAv4IzOsPTxZL/vIaKdMdOGlpJMWkqccv146sqFg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=u3/zRZ2Ucre2QO+L/T9jdiOBbG7EEf5W3yMRjcw71Ww=; b=pdoLd2FxxApSZYhwUQnjaFvg0rNxx8NvVID9ew0lvBWJoRQL+RC+kZCC9ipeqZtKSFpb6sMtWSYYNoKulkugmIgn6f+DrWKSQuLWDleF203RGpe5EwGWNZh3sfDCxXkY1KhkXi09uPLx3wkCwn85xz/69WIKwh6LZJeKp/aIyWU= Received: from SN6PR10MB3022.namprd10.prod.outlook.com (2603:10b6:805:d8::25) by DS0PR10MB6895.namprd10.prod.outlook.com (2603:10b6:8:134::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6363.27; Fri, 5 May 2023 17:45:03 +0000 Received: from SN6PR10MB3022.namprd10.prod.outlook.com ([fe80::8bb9:2bb7:3930:b5da]) by SN6PR10MB3022.namprd10.prod.outlook.com ([fe80::8bb9:2bb7:3930:b5da%7]) with mapi id 15.20.6363.022; Fri, 5 May 2023 17:45:03 +0000 From: "Liam R. Howlett" To: Andrew Morton Cc: maple-tree@lists.infradead.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, "Liam R. Howlett" Subject: [PATCH v2 35/36] mm: Avoid rewalk in mmap_region Date: Fri, 5 May 2023 13:42:03 -0400 Message-Id: <20230505174204.2665599-36-Liam.Howlett@oracle.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230505174204.2665599-1-Liam.Howlett@oracle.com> References: <20230505174204.2665599-1-Liam.Howlett@oracle.com> X-ClientProxiedBy: YT4PR01CA0217.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:eb::22) To SN6PR10MB3022.namprd10.prod.outlook.com (2603:10b6:805:d8::25) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN6PR10MB3022:EE_|DS0PR10MB6895:EE_ X-MS-Office365-Filtering-Correlation-Id: 90d52c6f-f213-4703-2630-08db4d90750b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 6NDbfh/N8FwETHtRuNOPMuOCAGZB4jKWH/H4JWJZ0y25XNXE3ZRmLZ9LNSw/VAqCDQNE1ml7Dzzo/LZ+5FlNiX7/jzCyguK6FGFjcpg2V0sGDaNdIqygEy5Th9I7jTLlr06dFnKxdVZiKFi4p/rwnw1EPaQ5YH1Ql0LROQfY7xsvhoPs3+stwG0+CHgxK+UArLEc7GWT0VCuqFF/GfvDxxTubnMvNCu+9h0nv1j4HjpeTsYSRZtFYK7ERWkgqddSHQePlU7WIxX5qYfB9UfIWJgYthPtu3kuZbuFrSId+9SaxCUGsHJDCFVVDPIKWZ2+FxR7hiw2fBpHKm/QJJ9wbsOA+Y3lyILmYxdQn+IW95wEfhNnpd6hyhYyFB6RHR99MFKfpeHS8XGp1zGw/+iPxdNAbU8ivRtUIt1NTurFL5VJKSUF0yyofbDY60vQf+ZptFRfat5dzVsuIP6HjjBmA9MdnGBJbdhidlHn/+8SFaqSgMxzBUwze3+X0zJW2Ee77Lugmve4XoqogT3Vce3KsLDwZO+nGF/qoa541M7C/7zCwOzBWfD6pCOlFfRV12uL X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SN6PR10MB3022.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(136003)(376002)(346002)(396003)(39860400002)(366004)(451199021)(4326008)(6916009)(66946007)(66476007)(66556008)(41300700001)(8936002)(5660300002)(8676002)(6512007)(26005)(6506007)(1076003)(316002)(478600001)(6486002)(107886003)(2906002)(4744005)(186003)(2616005)(83380400001)(86362001)(36756003)(38100700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: K0W0bMN9Hvu3dRa9sKpvMLCm8zuL7eudMrQSSivwHjzUBUqlwvTYLndjjAg1dkIsYUU+KMfKWUff6hM2U1l0k3hG4v+roHun6aEIYOXRmLeFVNNKiidiUPDkqabGDQKt3LOO45lW/kJJIxTD4XqjUC1ogpRjG9P0JXXkO6HaZi/k4PI0qQOqucppnUG5kB1BKthImL9qnie7GW6SMnzlkmKFgUdEWxCzuex9D6XnFrfnWY4oBzmejAUAFOZLB7qK8iXMXaPeCYPMGuWcLdCU7i8Mu6s2C3Yf6dY4vdjDWhGKKkAMqSz8xu4KL2LD0kxvE6sHATjuUtny7JjMAY4nkDgUYQrpDsmg+V9jo7iPSA9uE8alsjyGYZnpt0K9/ObCjes9Y269QBCpEX2JW0q60pe6Hg+HWN0niGaKX9LN/onQZHKupEgbA4SFHh3HEg/0rO+CJjvdJ1RMrVPsQX1dU16CDLfy824nlG3pOA4bMIZkaxSwVoIGZQwRQujwnbgVIA3BFbj05ivYQ4ZwCFt+LhlftJgTMsoLj+AxnWGlw2xtK90Yz1iPvZKJckPbjQ1WKwZCr22KT4sJtTyojEXRReCX4tvtq7Irvnd7E+yo77A8ya+/sxLITpPjEhPUl22kpL/NjVXEk4UbWckjRZ5EW/S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61I64BXxHb6bNbRUU8fzKLf7wZ4bfrYVHkpBee2bamENbkDsZZHWUpW1Wg/mB8CuW6nkzBZn1VWNFrGgJqFOCSuRkMngV/gt4utLODKedqLo30XzlWXO/Nma/tAbxgZ9CJdTKzMK6Q0XVUm2L6o7dzmrqLW4dzWbjqDSHJIQxP8GaomVewLR2A4dNnFrhzCGUonRA/jURsYhohvX7pFDtmqdyADWq7IOvGFmCkRoZ2SCp/g4yVC/dGlozefpaXNlqWgDNcZ/+PT5M4wIrlJ1bkuo7AktFSImNYRoYYkdayTpV6QeOmZf958j0Hfgl7/374H85X/6viZnGkdGnVGmZVKJpPYtO0Dfw9igP8dC89A/mrPFCg3k8j6KVoKbvCt2mbNxHILWSqEskwoJOfwFciw454gTfo5EPuzj0h4gEetxc+iEMFcupdb/4hmw9Y+ldaY5SoMVAXPa060hBtMs88G+GHLrJVjd1uoYMYdKSF6z/MA45NqVSd8YrwuMYNcNmNEYXLgXzcydZhMpbQIFa9B1cbkwRguMpCkztjHKiP3MEaGZc4txquUrfciJJoOJQ6OhIkabnHPYJ12vjztF76kAlPy9AqstG7iLcCc2C6zGL2wPA4j+q2skdkh/2hXNIJkt5kE1ODlF80sSB6IfBzm3Sx1c7Nwjp+8TCaZgxaOBG3Pr3thODT/JVorOfVJtmyF9Cm4USObNNoitr5M1NnmoQPoYlB8PAbYgiDU8JkWmPKCfRJx1U6XJuAAYXbote+nRXdM4+eppK91rFaQ0SK2u0FaomE4IhldT+xUtZ1SX/RLS6zhBrbQbDEBIdoQDnT8yBzWQl0vmcBkD9bFKAnLqXGnjtEcfJ0zHG/kZUm3aQ== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 90d52c6f-f213-4703-2630-08db4d90750b X-MS-Exchange-CrossTenant-AuthSource: SN6PR10MB3022.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 May 2023 17:45:03.8633 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: JRClgog24OKVIgUIw1SH6RKc9vZsdle0y+U/69l6hd3PJp82tecUa1D08sTDIqjMy6N1vJ08piuEjHOJ+5VuFg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR10MB6895 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-05-05_24,2023-05-05_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 mlxscore=0 spamscore=0 mlxlogscore=999 phishscore=0 malwarescore=0 adultscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303200000 definitions=main-2305050146 X-Proofpoint-GUID: h5WrWaYfPzxYfDORltX47ft6PN3He3lk X-Proofpoint-ORIG-GUID: h5WrWaYfPzxYfDORltX47ft6PN3He3lk X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: If the iterator has moved to the previous entry, then step forward one range, back to the gap. Signed-off-by: Liam R. Howlett --- mm/mmap.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/mm/mmap.c b/mm/mmap.c index 1602c854133a4..71733953ff836 100644 --- a/mm/mmap.c +++ b/mm/mmap.c @@ -2636,6 +2636,9 @@ unsigned long mmap_region(struct file *file, unsigned long addr, } cannot_expand: + if (prev) + vma_iter_next_range(&vmi); + /* * Determine the object being mapped and call the appropriate * specific mapper. the address has already been validated, but From patchwork Fri May 5 17:42:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Liam R. Howlett" X-Patchwork-Id: 13232918 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 02D9AC7EE24 for ; Fri, 5 May 2023 17:45:11 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8DD2D6B00A8; Fri, 5 May 2023 13:45:10 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 7EFA26B00A9; Fri, 5 May 2023 13:45:10 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5CDB6900002; Fri, 5 May 2023 13:45:10 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by kanga.kvack.org (Postfix) with ESMTP id 3A5026B00A7 for ; Fri, 5 May 2023 13:45:10 -0400 (EDT) Received: from pps.filterd (m0246630.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 345HhO1x014853; Fri, 5 May 2023 17:45:10 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=J7UkLuHdvcaGWiHLptvkrDXfaS4Mp30zRMqlVBCT7Tc=; b=xWpisiGXJN8A+8B+DdW/hE77xzaLER8/Npbv9ncSIH00EXpr7vnYTgYQ3A1C/fO33Cu/ KsgTzqm2zS/MbpvvQCGcJBkfL3y7EJyUfueGmCrn78N/KLenEnAPTJwLAFXOqjBhaOTb 13AQpcSiUpVfEdbzIvYtqGOtIWMyJOHmDxOfxghTyENe10V7hdikziGPnQkz7SNSWb/L AO2F+/0ZVVfK5IxrGCz3Lepb8c0xqEk6KbNZAo9bjaKRjOqid71FhwKCjgCcvzUBNqXp oPJqCFbtF6qJiOsWUSMIbrFKM4hb+D46GkmID+I+caH+CURsjf+5XTfAg38xxiRtlI1e Bg== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3q8snede0v-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 05 May 2023 17:45:09 +0000 Received: from pps.filterd (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 345H3l03020835; Fri, 5 May 2023 17:45:08 GMT Received: from nam10-dm6-obe.outbound.protection.outlook.com (mail-dm6nam10lp2100.outbound.protection.outlook.com [104.47.58.100]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3q8spa5g04-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 05 May 2023 17:45:08 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OhlqnNhVKoiHhdXYYL5MHsm6nD988kJd14f9IwI9NMLtIyPbNr/wvkDNO13LdSyxZWh8GC14YuHdku62+4Q0MBg02tnS6HI7W51rTgQsaz2mFwhRGf+Gps1Y0g0HZ9KtHiapoSopcGJgHipO/u5Pd5QjHg8UpaLsWdJFk/IY1tvuZqTsHcZ6xbn72ScoEl4/ulDWlNfACXGSCn1BumcLnhXbQR5Idp/A0rlmTNEjn6xpKSjkZlsPV1+GWabKZQgbNsokpoK1bGlpjKXDe5Kfsmlo9GpbRd/iTn9UawAJhE6rVKMk+Aw4r5vOzp/7KZMfZPPC5dEDttIaTVGgBcq43w== 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=J7UkLuHdvcaGWiHLptvkrDXfaS4Mp30zRMqlVBCT7Tc=; b=ZTp2qzHAJ5jicvC7UZ9hjS0ML0806KfmO7MBA0BbE8H4fgdjynWUXbgL1yZ8y+sQubV4/bM20hXKNhPCghWDQdqbr//vcLwWgNDA0MgHlm4eGogVdpiOq+58Hl1JRHoV56E+5DhcelVkCSRKuB0Czf39d0Njng2BzEhT6kFP/yUM2L3zr9YAqu1kEgv5owEGfN0dhz2GtxRR5qqq8ee9m30r5ziXhtg2tGeMVccNupP65uoWGi1Xlfya+a2/79zy2cSqBe1g6woZEyBBHmPj3hqJhrb9nCOKNxPj6N9oGfvUbW/hgNyJJ8kxRykvycjf+WL/lCiKwLrfP78UbZzdeQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=J7UkLuHdvcaGWiHLptvkrDXfaS4Mp30zRMqlVBCT7Tc=; b=CuFSRmdk0UTXfxInglWL8jlshFG2DX7grQHcHw4hG0lCn3j75jKP4B7wOwHjmIqBE86658xmCkSQVO6Xz6j5vThfQ4wrl/8LcrSD5A7gJZk56iM/dCFvBWejWGDfqzoRSF9Gz7/Sp99ar2G0yyUwJCV+k17z1wM8+Hcxc2RxG5A= Received: from SN6PR10MB3022.namprd10.prod.outlook.com (2603:10b6:805:d8::25) by DS0PR10MB6895.namprd10.prod.outlook.com (2603:10b6:8:134::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6363.27; Fri, 5 May 2023 17:45:06 +0000 Received: from SN6PR10MB3022.namprd10.prod.outlook.com ([fe80::8bb9:2bb7:3930:b5da]) by SN6PR10MB3022.namprd10.prod.outlook.com ([fe80::8bb9:2bb7:3930:b5da%7]) with mapi id 15.20.6363.022; Fri, 5 May 2023 17:45:06 +0000 From: "Liam R. Howlett" To: Andrew Morton Cc: maple-tree@lists.infradead.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, "Liam R. Howlett" Subject: [PATCH v2 36/36] maple_tree: Add gap to check_alloc_rev_range() testcase Date: Fri, 5 May 2023 13:42:04 -0400 Message-Id: <20230505174204.2665599-37-Liam.Howlett@oracle.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230505174204.2665599-1-Liam.Howlett@oracle.com> References: <20230505174204.2665599-1-Liam.Howlett@oracle.com> X-ClientProxiedBy: YT4PR01CA0254.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:10f::9) To SN6PR10MB3022.namprd10.prod.outlook.com (2603:10b6:805:d8::25) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN6PR10MB3022:EE_|DS0PR10MB6895:EE_ X-MS-Office365-Filtering-Correlation-Id: ff2a7743-cb70-4045-e3da-08db4d9076b5 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: U1i11IAxjS0dbbgp+qvFwil9gsXxsx9t/9esfwEQU5M7jkUpbrfM5d6zZRRY7i/IDVGVEF6HiSLx+/b9qGmLpvhgn+5/LrHJ20+gXiR3gmt/L4zBrzt5yaLyBLvue/FZ/3jw3owY5RAJhHlOj51g1rMmPmQG4UOsYKv+XAb5U02poGXHJ7+DkYCwMz4RHpSl0IbputFfVuYRM0aRtPnaoR+kC/PC3pxPCYgq9A6uOL9Cy3rs1Hzt/ZGqQtQDJZ9otIvkGrYm3OsrFG0ZNZMpNdIF+s1Uo54zov/l7ltC/Reh1RyPqlLkz6YrgRijjDbDDx21ljwIigx+j3i9m63NzqQbhFPLGXi4ah+/6+ymQYTWiXr754ZjDuyHn3M2CPiZwz8qJli1HsmHfaKkuRH0GQMR+q3OBoDAtNeFwDBtkKXF+ernWeZ07ECK30C8ZuePOIPvuS8e9eX5hLYXpg8pQelDP2GzSCCLK2VtU5n9C4OcmVBBnKf8lpaXHPxaRSl/B0yUh0QOn7hk45LOgeGB1jgg4qby5XL3QahT/e/KWJR5xHnfQE3qpByn9JrAo7lZ X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SN6PR10MB3022.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(136003)(376002)(346002)(396003)(39860400002)(366004)(451199021)(4326008)(6916009)(66946007)(66476007)(66556008)(41300700001)(8936002)(5660300002)(8676002)(6512007)(26005)(6506007)(1076003)(316002)(478600001)(6486002)(107886003)(2906002)(4744005)(186003)(2616005)(83380400001)(86362001)(36756003)(38100700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: iUTX8M45225crYePR+vVW12jJQ3pZOIrfpc0FWhmzrnBERre2WYl0oIcRDbyvUu65kX/K7P+NJFm5buIVMzITOypYQ10l/e7FuvvzUp5oaNOZYFZYMbqVGDpWYq/xM2So2s8gre+0Py5AtYkscr4pCkWGehI6oswGW8FbZG47homcvuJR0WMDWPO1m8imuygJQ2AeaVyrL7y2bXnS7z1TgrcUEK74CYaQner+Rk4/nlG8wN1W1Yumjcd/VAFPc3j+8/fle6U8iL2Jxo77X30x16Pe2kUIsrh8czOo7j4VA0c8uB18ycbwGud+tvOF+lGwKcX+IXNJi8BSihriFSVI7IvLhYZyH9bCpEK0sos/QRuaLxMAYqAAm43+3TvTGNEPjsd9lOnq329in43T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iF16OsoPDhhyt5alESEumOzZSZSSI9LU05xj5Krg9Vpg4t8ZNHhA5Yz+AvagxLg== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: ff2a7743-cb70-4045-e3da-08db4d9076b5 X-MS-Exchange-CrossTenant-AuthSource: SN6PR10MB3022.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 May 2023 17:45:06.6536 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: J+jD7XPy6dYNN2EDUF1N974x55tSHxH9cP2XQlW4PDMKB6y5uH2gqlwKygTuuJUm8TuK82VfrD3XV2adhP/z7w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR10MB6895 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-05-05_24,2023-05-05_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 mlxscore=0 spamscore=0 mlxlogscore=999 phishscore=0 malwarescore=0 adultscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303200000 definitions=main-2305050146 X-Proofpoint-GUID: r0wcokRVHZ-TWRhIRkSC69oXu0je7ljP X-Proofpoint-ORIG-GUID: r0wcokRVHZ-TWRhIRkSC69oXu0je7ljP X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Signed-off-by: Liam R. Howlett --- lib/test_maple_tree.c | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/test_maple_tree.c b/lib/test_maple_tree.c index aa3c4fb9175ed..9939be34e516e 100644 --- a/lib/test_maple_tree.c +++ b/lib/test_maple_tree.c @@ -804,6 +804,7 @@ static noinline void __init check_alloc_rev_range(struct maple_tree *mt) mt_set_non_kernel(1); mtree_erase(mt, 34148798727); /* create a deleted range. */ + mtree_erase(mt, 34148798725); check_mtree_alloc_rrange(mt, 0, 34359052173, 210253414, 34148798725, 0, mt);