From patchwork Tue Oct 10 14:17: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: 13415642 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 C1EB5CD8C89 for ; Tue, 10 Oct 2023 14:22:10 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E41C38D0009; Tue, 10 Oct 2023 10:22:09 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id DF1AD8D0002; Tue, 10 Oct 2023 10:22:09 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C6AF58D0009; Tue, 10 Oct 2023 10:22:09 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id B67AC8D0002 for ; Tue, 10 Oct 2023 10:22:09 -0400 (EDT) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 7A0638024B for ; Tue, 10 Oct 2023 14:22:09 +0000 (UTC) X-FDA: 81329766378.20.CBB8A55 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by imf29.hostedemail.com (Postfix) with ESMTP id BD9AF120186 for ; Tue, 10 Oct 2023 14:18:25 +0000 (UTC) Authentication-Results: imf29.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-03-30 header.b=1WmzYeYp; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=CIBI9VWh; spf=pass (imf29.hostedemail.com: domain of liam.howlett@oracle.com designates 205.220.177.32 as permitted sender) smtp.mailfrom=liam.howlett@oracle.com; dmarc=pass (policy=none) header.from=oracle.com; arc=pass ("microsoft.com:s=arcselector9901:i=1") ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1696947505; 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=LE4nEUorFob4QdD11pVqcGU/2ozQj4mURy2C8tTDA5I=; b=Qwr9nw7RcTyiMQr74z1CJEAsVHghNXxE1IgcSFmIoFvTfvOk9uYFrUbq1oigwtvtg1mrNT 18Llh1BoxigDebc8492nCJp/3LPkJE8vvJV/731sN2SsYzxfvyrQLw8W2iAzLLirJ79jh9 xNvZ4K1yWeT/SYWtMk7jOv50YgiMGKs= ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1696947505; a=rsa-sha256; cv=pass; b=SxO2Akilmq4an1db1rG8Rz2VxZHDNRFaYgfiX5Ht/I3jSz+CETR7J9rw+nRbThvHOE4E86 TTX+1wenW5W987ZufcMACGj1LsULpyBVqHWCYtbWpISRHOS7KNQCOZlg4FyiapEcuPpGIy hqiQxPU9VOCZjm58SQHNWSGT9TLO05E= ARC-Authentication-Results: i=2; imf29.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-03-30 header.b=1WmzYeYp; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=CIBI9VWh; spf=pass (imf29.hostedemail.com: domain of liam.howlett@oracle.com designates 205.220.177.32 as permitted sender) smtp.mailfrom=liam.howlett@oracle.com; dmarc=pass (policy=none) header.from=oracle.com; arc=pass ("microsoft.com:s=arcselector9901:i=1") 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 39ADAAXl028146; Tue, 10 Oct 2023 14:18:24 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=LE4nEUorFob4QdD11pVqcGU/2ozQj4mURy2C8tTDA5I=; b=1WmzYeYpd1tjVpriySIPDK7jm3Wmj7JmLE+0VgdvvQeaXoxmtdVnaoIb1604PIBRin7i gSqF6ZGWOLWdEskfNRRfhNojJr/NDa4q/qNowEWVXkCy44uoC4q7nEifaExgqCXQG2LG 10XVcmqfyapMx0Hh0uO/9UnrTxeJnbG2x1aVGQ8PW2jjN+Buhb1EgC72WaDlW70dT5P9 18+6wuUNAuN6Ril4fdKA/p6vFnmtpIwDgsQ/8kJDRw413PIjkjTTwS0BIYXpBwlcxpN6 w12O5qH2WzBG/EOO4k0a5WgvuIDs1dHd9UUZDBSuuvhT6IlcTxHu3xM2ucyAgy8eDXSs 5g== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3tmh89tnuy-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 10 Oct 2023 14:18:24 +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 39AEIMhr016292; Tue, 10 Oct 2023 14:18:23 GMT Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2100.outbound.protection.outlook.com [104.47.70.100]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3tjws6x0uf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 10 Oct 2023 14:18:22 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VxSszYTcLH9oD/MCAR4lLPLllcYla2taCHlxAhHnDWMsWJoEAX75P0JYWSDQEsob4Fc9RMUbBW0f6gfFBMA2w6cEJEM1PDjSGqJtBmr2u6lbo6txw2XcIR/4Q0mDDuL5tbEDwRwFGvcjxC+Orn0g0ZC0WQdTc/IgECNeMItXTYobfavCsS1t5Gly5byvk6FCAnOjYF3hO+wDYiwPqKyjotAPpsfkEiaJpo5LT0ohR0CuhZFuOEuEeXcdQOR9gumPkkfikSShCF24DBikos4GoiGZlBaeWb6FuWCwsyB4H/zA2AnyMLenrzSXH+dvKR+joStoPcfLRu4OihUkyLID3Q== 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=LE4nEUorFob4QdD11pVqcGU/2ozQj4mURy2C8tTDA5I=; b=MLOK0sFywcXWW+2Heewl1w24p8VIGpOXY5/55X7IluPf1amJneSqw/JC0Sz4tcA6+PhKzgFDmncmBhL+oakzGCMfZAiqYrzJ4ossBAEnaKwobzpZ+QfPpmSvO+MsArrqP+QyClDco/PjPghW8qckZ2xQ8KWaj5lvowhHF2Vwydd+kWwZd2m6LOacyNAU/U1v6AEJrfq7ihO4Nx7ryI2W1E8AB7PHDUHvIVBEbHV1c0DEDB/nV+JfAYSgviHqZdyFteEVKPXDHCSj6zSvQJVohdAFTjFn7iVFaUG/AIHOLejoL4HIb/uCSYhIhaToeOZvOnVosA7ThG33DkuS4LgUkA== 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=LE4nEUorFob4QdD11pVqcGU/2ozQj4mURy2C8tTDA5I=; b=CIBI9VWhBAzCCzyrjVdJn3JTh7ap1TzmP0HtJfFcPLll9yJgbn7phtM9WTANZSroglnQ6rw6HyZ5BxhUpO6a9ysY393JPiV9zE3FN28P8iXDBh/Iz10jgj5jWuvfHLclYyc4V34AHmacLQx0SHNamWKW5Rh8HWgF8dSHqEiaWZ0= Received: from SN6PR10MB3022.namprd10.prod.outlook.com (2603:10b6:805:d8::25) by BL3PR10MB6090.namprd10.prod.outlook.com (2603:10b6:208:3b6::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6863.37; Tue, 10 Oct 2023 14:17:56 +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.032; Tue, 10 Oct 2023 14:17:55 +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 Subject: [PATCH] maple_tree: Add GFP_KERNEL to allocations in mas_expected_entries() Date: Tue, 10 Oct 2023 10:17:37 -0400 Message-Id: <20231010141737.1592866-1-Liam.Howlett@oracle.com> X-Mailer: git-send-email 2.40.1 X-ClientProxiedBy: YT4PR01CA0380.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:fd::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_|BL3PR10MB6090:EE_ X-MS-Office365-Filtering-Correlation-Id: 1cb36f36-2c3e-49a9-dc3b-08dbc99bb28f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ahWYoTElO/UMLMuaYtlJ+bvG+S1UAJKykZxQvDVRmcamktRr3cS6FvgSRhmxHad/OhYUcq+I2qG5UEopGX1yGh0S1ROVj40E7UysJ37fKOLKf0NEHQGAHGy+LsvRthUoXS8cUDkxJo3vH8DosKsqSOWqspL5tDlYnMfXhHzDS+fyQvQ1qaW87+40b2ld1MtHapXLT4drCF7QHYbcV8568VJlDNGXCGKkihBn7aENMMNH4Wp3mFsz2t+lDGjlCJKyMcMS47VLQE4aTutjgO0/DW9DsEfbL9WcQ7lq3ZvuJwDDRk6mzxzvpC2ygCHCU7S2SFjaJkt3G1ba3kpuWite/Oww7g5njbpfknHaQbu6mJLXVvRvRrQy3reNztiACrB1rw4FnouBmxaOgJFlBHIwKptW/HkE+Dix0aj5runNdFiJVnA5mFCgGy2KexdGGlypkoWdFhBz1PQ071HS8dFZx3DOlfH8YWQLxYM+rhxYFhGGFIViDfZ/EaEOVc/VplFKHZHuf+KMf6Xj+AGFdRIm6V1KG/rMVCy5r54RHAxZYOE= 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)(396003)(376002)(346002)(366004)(136003)(39860400002)(230922051799003)(186009)(64100799003)(1800799009)(451199024)(6666004)(6506007)(2616005)(1076003)(6512007)(86362001)(36756003)(38100700002)(83380400001)(2906002)(966005)(6486002)(41300700001)(316002)(478600001)(8676002)(8936002)(4326008)(66946007)(26005)(5660300002)(66476007)(66556008)(6916009);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: PEn7rjio4kcSl8UmIbYJNGGcCxICaOC1zg5xAKmV/0kiV5UeTVCC3rsPbGxETWJAnKm8srgmaLxyZNXe8dRhO0jkoqkjTXhAacpbc+xVPCtAr/Q5MFX8FNmyWLmCbO9Lpbawlv7q/6FMJ4dtcjia5J+pcSqJ0CTfavujkGukzp+3MK1EZqiUJqXaj4COLK9G04pr6P9RxmAJEYmFhZ2WVcQpNTM9KYY4kK2F2qM3sdTYVFNplMyv5l/roIydIOmML3xruYff1KQJLa1daWh928kmr2MD465mgo+PHHZRJ3TLXekAytz7R/f4EYkc4Wyn5HTzQjExm7UpjBAMyHWeus7yc3flyrduVoxfihvcsXsYXxsl6VFB7Fkx16UFUWZnTH2IXEdxrqNWlrIgIshApB5FlRYOCOYfYApULC55NLK2o19DCYwRlpIXujNf+EjsLMJZRW/Hk8p43ESfV28eFAK5xlYUcuWSzx95tlhN6J8iFjMKw1mTRKZ/433+5euNeJLwOHSiZw4hvjDSrOP8GEtd6p8bxQUx30dJDmIYauyiBFpOnsepwKqSlLZY1zQL1IcvWQu24+tbAiTQtCFSsGP2ZA+0PjOFvh2BvxnhpXVV3cwtAg6yTXml5pgsXY5lH8sRtgIo0JObDgF2RraUSrGKUyj/xpEv/uEI8X5HnZZuhvlS5DOfIcxzmdsgWwHrLt53nKE+pUnL6VE2Hw45RgfA8YA1FlHHuULO/VvtmlNHIF/3d3nfzhDmJOj8Fo/hiUF4LCarSE8iHK23AAhQidVzu2afr5nD4rYVubj+mdo8UzeSKmm7Yd5PiRcZVSfSdW3P/wjvtop+Q+EbX6O14nbFHfVfIIjjZd1DmphJliwGa/9cpHxvZFXlqJdc0kEcK1mydmnY47i10PTAwWDngMVxcS2hz4XxIef2CG9xqx/ZyBCu97gOuiUFAtzhCn3O+af55fU5WXPtZkUszHOtxH40/7dxwMZ6JA9F5zYc7mJHCdVU1P2QRb7OicZ36DesCMDJuac8VmgfZy7SbblRMPyDHkmOcUH4bXkLmFvt/BugyAaNmeh8C94o0FNb921WcG3v9vEZmzUwSS+VD/loAnxSdZdKFQdZYf9TNDLQbR+5KiCnJLll2o38zrebbjmXUZvjmSOoiwOp7CDMN9UuEJcA6iFNrykE/YREpSU8yEoSyWT3zwEV6gqAznyVrihrZ1PRMvIYTbG90WR5nxHccN0j54sGujex5Y75sOUxNgGNlu4KrcCaqSdYejS3WU5FKTHGm+BJjLj5ES90eVSlSwaJDW6viJVq8IrsFvriqbPBqp7oEGrLPssuTk92xlwkMpe/T+w8dkkSeh0JnHJVQbTY2OQnIl2KaU5ajgM6TAnhE8/D55zTodLqcocezXmizfhykXKzorq6lZSKkhnp7FKIQ+NpcTxyf5ULpbS+hUNrLQhuLu2fW0HbHW/6B4pY7S6m+ii0tctWxv1mraJeOCKqDoTjVCIwuzmqwimd/hfaJLWxVI7AHzz4HtvPPRrecF4FmcKmosnwKnpyXGtFoDepaHUT+X2YAQW1HmDqii1QopZCvKnjFwObtzhJcdRR X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: xNLMO3rQzSZ5aYgvoz/3dMGPfINtk3lGG/n+0JLt4aYhsPsWHfPRXDwXnt38csrmZa8ir2mKJT7cqkg2lwSXg/ybw0uaIdRQEzhcpgnq/wd/OyEyscrljTwkK5TGMNSNEmsWGEHpJjMsFQSW57MkAFZGEdTWcW7de5gcKkNv6RCUNJ+wap4VAQPMl264aq/eV57gsRMjc8W1mf7ePj04fUtFbsj5SB87S012Bnl+FuKzVe98IGnIkHPh+EQnmGAaaCXd0hGhYO0aFft8VmiVvDhgYZkozWJ76hBPNx5TbFg65BeEqaW2TmrKfDfSoqLGrPhnJ7Xs/E8y2SUC7S6U9NZx1kk+73/BooVkj/k8d3hx65fuDU2Qo139J+frqtDe1NinerO6AjTu8I2glBT9EW/K22A67dJ1nJA7w5PLsowLEIQg464MhsEBSpgYVl+4MF6fi8VlIqKISCr0LFAcTEAKlwUpM3fSQlYigqGqqMCZuPdayTfRJuiBIYBnGjGabZ1adEDq4gF0LTXh8HBFVb8ZpZWVULOn0RZV/oV5hQGawHC0JhSpH6RsUA0ffxwXPyaQ8993ePiyysM9dH7pjvp1wsuqn5CqIDrBA0y8hwbTBeTEV95Qv1I0RBnWuuzRAokL0Tja1qF9xZlTNnDsd0HLdYQuuECKgUvo3y8ACItUFa8zRdCQMhO5XtevVlUDda2FeqHs36NMvtaUzUga6wFR7n+0ophKGRHPKi1d9jCNAGfGZbsP55ki9aIUX1QB2XWJDMZtn/HLOiLBCFM/zC0VwWT6OyzLastB7t6GBDPGx/gb0hz3NlhWwqE0kc1hNZxp49yDA1RMLlxfbtb38xBNIKKhvr1QPz4YSr7nyjPEK8sP1q+6kCxiu6Id61tffIyAERQe54ME3enfI7qFCbQV3n3trgpOHhJJEyqedAbubK1MhPt0TR2B7tZDNxuV X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1cb36f36-2c3e-49a9-dc3b-08dbc99bb28f X-MS-Exchange-CrossTenant-AuthSource: SN6PR10MB3022.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Oct 2023 14:17:55.7028 (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: rFG2CA5t1ed+wpxcS9p7/BsQLqHRvQWqreppWKyaFbww/Rn719GnjsG5W7wnZsBn8vEziXKkatln/ej6EoMg6Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL3PR10MB6090 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-10_10,2023-10-10_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 suspectscore=0 spamscore=0 mlxlogscore=999 mlxscore=0 adultscore=0 bulkscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2309180000 definitions=main-2310100105 X-Proofpoint-GUID: s7zJzm2Nh3jh3YdHZQn3amZ6ogEo9MKx X-Proofpoint-ORIG-GUID: s7zJzm2Nh3jh3YdHZQn3amZ6ogEo9MKx X-Rspamd-Queue-Id: BD9AF120186 X-Rspam-User: X-Stat-Signature: ik9rp1kcpifxik57tmkupkqq195q8ia8 X-Rspamd-Server: rspam03 X-HE-Tag: 1696947505-726062 X-HE-Meta: U2FsdGVkX19ZLYjLbB6H8L9sDd62XB+tNUCnrz+985KAp5RUEeopdAsXjH4d84kfWarJRNU8HtqFMz6ohN0iVy0CPMSJZnRrWwRuH4QovqJrWtFx4aHcccBYmPy39CC8ETA8zZ6vTrRHGetfttYk9dqhl+QxSZe83Pm2w2yhF7XDGeJTy8pRuKp5XXaVusDYwDq2uEYeMOcDDBsFAqqus455dNJ3aWP1sZ2sSipLPCdXNcuJR4NrSYk9p4a53ObS2Gf/3a3IPdxCpzfsJXrGCgqHkTP/5kbEMEBZV5DK3sdPuszutV/XOmXzTsviSrEnz9/1PhIXtZaMBsQQu5vaSOCQRzEp/v5LzBjB+sx3R/L1zn1pzPZxIbUOlUu1IXPH7jwIR/Jb1T0mmtHqDTUyqCoUbTh+kKQKG6WbpLfipBeckoyxVDj/PjPL8YG9xPZY5gFWiDiVZArDeH7gdSX2rFQmVApdp/tY6m96BjVvqX9u+Bx0mnt3mniyI3b4HdTFAtjfENmFSFvP4HEDDaPGOCZLecLoM/oFqm7tXWOvKHWQwPaWPIIOaJl8/Vz0aY7GsbVpp40TQ/iQb4/x2DGrHMvCVyed/ECBECtHb8zA21Im7BCZjw386i4g6V8RmizidNyraasuLMgVmRrphBGNH/Y2T97cYM7uGrmhyRdxX6Y2PvZqmQfzmcK5w+THSD7Guuzz+gMnOKP+nu+kvcWXMpT5bMmNJNVK6G2sKPjlb6yeeIqAh+Na3RwVW0mcUaTgUpBS8td8MJQi106/gfxSh0UDWPgMIP5Fpv96dasLFmCcO45zeHMfv6NBPF7EQX+WIHYgrLrTn/BAHYwYDXnovgx64QVfZnb+xiv63iqhPVFCGxEMC/Fi6aHaadTjctTFRUrPpaEYyEO4N5K9tvf38BganhgqFxnFCJNdZ9d7gL5kYN8aFf4NfcjVOVsbyYyakLKsEryVFj6bHHUEdmM ebi/MuRw SjA/hqpFqwUu+ONOJrW09gyhLPUJf3nVo6Tk0LggmzHsjqrI+SRsV8SyuWVRRKi54qmsOz4iBYxIXcbl8yaP0pwQa1GZanzBJZpz3GAzWAWg8SnlOgcsOUekiiqpdMv1OgCIUYHqz1isGZvG5ngjDA+DixoHJg2JG2B1iHJTAjlSmhbGyHaQlCwf/wGF00EJfYbAsEqZGs7eTThrN6W2K218oD+DnTGwj6kEFCBEcS+kxSdxwqfjKWn6/+4tw9sXFKSvGHAcE8oIq+6JhW9rchyW6gRq9SEYNBcnjgpcxin3gf07o744EuP9jbhh0+ct4mLI7jC7HgKdFEqvnSzU7K6RNd/YqOGGbJ8nMSJS7oQ5hNzRpSZ8DsGfS7dsH9xmJc1GvrOwLcrysNpKFpw7HR/1HrphEFfUNtW/8ko3pF2OXjedZzHiywcHfEmjE4bQPsMSmc5i9dUGeyvJnXypJIOJ7gZUkIubXqM1mstd8KDd7D3HgVArp4RTVr7Dep1L27mlu 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 testing in the maple tree fork testing needed to be altered to use the correct locking type so that allocations would not trigger sleeping and thus failures in the testing. 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 Signed-off-by: Liam R. Howlett --- lib/maple_tree.c | 2 +- lib/test_maple_tree.c | 13 ++++++++---- tools/include/linux/rwsem.h | 40 +++++++++++++++++++++++++++++++++++++ 3 files changed, 50 insertions(+), 5 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..204743bc161c 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 @@ -2616,6 +2617,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 +2630,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 +2645,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 */