From patchwork Thu Oct 12 15:52: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: 13419405 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 21CB3CDB46E for ; Thu, 12 Oct 2023 15:53:10 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 880C88D0130; Thu, 12 Oct 2023 11:53:09 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 8313E8D0002; Thu, 12 Oct 2023 11:53:09 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6A9AB8D0130; Thu, 12 Oct 2023 11:53:09 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 5B2608D0002 for ; Thu, 12 Oct 2023 11:53:09 -0400 (EDT) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 261C74064C for ; Thu, 12 Oct 2023 15:53:09 +0000 (UTC) X-FDA: 81337253298.06.5AF6DB6 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by imf05.hostedemail.com (Postfix) with ESMTP id CEF32100022 for ; Thu, 12 Oct 2023 15:53:04 +0000 (UTC) Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-03-30 header.b="SfeLiC/Z"; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=veEHJxGF; dmarc=pass (policy=none) header.from=oracle.com; arc=pass ("microsoft.com:s=arcselector9901:i=1"); spf=pass (imf05.hostedemail.com: domain of liam.howlett@oracle.com designates 205.220.177.32 as permitted sender) smtp.mailfrom=liam.howlett@oracle.com ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1697125984; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:in-reply-to: references:dkim-signature; bh=uo0J0y2wZAfyRd007HRZ9GIgmtHcn9aktFI0QEMNW7Y=; b=Pek5uCo9398XN5jevxjVUVaTDrxWafK7peaMJvd/eYPyLbvsYkkU716KTS8V4aXi2jp7iu s1DxcoYiomwKEfl/vYjSRvrl72hvT5tlW5npZ5A+vj+IkBUiMsK1BvQHwqrgYYJh895RQn qUF5M2RNpneh+Vx3sBp+KqVhccdBCc8= ARC-Authentication-Results: i=2; imf05.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-03-30 header.b="SfeLiC/Z"; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=veEHJxGF; dmarc=pass (policy=none) header.from=oracle.com; arc=pass ("microsoft.com:s=arcselector9901:i=1"); spf=pass (imf05.hostedemail.com: domain of liam.howlett@oracle.com designates 205.220.177.32 as permitted sender) smtp.mailfrom=liam.howlett@oracle.com ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1697125984; a=rsa-sha256; cv=pass; b=KoSa97lk1+wHQSWVjEvVRAvy0tIACrN8LSGdC/ApAoFIKLU/f4UPRQHxjUJFglk0tHAxNg r5rvYtz6zKu/qQqiwv6/8HgJ7yUqcUOmeweI1H3oqPFI8jNjOZ+RwlSKpS7T0puPjp/Gfn 5vZDVStTcQc2vND4nPBZfFZ4rKIvheY= 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 39CFhvft015593; Thu, 12 Oct 2023 15:52:43 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=uo0J0y2wZAfyRd007HRZ9GIgmtHcn9aktFI0QEMNW7Y=; b=SfeLiC/ZhcmPKEc6vrt6xg0Cs85TACRqL/Zg2lrXbADJVRgj6ZxV6yuekak4HkAFV714 0Jlj6jMwETa+o3y7boomlXkuv5mfgTY5LYtsNF8H8lGJ+gZMKNqncCNTf9xJ46vUjV7R anQfn5e5VQV8JON954K5lT+F73fb6OG3WkSbE75k3GV+ZxhQ00bnHNJyGz7jKcwbgAaM A6j/Zq3VbXKc3ieNwuBRYXzanX5Pe1rkw00xI4bihK+sNcfnhrPjry1DiiyFuUhlxrqw oVP27sw0Dp8wdZ/ku5ib8ZrUDama6tJXMVSKnuwjjIjbVt6W0s8zfLkddPSlyFrMmPFv Dg== Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3tmh8a0geq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 12 Oct 2023 15:52:42 +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 39CEXmBO037414; Thu, 12 Oct 2023 15:52:42 GMT Received: from nam02-sn1-obe.outbound.protection.outlook.com (mail-sn1nam02lp2040.outbound.protection.outlook.com [104.47.57.40]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3tmfhtn74w-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 12 Oct 2023 15:52:42 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IBo3+dpiKv8nPAsk02jlEMrfhqA+e4lX3VeJLoOC9brUHFnQn6oRyLP73F69aOn0piZjfRcGlLza2QHg8tWL8Hew4s1wOlCsu0VRfnVhSFoZwJGwfHVIGM+DitWxNon62BR/KSI7byKd19oUdMKZHAf2feO4gk1ktbNC5LZJAlNfxq+wsj5h+IwLgp5kAzIAVDHllCEKu5/zk2I/e55VyrfkHXGOR9rYmPxSdVmLyyFuHEakZya8cf/3QFGdq1yOJ5Zaj4UQ5JsWzQ0n+GZaT5HIlVjGnfBU0owjDIRI8iMmtkOf4X3+3Dl3PPMQMYFmcS5PETW3pDIgiVoOdqJznQ== 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=uo0J0y2wZAfyRd007HRZ9GIgmtHcn9aktFI0QEMNW7Y=; b=igeTrJy6L0CLkfWWlp2zPb4UoTkI6y7sdfbQ1uL1t/TQTP9UnOEcogoGiiKAc0qgEWhVnXObzcWpf8NIixWt11hdTrWV44efMkvkwboCXDVUsrwvAUjoIi8e+1trdDaKSo/CQ4Xw/z3fa7RjHbdP1nyYrzcD4tP5l/5S7utwWRQyqHKykXrzY6nePdHs3EV1d1iSv0vdeg2LjsvFsMECpHrWrcpVe9cKoYzh5XgZ5eH3KkV+9nakxrZ9ZwhG9VZFBV1A/cOVmC+OLJux0hjn1xccioNgEteIPtiik0UWgg4F56xA1BXYTjkhLweymZAGzto0lPsls61T92AEOoiUbg== 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=uo0J0y2wZAfyRd007HRZ9GIgmtHcn9aktFI0QEMNW7Y=; b=veEHJxGF/BN1aFuPIPwpYIon+3L2lGY1307xKov0Mseiq8rWSLIo8mHZvr0CfXjR3y63sWW9gsIogJ3sh50pKWoJputYtI4yie46ZWCKJQ6wWIIbPVsUSgOPOkzgrAU2fDH/fpW6haT1cV6d/MfZi7Znh8io9fWE35dOxwbaG0E= Received: from SN6PR10MB3022.namprd10.prod.outlook.com (2603:10b6:805:d8::25) by CO1PR10MB4724.namprd10.prod.outlook.com (2603:10b6:303:96::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6863.45; Thu, 12 Oct 2023 15:52:39 +0000 Received: from SN6PR10MB3022.namprd10.prod.outlook.com ([fe80::8979:3e3f:c3e0:8dfa]) by SN6PR10MB3022.namprd10.prod.outlook.com ([fe80::8979:3e3f:c3e0:8dfa%4]) with mapi id 15.20.6863.043; Thu, 12 Oct 2023 15:52: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" , stable@vger.kernel.org, jason.sim@samsung.com, Peng Zhang Subject: [PATCH v2] maple_tree: Add GFP_KERNEL to allocations in mas_expected_entries() Date: Thu, 12 Oct 2023 11:52:33 -0400 Message-Id: <20231012155233.2272446-1-Liam.Howlett@oracle.com> X-Mailer: git-send-email 2.40.1 X-ClientProxiedBy: YT3PR01CA0019.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:86::33) To SN6PR10MB3022.namprd10.prod.outlook.com (2603:10b6:805:d8::25) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN6PR10MB3022:EE_|CO1PR10MB4724:EE_ X-MS-Office365-Filtering-Correlation-Id: 6677da88-ea5d-48fc-c226-08dbcb3b4342 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 92Cta4dkLMxlEhUfD6lY9UHsT1k9eh/oNXo4zsM0rVYy70lMlu19dXuw7oFW3cdURU4ACu/1HtMX+XsQRlIT3LQdWE96LCtkLTM7UJs+cMZz2Vp1Q8jhw/Mw0llqBnkFzhFQcB3LobTSTXT/Cp1V27NwJDXblGhMsd3TLnOao4lblkIaqWbNGHlBtaCJeGOs2IKJ4mMMeKkabE1eo758w+ETkhhnUuHL9f8zmf2LpZArgL+IR6WOZ+F0dthfhzBDEHU4tkuqRteMSrcp0xOTQI2nlFDopQFCAh7UDOFpdBfto4/GvgtpxqxJ4sC4aNjpT3Q/ekGvJMGpA80FxA5s+jf0XxGag6n6m6Ap1XlLRmkU+LTHV9xsAm7eQqT61j51rUrNVG/4gGLjyL+vMzcJKsfZFcV/7OfMiYnNflIchMSE0wBP83nziDRfTQETl6IsIT076Fr+HX5Nvja5/MS3AoX68xdGvn6jOCmjve99Xcq21X8e8SgMM3tkqb+jpZZg89m6Dkhh+AGPCoNHj+/kZOnOgps7tNniuYIfNlqo6wZ6/L2TI3FBjcjDI1UW4+TrSjv6e9fmx5PDp2UB1n5ebg== 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:(13230031)(376002)(346002)(39860400002)(396003)(366004)(136003)(230922051799003)(186009)(451199024)(64100799003)(1800799009)(6506007)(6666004)(6512007)(2616005)(38100700002)(36756003)(86362001)(26005)(1076003)(83380400001)(66476007)(6916009)(316002)(66556008)(54906003)(66946007)(2906002)(8676002)(8936002)(4326008)(5660300002)(41300700001)(966005)(6486002)(478600001);DIR:OUT;SFP:1101; X-MS-Exchange-Anti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hOCGp/m/ONjNjbY9R+Sh039Yeh2NdkTBGToFu/4h6cJmzAnDzAIi/Kilh6VA2kw8ubdzcW22a5ymiXAEX4uEhAORZrdgMks/0Mcw/sHIlHSVGkQ67/T28Q7mEdjxRE6oHi1bCDAFtp8zqhWzgTITNH/RUZTMi5Fzc2TZJ8a5jRjzqdH2lvZeuCwUL1A/CfiEqzadmv1+uxBQwUuqx0zBlhxzs3PVR7Mu1IxIm3QyvvPsTy2PCLfMGuKDSQQ9CV8n4zZifb2y1Xi7g6pTTguUhacFcMTGG6KdW7Z/olPZNdXxluhPF0RDB5+Qp7inhehkRfJ2ES5CQwMTnl9pP6po34heUrjvUGj9WroB+N8Thl76nAiH83YdzWq7m9DHZmvD6YTw75P8nF91iWBMPXtLRTnK8cgsakpVufoww9KyUCbsKE0I4xW8k0khDH3qZALhYrKqlowABkwweTn9EKaKgR5rBKdczvc93bkxzLqyJUk7WU1sqDz06Q9oPaSJP4w+mt8OKm6pRYgmYU1YQd9FsmJ8fcwwqOAQ== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6677da88-ea5d-48fc-c226-08dbcb3b4342 X-MS-Exchange-CrossTenant-AuthSource: SN6PR10MB3022.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Oct 2023 15:52:39.5962 (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: EgDW/lgeceNFZL1ZJLl/9hUMKu9FIlEnGZRF5Yo/8kXfDv0S3qSlqQduczM+hVWJM0VBc/8m4tYgIcjrSJjtJA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO1PR10MB4724 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.980,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-10-12_05,2023-10-12_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 malwarescore=0 spamscore=0 mlxlogscore=999 adultscore=0 phishscore=0 bulkscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2309180000 definitions=main-2310120131 X-Proofpoint-GUID: Y7pBMi26s3NDRxkK_xDaqW5w8dDAJUoq X-Proofpoint-ORIG-GUID: Y7pBMi26s3NDRxkK_xDaqW5w8dDAJUoq X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: CEF32100022 X-Stat-Signature: zzha9rjutstrqnkchm4piqg7jwtnhkua X-Rspam-User: X-HE-Tag: 1697125984-50210 X-HE-Meta: U2FsdGVkX19+5qN/uYyFvw8TJ6QW35lBL3NKVCSXfLeZL0Wp1qXBncw/Jzqs8dk6mxkiXM4VwwUIoPB3VC6p5T1WOhamDdi82QRsMYtm0cjvlJrL4IBGIynbyfIk+8x6JyzpPEIQlbeTAfrKrH6a7hsYTTJsCB0D6dA7RQWzQ5cKBGKPN/xOZSGuikVYMAaRG5Gu7TOiDvHX1Tw4qMHluMywBffRD3ZiN7tdcNt3utu/6tBBXGaXFGquMWexHivpVyEar3uMJozpVU8fOFg5uGL5sIKzMW5UmBEwQE8dUDzmgu3r7QoAfbfAVXviZctbkfX5ZO3oeIHEzrXTEblt/fdbAK4vdhFaYdVGeiwjamsVr2N4mGAbSX+cE40brIr2VyMCb2efGPSrDo7CPnBd+ZSuZpvBEK4f0TmINM/j098ScvP3TpZlGNsZ3FJc4JxWa7Ehl7v1LPXs5gnQqqoZ4dy46+z5bxpeYQ56+5qHStPIx9w6VcNsroN6TVtiEOwlVo7J0XVTUkizjkQ0XVoj0Frv+pMJHC6nfGMaqunlT49abA8aNGSyib7RatJylXt0vp/Ov7IqojiL92IE2JqduTM8qW0vco0bO1ToxKpTxiFs5ISsP3LcqfRwyRJn2hZcpBHCM3EdLX2L5RrlpB2Q0ZApBI/x7Z7jPXj+2adMHtLNYezQ7RMXR2RriFTQc+41in4ZWRR+6Ipkt3Hvn/ViTzaeAKSJoNbqxsUmFsIj+5J3ptuogA3Onl6M8fZO2wpPRoRy/W8IF+EIVK8tiu5tA2Pq3+91jbH77BbR0w+N1giggMO/CVdHCt/08iWr9vSVY/NCNWUMwKsakd1HxesqMmn5FQy5oAixmmVa6XVp9BEhk/qqDxQ8W7UtUnaqcuH4s5wgxq9+Wd6Rif9r6RfPPXCoF6ZzuoDsCUz1OFwMuTPrbBhWZw1LRpw2OiwtTqPuDek4PJm/wOvjUo10h1F y47njG7b Vp1VvnTgpN86oJ/MBIeS1KE6AsxjMwFD7YcJ/Dma6pR6+zDDjVPh1p6M9ZCoWJ7rcdB6N/bT5X4EDjhymu16Rky/RQmmkwUao68IBj0o87tdSn50Y3pBeEQzqykPrJlFyb7YYwR4aEpPtxwzbpA/wmGg9040NFitAmNx0TgRgA5Aih57cbifj/lTWbPMfjl6hdsuvgijVyWPGVrBNba9lB8NQDxSqNIQFh2fsA7WibhCHvcZlnXZzYrdFWH3fN39fFVUCrSLsjfJa6Y4yQ/eVxFI7T4XPoqRxgqSBh0CdJVkOwdOB3zb8DFrOfTyPub0ZgGxXec8Scl8z5HRS8d3pSVaHzbKlR8XcLHUJBEIr+bT07kJDVFkobFGcBka4UpasAVYWnxycfK03LMwX1Gyzrhu1IPR4rfCEXzPqs4v56UPNn5t4XYnYwpbflJgkb5jzKJu3Tcbnv1O/PXana6N7H9yBVX2y1HgpsBMPIgj6EZhWDtCi9q/fUBrsqufPDmcpS1YagJtsHGLad5+ZQyaFBTY5SY0gzQqjGDswgZ3a3lHP/arn+S9NpmV+5DhKla50HdvDPFz2kZ02ANTnSdMBcT7F2Fhtzx+aaWtW 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: Users complained about OOM errors during fork without triggering compaction. This can be fixed by modifying the flags used in mas_expected_entries() so that the compaction will be triggered in low memory situations. Since mas_expected_entries() is only used during fork, the extra argument does not need to be passed through. Additionally, the two test_maple_tree test cases and one benchmark test were altered to use the correct locking type so that allocations would not trigger sleeping and thus fail. Testing was completed with lockdep atomic sleep detection. The additional locking change requires rwsem support additions to the tools/ directory through the use of pthreads pthread_rwlock_t. With this change test_maple_tree works in userspace, as a module, and in-kernel. Users may notice that the system gave up early on attempting to start new processes instead of attempting to reclaim memory. Link: https://lkml.kernel.org/r/20230915093243epcms1p46fa00bbac1ab7b7dca94acb66c44c456@epcms1p4 Fixes: 54a611b60590 ("Maple Tree: add new data structure") Cc: Cc: jason.sim@samsung.com Cc: Peng Zhang Signed-off-by: Liam R. Howlett Reviewed-by: Peng Zhang --- v1: https://lore.kernel.org/linux-mm/20231010141737.1592866-1-Liam.Howlett@oracle.com/ Changes in v2: - Updated benchmarking to use the rw_semaphore lock (not strictly necessary) - Updated check_forking() to use the rw_semaphore lock. - Testing now completed with lockdep atomic sleep checking. lib/maple_tree.c | 2 +- lib/test_maple_tree.c | 35 ++++++++++++++++++++++---------- tools/include/linux/rwsem.h | 40 +++++++++++++++++++++++++++++++++++++ 3 files changed, 65 insertions(+), 12 deletions(-) create mode 100644 tools/include/linux/rwsem.h diff --git a/lib/maple_tree.c b/lib/maple_tree.c index 0e00a84e8e8f..bb24d84a4922 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -5627,7 +5627,7 @@ int mas_expected_entries(struct ma_state *mas, unsigned long nr_entries) /* Internal nodes */ nr_nodes += DIV_ROUND_UP(nr_nodes, nonleaf_cap); /* Add working room for split (2 nodes) + new parents */ - mas_node_count(mas, nr_nodes + 3); + mas_node_count_gfp(mas, nr_nodes + 3, GFP_KERNEL); /* Detect if allocations run out */ mas->mas_flags |= MA_STATE_PREALLOC; diff --git a/lib/test_maple_tree.c b/lib/test_maple_tree.c index 06959165e2f9..464eeb90d5ad 100644 --- a/lib/test_maple_tree.c +++ b/lib/test_maple_tree.c @@ -9,6 +9,7 @@ #include #include +#include #define MTREE_ALLOC_MAX 0x2000000000000Ul #define CONFIG_MAPLE_SEARCH @@ -1841,17 +1842,21 @@ static noinline void __init check_forking(struct maple_tree *mt) void *val; MA_STATE(mas, mt, 0, 0); MA_STATE(newmas, mt, 0, 0); + struct rw_semaphore newmt_lock; + + init_rwsem(&newmt_lock); for (i = 0; i <= nr_entries; i++) mtree_store_range(mt, i*10, i*10 + 5, xa_mk_value(i), GFP_KERNEL); mt_set_non_kernel(99999); - mt_init_flags(&newmt, MT_FLAGS_ALLOC_RANGE); + mt_init_flags(&newmt, MT_FLAGS_ALLOC_RANGE | MT_FLAGS_LOCK_EXTERN); + mt_set_external_lock(&newmt, &newmt_lock); newmas.tree = &newmt; mas_reset(&newmas); mas_reset(&mas); - mas_lock(&newmas); + down_write(&newmt_lock); mas.index = 0; mas.last = 0; if (mas_expected_entries(&newmas, nr_entries)) { @@ -1866,10 +1871,10 @@ static noinline void __init check_forking(struct maple_tree *mt) } rcu_read_unlock(); mas_destroy(&newmas); - mas_unlock(&newmas); mt_validate(&newmt); mt_set_non_kernel(0); - mtree_destroy(&newmt); + __mt_destroy(&newmt); + up_write(&newmt_lock); } static noinline void __init check_iteration(struct maple_tree *mt) @@ -1980,6 +1985,10 @@ static noinline void __init bench_forking(struct maple_tree *mt) void *val; MA_STATE(mas, mt, 0, 0); MA_STATE(newmas, mt, 0, 0); + struct rw_semaphore newmt_lock; + + init_rwsem(&newmt_lock); + mt_set_external_lock(&newmt, &newmt_lock); for (i = 0; i <= nr_entries; i++) mtree_store_range(mt, i*10, i*10 + 5, @@ -1994,7 +2003,7 @@ static noinline void __init bench_forking(struct maple_tree *mt) mas.index = 0; mas.last = 0; rcu_read_lock(); - mas_lock(&newmas); + down_write(&newmt_lock); if (mas_expected_entries(&newmas, nr_entries)) { printk("OOM!"); BUG_ON(1); @@ -2005,11 +2014,11 @@ static noinline void __init bench_forking(struct maple_tree *mt) mas_store(&newmas, val); } mas_destroy(&newmas); - mas_unlock(&newmas); rcu_read_unlock(); mt_validate(&newmt); mt_set_non_kernel(0); - mtree_destroy(&newmt); + __mt_destroy(&newmt); + up_write(&newmt_lock); } } #endif @@ -2616,6 +2625,10 @@ static noinline void __init check_dup_gaps(struct maple_tree *mt, void *tmp; MA_STATE(mas, mt, 0, 0); MA_STATE(newmas, &newmt, 0, 0); + struct rw_semaphore newmt_lock; + + init_rwsem(&newmt_lock); + mt_set_external_lock(&newmt, &newmt_lock); if (!zero_start) i = 1; @@ -2625,9 +2638,9 @@ static noinline void __init check_dup_gaps(struct maple_tree *mt, mtree_store_range(mt, i*10, (i+1)*10 - gap, xa_mk_value(i), GFP_KERNEL); - mt_init_flags(&newmt, MT_FLAGS_ALLOC_RANGE); + mt_init_flags(&newmt, MT_FLAGS_ALLOC_RANGE | MT_FLAGS_LOCK_EXTERN); mt_set_non_kernel(99999); - mas_lock(&newmas); + down_write(&newmt_lock); ret = mas_expected_entries(&newmas, nr_entries); mt_set_non_kernel(0); MT_BUG_ON(mt, ret != 0); @@ -2640,9 +2653,9 @@ static noinline void __init check_dup_gaps(struct maple_tree *mt, } rcu_read_unlock(); mas_destroy(&newmas); - mas_unlock(&newmas); - mtree_destroy(&newmt); + __mt_destroy(&newmt); + up_write(&newmt_lock); } /* Duplicate many sizes of trees. Mainly to test expected entry values */ diff --git a/tools/include/linux/rwsem.h b/tools/include/linux/rwsem.h new file mode 100644 index 000000000000..83971b3cbfce --- /dev/null +++ b/tools/include/linux/rwsem.h @@ -0,0 +1,40 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +#ifndef _TOOLS__RWSEM_H +#define _TOOLS__RWSEM_H + +#include + +struct rw_semaphore { + pthread_rwlock_t lock; +}; + +static inline int init_rwsem(struct rw_semaphore *sem) +{ + return pthread_rwlock_init(&sem->lock, NULL); +} + +static inline int exit_rwsem(struct rw_semaphore *sem) +{ + return pthread_rwlock_destroy(&sem->lock); +} + +static inline int down_read(struct rw_semaphore *sem) +{ + return pthread_rwlock_rdlock(&sem->lock); +} + +static inline int up_read(struct rw_semaphore *sem) +{ + return pthread_rwlock_unlock(&sem->lock); +} + +static inline int down_write(struct rw_semaphore *sem) +{ + return pthread_rwlock_wrlock(&sem->lock); +} + +static inline int up_write(struct rw_semaphore *sem) +{ + return pthread_rwlock_unlock(&sem->lock); +} +#endif /* _TOOLS_RWSEM_H */