From patchwork Sat Aug 19 00:43: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: 13358406 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 D7C08EE499F for ; Sat, 19 Aug 2023 00:44:18 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8D1B894007E; Fri, 18 Aug 2023 20:44:17 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 8801E940012; Fri, 18 Aug 2023 20:44:17 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6ACDA94007E; Fri, 18 Aug 2023 20:44:17 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 5793C940012 for ; Fri, 18 Aug 2023 20:44:17 -0400 (EDT) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 34E421407CC for ; Sat, 19 Aug 2023 00:44:17 +0000 (UTC) X-FDA: 81139007754.19.ECF1B09 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by imf23.hostedemail.com (Postfix) with ESMTP id ED53014000F for ; Sat, 19 Aug 2023 00:44:13 +0000 (UTC) Authentication-Results: imf23.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-03-30 header.b=uSTOPvYW; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=iiiAUDHf; arc=pass ("microsoft.com:s=arcselector9901:i=1"); spf=pass (imf23.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-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1692405854; 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:in-reply-to:references:references:dkim-signature; bh=feqk/SDhmjpE1eHojcZ94OQImeurSY23yvCAzDKLIqg=; b=qqiDTSSqQWLeicoxa6ujmK7MLcN1vCe5hZ19L+zd0nmgxZJKDa/kHVMiQ7m1B3yqXQe1hq 4RivOKCEYKRqfdU4wBi2qdjhcMWaJTl0CfOsPDE7MXAlDQnQNj//dDz5QOIMWUdSwAxGLk tR3nFkNoKlNxOWIzqeeDZqcVirtpLoE= ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1692405854; a=rsa-sha256; cv=pass; b=aom0004AyXLiZDVG5y6thb+fJOw43vg5QwYTK4olRcJEhTNUz0uMijOeOYWW1Lu53cW8xI AMPJQcZaEEPxm+MIUbbqkY1CCxOLHzqwPBbXAUC71qaoMF2Y2J7Jlyo1OVbLCjZNutwgz0 +GL0i2Koo0vCnyfBenO5GQbWyFc3cO4= ARC-Authentication-Results: i=2; imf23.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-03-30 header.b=uSTOPvYW; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=iiiAUDHf; arc=pass ("microsoft.com:s=arcselector9901:i=1"); spf=pass (imf23.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 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 37IFo0SD027850; Sat, 19 Aug 2023 00: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=feqk/SDhmjpE1eHojcZ94OQImeurSY23yvCAzDKLIqg=; b=uSTOPvYWI7PY4Tl3G0QrxfLTiYwWzMUQiBUN62Q+h11lLUCx4xCi3RsjOEN7ehU7lUr6 7vuWnyjl+u0+ITbI3qv+zNFaZDAALHcwHIoNd9yDkHXz5piuBWVl6nTWMtB0M87PWAmW Z9dTCUaIcU77yNHO4J3MEa3Nhg+lMYId8RvYypSDl5ZKLB82J3qL37wGOWy0fxjadPFj eb4Luyc12kMag+kY7MD9CDf8hMrLwdfqcMLcdvdb8YJjLFxN4n4WVueSmW1TP/UGKnME t6tWV9UsJHcbm0+J+rngcaA3ueO5li9Pzku0aBZFDhq2d1qdy2Pr8dJqxbvpiJ1HQ85a mg== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3se349n03m-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 19 Aug 2023 00:44:12 +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 37ILdQ4h019891; Sat, 19 Aug 2023 00:44:09 GMT Received: from nam11-bn8-obe.outbound.protection.outlook.com (mail-bn8nam11lp2169.outbound.protection.outlook.com [104.47.58.169]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3sey412sfm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 19 Aug 2023 00:44:09 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=i33u7vxHqaW9JRFd7bpZSdNp6H1r14Tj8qMUv3gfobHuch09Bg9XVdf/iTHKIS4Bsc7oxr8O88K+sCNsaUeXW7gjrh40z0a3K1PZC9M/PRisT+BXPirdG9OboFYLkulCQIhu8XjYPGazzVpWWV9B1yg+dEniY5ZlZNXhUOv+F6uw9sTcv7o3blenog3qli1gs4Izs6z0iynbOiKma+SoPNlvpOP5WhOUug3TPV5Sz9X0ekqR2Lwxo453TDZirakeKkZZGvR8TiRsTYJiv4izx8J63d1bI0Qn1ot+Le0N5z+buuWxClEwk6sDoYhLxInxEf7EYEdVRoUz1Net4LumtA== 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=feqk/SDhmjpE1eHojcZ94OQImeurSY23yvCAzDKLIqg=; b=WKEElb4wxXmfvPyKrGz4zYtHSJQlDAZuS6rFRP6nyZpFbwJGsTuG4nESWtNa9wVY7cmv6Bv+1MAl9ZKZRG06xqC7OwThKOcwQUeyzD3uQLp6PKrhuc5ZamsF8nu4szOSvIZJrYGI6lKsG6xoTijpIdIdcupMAEtMYk4N3vYYonJCcKgyNhhHVgad7CZqlzsV5Wc0/2XyudV49NiDtkaXTux0jsljyYpoOcI1DDLmeUUU7+0EXIQINmKILyY7o7bFrxtHEKoE4KPIWWbfGkVX0IwMoTQGsgdW4KLZ7ZaNbcbA9EQC14Joyr7n00jyC0Eb3wqMTaOwGDYmwflRMOO+iA== 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=feqk/SDhmjpE1eHojcZ94OQImeurSY23yvCAzDKLIqg=; b=iiiAUDHfaaXalCgpEzoOuo+oFho+smlJbHSCpZJDgqqCGSAHK6nNLAgDl9pzm+DIY7zQvdf7Nz/qAfXm+QNsiOo81uGPaO3BhyrJeAWwnyTsn5IOA9zs9+FxYFzuIA2v/jzJfDWNp0rrf0CKrwclapXxJqPtVOFPtSwKdNZ4274= Received: from SN6PR10MB3022.namprd10.prod.outlook.com (2603:10b6:805:d8::25) by IA1PR10MB7167.namprd10.prod.outlook.com (2603:10b6:208:3f1::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6699.20; Sat, 19 Aug 2023 00:44:07 +0000 Received: from SN6PR10MB3022.namprd10.prod.outlook.com ([fe80::26d3:6f41:6415:8c35]) by SN6PR10MB3022.namprd10.prod.outlook.com ([fe80::26d3:6f41:6415:8c35%3]) with mapi id 15.20.6678.031; Sat, 19 Aug 2023 00: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" , stable@vger.kernel.org Subject: [PATCH v2 1/2] maple_tree: Disable mas_wr_append() when other readers are possible Date: Fri, 18 Aug 2023 20:43:55 -0400 Message-Id: <20230819004356.1454718-2-Liam.Howlett@oracle.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230819004356.1454718-1-Liam.Howlett@oracle.com> References: <20230819004356.1454718-1-Liam.Howlett@oracle.com> X-ClientProxiedBy: YT4PR01CA0106.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:d7::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_|IA1PR10MB7167:EE_ X-MS-Office365-Filtering-Correlation-Id: 10880033-9e6d-45a6-0b2e-08dba04d653b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: A3G7MPfEkmh4iiKPN9LARMD+gN9Ime8lwwebWJ7KAy9s+XibYDQ53Ojmf0TaaiCqOn7bNdZ6At0j6ZbXz1YqzBHBaOQCMBYfqWNzdSiNmrW82l6VnbuD7tywLOpJu/LE8G8X6jd2ftKxH6Cka4Xcwbdjxdt+go9gfm6r0DpZzijlEPYuZreg+20ftoMwW2KlIVZPuWM4c9LcLO99DnNlkio40LJcauDp9XiOPFMYCOKEwUZsovwbW32vOuLaI8hIOBn0xLDmKL4y+XZwfFtN1RRsa2HLjGTNDuHGjoUt//MmcO+tLO5Bx5TFjJCGZQrvYL2pZscf4RmgmALuf+cQf6fewKjcEEGNFEPOo0ghG0ahRZukQ43IKusNM0oSPnGij3FAKE670RdAQpzlD6FyOA3z4awgJk9qvDwM88ABFgUaoT/laGr6zh0yoPXvZjGdsm1xtQARvp4xWaFOCwgCY5gGRbap8eGwE7MqPGZGQ3HL+rjcUPmChnMntW4+Rut/fmEfvJlQbumYDoVgSTmH0Wdq3fs6qnoVoP3LD8LINJZ5IDyH3uvTd41QS0x1TcqS 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)(346002)(136003)(39860400002)(366004)(396003)(376002)(1800799009)(186009)(451199024)(6666004)(6486002)(6506007)(38100700002)(6512007)(1076003)(83380400001)(36756003)(26005)(2616005)(66556008)(316002)(2906002)(6916009)(66946007)(66476007)(41300700001)(86362001)(5660300002)(8676002)(8936002)(4326008)(478600001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-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xZt7RqVdQkCPyUMq/x/AHXL/8FCfsDVHYna/NiGNnW2ErvIs3lT6ncYD5NcUs7LsVSvDLIpUtn9cBakUsMNMgadVOZeKVFkVqDEsGKOYE5jyPhu/mdOzEEaG6zG7BGjsoP9XbHsuPhJX54fXhkTCq1S11C8I/yIIRBQf9J8HsNkAopb3YUxwDTioT87691/st3474RgRlK7wwArH95ojTSTZlkwMK63mJJulFrArreqV1EC2XRitbIh05v6dHxwj+teaj6AADf97rzvSx6H51BNIgN110exBzmfXH0cRulf9J3ri0V9aKEWFf7c5CchKsXfEFzF0CV21JBr86zo6hF8DQbqnKq62Zm0lpnzYV+puVIIPypSK/ciw2ZWkxY7uQMlDFDBeKbQHVmo+zmk50KFNrZ1ArTzVEs6pvWqjeffRtA7oo3sebEK8xwGXVCiWkb3CTcFSmSpTUUrT0c6TZoh8TR56Xmp84S56cqBg== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 10880033-9e6d-45a6-0b2e-08dba04d653b X-MS-Exchange-CrossTenant-AuthSource: SN6PR10MB3022.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Aug 2023 00:44:07.5592 (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: MJZbeLVPQa2L8XMYXKo0YCMKArfWHdm3ASFSX/gOGa0yb32eLfD1qgOjrtyTmzK337yo0P2qBqN8F3sljQXUZw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR10MB7167 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.957,Hydra:6.0.601,FMLib:17.11.176.26 definitions=2023-08-18_29,2023-08-18_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 mlxlogscore=999 spamscore=0 mlxscore=0 adultscore=0 bulkscore=0 suspectscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2306200000 definitions=main-2308190005 X-Proofpoint-GUID: 3e8ybFcaa1jTjk_lx8iRuzf6pqXGUY86 X-Proofpoint-ORIG-GUID: 3e8ybFcaa1jTjk_lx8iRuzf6pqXGUY86 X-Stat-Signature: ythxmxd918ycwdmtfhmwf4zhe6tpomqe X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: ED53014000F X-Rspam-User: X-HE-Tag: 1692405853-681795 X-HE-Meta: U2FsdGVkX1/01u54ArNhAni5IYVhjL1Q/5n3f443/t3pZbF5JnZFHLhsgvGAeGXoLoMIRzJ4q8efH++2Puz/TI9xjwQ4+l2hnOLPwEmh4cVml08jfLj9ylEqg2HW9MXaiDYk+i5WHBwl9+xB2SvWledzU3L9xLSWCND343zlDvDC027HUR7SFZ5ip4k7zi9BCRP5DtcWTvgkBXu8xopsQ5VX0mx29TUwYdwD23Kbo6+Xrl5uQzFhObohTVv5tOS61BC9RCQjvYX8CjHP0lQiRPmVxhnHWeTncWTYSLKTmIA3qfL57vGcvEhlnbX5DUGQFqCDxAfkQSm7w2MxrMppt7+AVDEDM+mxn1D4WuX3a2Y5+iq48eJ8FxVXq3jLcSLeBXYqeAh2MUHScPyX8AWaIhnxIPYdjDMb7zRWxkxkEzdKh9oPWgtL3oajQwr8FLx/l3bXhTYvntbcItdAUfK1pX0lWKOi6/RO6GMDEVuV3jlLXN45+xQKG+Qp+q/XMBcspF3kJElWJmvP8KpfXFjlPODT6m7Q8VgQX/n6gafZ/mtMQMI5MrbxRIDeILLGJ5TcIOG6ze2Beda6ZXNTR2Y9gIv+EGzueQL88G6yk8r1do6AUup/HXdd/ueXL0uhSOWizy2nMmzd3K6D5OIz631Vazxj9QDac8hsynN6LZY7ERbbIuWAQqWcLpLt2+qZ5zxwAVEGNKZtOJjcoPMFZIr/T86DUJI5oSDnjZ+uZLgOd5a0/OsTroVXvxIB3+FA26duGcoIE2uNXqkVAbh1KHNWkhBvV7lZsvtdFhR7YcAuJAV93uAegbZWh0RLMvqHP/IkbDFc9DqOz5HonECHhgmAtRess7YtF8hqmIO9i/nuV2Inb7+nYnFqadKeB4jXcnQUZqxOPY3IxTuu9VneC5aoHu4WEyrkgI46C62FRzBMdFRM3ojdnEW28gNoFLraK/xnto06rDhbsGKQ9EkqkZ0 QZmFa0jS yXrbTRW6jZxeVw7TUJg8+Izgy/LuQiOtFaCcOafyN8k+xJVtIyWRoCpAqpN/pCyVrVPnloD6ZoL4TnzDmvvgima+Vr5rxQRj0cxMbJ44UKzdscuzuCCs+F9emotwnHmX43ElXZhpCqyk0ueGQ73Q2QJV+4Z4+/gnonMce0j65bTMK3/bYDUZUIUuyMsqQTY1XK/IP3rpMuST5z6Q4yoPMSlUrqu7V+sk1OcMQny7QiVaPxj8a9dFIbJlcwgT/m/JcjkmH8ex9eZVuBXcO4yVDYPQX/CSkcZrZwyqQVUryVfeZUKR67Br7nCUqRpNilPXhrkDhi1OAc+vyrlJXRXKeTwz47E5e17KhaA6Cg4HPpZ3qG3wdI2oNpGxwiKuIIXxadsSGPpD0IQHs4FuP6fMqmUf9RJ4vMFiC+G3RYRwYx9R5/AIhmjgFWFKXm+cvMJMt1C00n9/fpeM9gf3ntWaNv3EhuTfcy+A5bQrHoYGI3TKXN7PNa0sOy6VPq7L4dt4Hj1NP/9qwoaZY584= 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 current implementation of append may cause duplicate data and/or incorrect ranges to be returned to a reader during an update. Although this has not been reported or seen, disable the append write operation while the tree is in rcu mode out of an abundance of caution. During the analysis of the mas_next_slot() the following was artificially created by separating the writer and reader code: Writer: reader: mas_wr_append set end pivot updates end metata Detects write to last slot last slot write is to start of slot store current contents in slot overwrite old end pivot mas_next_slot(): read end metadata read old end pivot return with incorrect range store new value Alternatively: Writer: reader: mas_wr_append set end pivot updates end metata Detects write to last slot last lost write to end of slot store value mas_next_slot(): read end metadata read old end pivot read new end pivot return with incorrect range set old end pivot There may be other accesses that are not safe since we are now updating both metadata and pointers, so disabling append if there could be rcu readers is the safest action. Fixes: 54a611b60590 ("Maple Tree: add new data structure") Cc: stable@vger.kernel.org Signed-off-by: Liam R. Howlett --- lib/maple_tree.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/maple_tree.c b/lib/maple_tree.c index ffb9d15bd815..05d5db255c39 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -4107,6 +4107,10 @@ static inline unsigned char mas_wr_new_end(struct ma_wr_state *wr_mas) * mas_wr_append: Attempt to append * @wr_mas: the maple write state * + * This is currently unsafe in rcu mode since the end of the node may be cached + * by readers while the node contents may be updated which could result in + * inaccurate information. + * * Return: True if appended, false otherwise */ static inline bool mas_wr_append(struct ma_wr_state *wr_mas, @@ -4116,6 +4120,9 @@ static inline bool mas_wr_append(struct ma_wr_state *wr_mas, struct ma_state *mas = wr_mas->mas; unsigned char node_pivots = mt_pivots[wr_mas->type]; + if (mt_in_rcu(mas->tree)) + return false; + if (mas->offset != wr_mas->node_end) return false; From patchwork Sat Aug 19 00:43: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: 13358405 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 7F282EE49A0 for ; Sat, 19 Aug 2023 00:44:17 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id EEAFB94007D; Fri, 18 Aug 2023 20:44:16 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E9B0A940012; Fri, 18 Aug 2023 20:44:16 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C9F1B94007D; Fri, 18 Aug 2023 20:44:16 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id B9EA5940012 for ; Fri, 18 Aug 2023 20:44:16 -0400 (EDT) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 8D5191405FC for ; Sat, 19 Aug 2023 00:44:16 +0000 (UTC) X-FDA: 81139007712.26.A9259E3 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by imf15.hostedemail.com (Postfix) with ESMTP id 489C4A0013 for ; Sat, 19 Aug 2023 00:44:13 +0000 (UTC) Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-03-30 header.b=E5jHXTES; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=f4VuIjD8; spf=pass (imf15.hostedemail.com: domain of liam.howlett@oracle.com designates 205.220.177.32 as permitted sender) smtp.mailfrom=liam.howlett@oracle.com; arc=pass ("microsoft.com:s=arcselector9901:i=1"); dmarc=pass (policy=none) header.from=oracle.com ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1692405853; 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:in-reply-to:references:references:dkim-signature; bh=Y0M1KA1yrSVeKfynevc6l+LcV8CLK0zixIWyAZJH/hQ=; b=V1gxBCkrAY0TtDI6kc7oHgxg075+sK0fX6lSm6hYfubmF5X/MC/FvVS4ZMlmQJT7bHvMOo q4MgbskFDMLK8mWeOtxDTSR/R8IMrmusG5DPyI7MVg0SHCSYNgCcaYK53zci1newJ16BZu kAQTmjaxko88jYPl12JF8FV5oRmICeU= ARC-Authentication-Results: i=2; imf15.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-03-30 header.b=E5jHXTES; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=f4VuIjD8; spf=pass (imf15.hostedemail.com: domain of liam.howlett@oracle.com designates 205.220.177.32 as permitted sender) smtp.mailfrom=liam.howlett@oracle.com; arc=pass ("microsoft.com:s=arcselector9901:i=1"); dmarc=pass (policy=none) header.from=oracle.com ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1692405853; a=rsa-sha256; cv=pass; b=aE6r236DzrpwoNcqZgA87VO7kpca31PL3VDeurYICxnyvPUHi+KIwL6RatcJUdYUTdwoGE d/NOePf3lDUj9wRHfzW7Ka57zcyA4Uflcbin1bIxEPD7rdEEqMOAhi2Um+H9lit70WBX+m z57482AM4bjuJwUrZid2xgqsHCxR2v8= 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 37IFnroL023142; Sat, 19 Aug 2023 00:44:12 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=Y0M1KA1yrSVeKfynevc6l+LcV8CLK0zixIWyAZJH/hQ=; b=E5jHXTESBtSA8OPSHKGcJ3oLu3MlixxgQkPA9lmmHMV5bTVTm2lafAfjaHIloTFQ/dG+ DkjBvrn7GgYqjiZUL9brZZuquIbLJ7r7mwJcclPSDBh6txNTzX3Loxf2id6+yVv6IT4/ +o+leQSP6bvDLNLa+rjQ+YlrtvLR3ouc4g4J7tz0PYtBXbD8nQyjATeOYxre8hNqkfEP nZ6y36b83+EPUyfq6H8xdMa7hKGjqMxWnv6AmHLEURb2ZugBxNVOptpQnKqIbq3HzNXf bP08SJeV8aXDJs9s475E6uNMH2302FMPsS4ndRRsu9iKB1djhPW69BOwTdBsP7/8WUvX 8w== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3se2yfvs3g-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 19 Aug 2023 00:44:12 +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 37IM4Vx3020093; Sat, 19 Aug 2023 00:44:11 GMT Received: from nam11-bn8-obe.outbound.protection.outlook.com (mail-bn8nam11lp2168.outbound.protection.outlook.com [104.47.58.168]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3sey412sgf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 19 Aug 2023 00:44:11 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OuJEdBFyw+fofEaR0qbp8p6H0+hyRnKbZj0hRg5yEpxH634sdS6sPs9jiA9b2vE+9VlgcrSl7fiCEh3TNoMgZiNkt9rnUE6xfEnWpFuL4U0O3fDaHKXiHATnxUkdfY7edR/ZgjQSw7PWrbm4+Qv5OqPlMAYs8Cn60lpZcmHDpu3ECd1B3iYpjrrqfTVcVA87o4jxGNoVMRgRjoCf3vpqtB+mFLL/8F0QnnnO1/48UhBx/hwJh8yuX+mbRGMNMcE9+VfPJ0MTHPJfFwBGyaPWGpSGd7lTYu/f33UoC8HKwu6ovk3eTTqypEnigclWERn3nGLC1yMz0DWMWZzfH6/F0w== 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=Y0M1KA1yrSVeKfynevc6l+LcV8CLK0zixIWyAZJH/hQ=; b=EuZCl+HJ6PmK6nspZaB6qrmtIdb4O6vYiHgpN97rBpfNmex4PwjcK2OCW8oP2WAxbvs6S8Dc3Ej3J2cGEaIqkYpQCOzAboDeRKbgAzfp2xre7QT5rMSrxU2jhhm15wlXLzOsHA1FMzVdpnNptmgOgZSaoOGGibG3X1w4k/vbdgEq6H0qc+7obFOqdUdcooe+TpqWByvjWLDeeYoTDyaCJIvXwpKuAzY5sSygBr3VfrsTot0wbkxyRRbShE5JDT0i+3QD8fXsX65Em34uBb9I6ZScZv2PSt/Hk+gaQ+eyPkoWVbgOlfK0zPCew3zncI4IXut2vqzRCZ6317EMH60nHQ== 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=Y0M1KA1yrSVeKfynevc6l+LcV8CLK0zixIWyAZJH/hQ=; b=f4VuIjD81ramYWE2qg9Inqop9t62LE8Thiy8OJBbKL0crgAPoC/qSqIoSXbugSLrJX0yQwmW9mhsrQl9RwKMqRor3c5TeMAe7Q7VNdRClNcT3qkwMDjgUAW2r3a1F+kSldbrFlQvr15xLcr0jLRb4KDiV9R/3QLPDfEgV2cTT8E= Received: from SN6PR10MB3022.namprd10.prod.outlook.com (2603:10b6:805:d8::25) by IA1PR10MB7167.namprd10.prod.outlook.com (2603:10b6:208:3f1::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6699.20; Sat, 19 Aug 2023 00:44:10 +0000 Received: from SN6PR10MB3022.namprd10.prod.outlook.com ([fe80::26d3:6f41:6415:8c35]) by SN6PR10MB3022.namprd10.prod.outlook.com ([fe80::26d3:6f41:6415:8c35%3]) with mapi id 15.20.6678.031; Sat, 19 Aug 2023 00: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 2/2] maple_tree: Clean up mas_wr_append() Date: Fri, 18 Aug 2023 20:43:56 -0400 Message-Id: <20230819004356.1454718-3-Liam.Howlett@oracle.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230819004356.1454718-1-Liam.Howlett@oracle.com> References: <20230819004356.1454718-1-Liam.Howlett@oracle.com> X-ClientProxiedBy: YT1P288CA0005.CANP288.PROD.OUTLOOK.COM (2603:10b6:b01::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_|IA1PR10MB7167:EE_ X-MS-Office365-Filtering-Correlation-Id: 5abcf94c-f584-4e5e-5624-08dba04d66b1 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: mX3gax1YC7hg2b54phWecCAbTyGUZsvKWf2tvI7T1d/Yit2OhE8Y+Mm+4qxvavfZVFbKe6gRW0zRJJqRUfrjsjd6tOaBRxyIoSI/2V+jXpMGvdoPQvpi/FhrW6VUcaCKQOoyPyEzSZvZzUOYEU57jbOHopK2MGYF5WEyWT+3MHiQXIkrZ+JDsmp4Uw48VCG3/xVc7c+vTTQhgiaMKZ+IVxMrzH70hCwMcsc23NzA8SBqL4V20A0GTyv6iTD+uIsFpRFaLoBOPpDJ4/KUam+LeZ+ezzOOT9vLcK3vCgZXSscui5KYhFbAeT9MCYNb0La6I4kKB+VjdMD8/xpimbZ2ditX1Z1f1WyWrVDF8pUCIUrzTgfQ9I1RwFcygCqfU0hheJWvZOcqGY1PuQxzWvcV2/IeQlXJaMIjVgvXHwoFPmzNfRr5Dxau3s39APkihWqK8DGSYR/SBeieWTeLFBcjwi7BxKWWtwa0jT6iJd734d1in1HFuCjhRVCKb7dSq/Zg3Z5E6kEOy8+yODUEk7ep1k2M4j1odiMoBZGuC+mxfnbpGCplqRjMyxQvLlJWwozu 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)(346002)(136003)(39860400002)(366004)(396003)(376002)(1800799009)(186009)(451199024)(6666004)(6486002)(6506007)(38100700002)(6512007)(107886003)(1076003)(83380400001)(36756003)(26005)(2616005)(66556008)(316002)(2906002)(6916009)(66946007)(66476007)(41300700001)(86362001)(5660300002)(8676002)(8936002)(4326008)(478600001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: YvyvJeG7GQK5cLIk3052lLAmCRCjehC8bn6y05Kofu5LvN4lxXJo2RMHVy4k/OILWUTYaH/EzetQ22BKxFgXig00zgIgGFzfYRVYzgBpvINEBdN7hBnKwOg0GhFHXF6WbFQ3dvsBjoTWhM1VZaKEbr6LsNL4vJLccNuvuTpegk5YmUCZ4XULW4SSCjFtESQ9S6/vw4cklDSdRWUE/+83hPBAt3Yde+h26SCOmBafFw5V4LKA6c3/UKbPsjvYt9bIa75mlcv88lnaqY0X+3PDVfRUt+R9iMIiiOCiSK5YCvbLRoCqWF+3XQbHl/koZKG0NGZPaf2la4VBsVUTXXnJz3x6o4QP+wCE+z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emo6NHZbZuNexqnRLn1qbEz8jXBXrPXeg8PC6bPtAjoUFATCkl2n5moIq+Ry+4YSYkQCa76nKHLzIkL1570+ciErpzvTSpQ== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5abcf94c-f584-4e5e-5624-08dba04d66b1 X-MS-Exchange-CrossTenant-AuthSource: SN6PR10MB3022.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Aug 2023 00:44:10.0781 (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: LULOF07cmJtPranT4poCle280/QIrPQDWfqOl0bF29WFIItnMpH/8ByzETabTuUBw0YpUnhU2+7NtAfqNxt3OA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR10MB7167 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.957,Hydra:6.0.601,FMLib:17.11.176.26 definitions=2023-08-18_29,2023-08-18_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 mlxlogscore=999 spamscore=0 mlxscore=0 adultscore=0 bulkscore=0 suspectscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2306200000 definitions=main-2308190005 X-Proofpoint-ORIG-GUID: yli1hODLcMkMSqqu70cvZhuk_cKqINMH X-Proofpoint-GUID: yli1hODLcMkMSqqu70cvZhuk_cKqINMH X-Rspamd-Queue-Id: 489C4A0013 X-Rspam-User: X-Stat-Signature: k9qk757xt1tq19u9tpptapc7cxgjbuh6 X-Rspamd-Server: rspam01 X-HE-Tag: 1692405853-101090 X-HE-Meta: U2FsdGVkX1/sG33SYIlpjkHJTBBucsAdpcGI8Or4LiVZ/9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ax1wEKRfi5sOOIEzljTX9a4Z3ewe3gCgLjP4GUtV4wspvElL8PMy7ANDAzMU9Ry9gx4bnPEYQtpbmzbNCZzsIHDx2ccEaIq6rdwJ5ohIIrGjOZ85EqxYjNahR96r2Bkp/4aFejOvZ/xDWc3cNFeQC4P5/isL9fAuMETvQXgPyzug4bak/xPnaMMgTCZPxHzfyPsy6WV0cOZ1yaHbmSK8nQMa8cuv93lNJYV08cv5mCF7iFKxte+CSvhk2EeIIvjjshjxU2gRNJAf36df7POrt4IXrc/17bVnFiN5m+xbY5daR9VAlivs8xZ5nbKi/Pc= 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: Avoid setting the variables until necessary, and actually use the variables where applicable. Introducing a variable for the slots array avoids spanning multiple lines. Add the missing argument to the documentation. Use the node type when setting the metadata instead of blindly assuming the type. Finally, add a trace point to the function for successful store. Signed-off-by: Liam R. Howlett --- lib/maple_tree.c | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/lib/maple_tree.c b/lib/maple_tree.c index 05d5db255c39..ee1ff0c59fd7 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -4106,6 +4106,7 @@ static inline unsigned char mas_wr_new_end(struct ma_wr_state *wr_mas) /* * mas_wr_append: Attempt to append * @wr_mas: the maple write state + * @new_end: The end of the node after the modification * * This is currently unsafe in rcu mode since the end of the node may be cached * by readers while the node contents may be updated which could result in @@ -4114,42 +4115,46 @@ static inline unsigned char mas_wr_new_end(struct ma_wr_state *wr_mas) * Return: True if appended, false otherwise */ static inline bool mas_wr_append(struct ma_wr_state *wr_mas, - unsigned char new_end) + unsigned char new_end) { - unsigned char end = wr_mas->node_end; - struct ma_state *mas = wr_mas->mas; - unsigned char node_pivots = mt_pivots[wr_mas->type]; + struct ma_state *mas; + void __rcu **slots; + unsigned char end; + mas = wr_mas->mas; if (mt_in_rcu(mas->tree)) return false; if (mas->offset != wr_mas->node_end) return false; - if (new_end < node_pivots) { + end = wr_mas->node_end; + if (mas->offset != end) + return false; + + if (new_end < mt_pivots[wr_mas->type]) { wr_mas->pivots[new_end] = wr_mas->pivots[end]; - ma_set_meta(wr_mas->node, maple_leaf_64, 0, new_end); + ma_set_meta(wr_mas->node, wr_mas->type, 0, new_end); } - if (new_end == wr_mas->node_end + 1) { + slots = wr_mas->slots; + if (new_end == end + 1) { if (mas->last == wr_mas->r_max) { /* Append to end of range */ - rcu_assign_pointer(wr_mas->slots[new_end], - wr_mas->entry); + rcu_assign_pointer(slots[new_end], wr_mas->entry); wr_mas->pivots[end] = mas->index - 1; mas->offset = new_end; } else { /* Append to start of range */ - rcu_assign_pointer(wr_mas->slots[new_end], - wr_mas->content); + rcu_assign_pointer(slots[new_end], wr_mas->content); wr_mas->pivots[end] = mas->last; - rcu_assign_pointer(wr_mas->slots[end], wr_mas->entry); + rcu_assign_pointer(slots[end], wr_mas->entry); } } else { /* Append to the range without touching any boundaries. */ - rcu_assign_pointer(wr_mas->slots[new_end], wr_mas->content); + rcu_assign_pointer(slots[new_end], wr_mas->content); wr_mas->pivots[end + 1] = mas->last; - rcu_assign_pointer(wr_mas->slots[end + 1], wr_mas->entry); + rcu_assign_pointer(slots[end + 1], wr_mas->entry); wr_mas->pivots[end] = mas->index - 1; mas->offset = end + 1; } @@ -4157,6 +4162,7 @@ static inline bool mas_wr_append(struct ma_wr_state *wr_mas, if (!wr_mas->content || !wr_mas->entry) mas_update_gap(mas); + trace_ma_write(__func__, mas, new_end, wr_mas->entry); return true; }