From patchwork Mon Oct 9 20:16:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sidhartha Kumar X-Patchwork-Id: 150314 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a888:0:b0:403:3b70:6f57 with SMTP id x8csp2100783vqo; Mon, 9 Oct 2023 13:17:50 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFZcrvEWLuY3/fBNiPBVfLUMhJZIgwYDPlXrpYmM76i/PavOLptyWxfbIQZTZOKV1BKwjUG X-Received: by 2002:a05:6a21:3284:b0:16b:79b3:222b with SMTP id yt4-20020a056a21328400b0016b79b3222bmr13538381pzb.34.1696882670363; Mon, 09 Oct 2023 13:17:50 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1696882670; cv=pass; d=google.com; s=arc-20160816; b=FNWfUlX4CbPdgk0wT1FDl7EgUeJGOl9/RLS0tcf/7TIKbpg3BSygKwrga2dXewzYgk 3sqgjIsrJVKvEQY11EMsVCZrxkXnBS61Hb/DezXMrrELnv0Inri70q6D9Qo18H1aCSXe iRnwAlJYGmUZ/SFaIOyItDihXd5uCLybkbWZ0Er0KM6LeLefH9YqMcE8Co2aHxAI7Ixi Tb/LrGgawtQ22I4PD0Q+1BF58GtdNTwySV7XzaqhXGxvMpv310mhikVhSTF82YO8GI4B KzGk4OSAS8HnI8ao3E0MXscndge1dbiIskUE26mNYegWbSSlkL4aetpd53Tn0CyMbpyV tvuQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-signature; bh=4H5BtvqSc+0mOYg98doViY1SX0bCxITXGEXdoB6sLAM=; fh=B8hmr/q5j3tCmv46TiFW349WPKYIK+b/KkTcg+TQCdo=; b=YEIeJAT3w6AhUGTMqRFNDimbRY40kiELAbHCBedpZMp6FzteYlllVNNUy4II1D0In8 Q4z4Vl2jTuvlf3xfSba3ZAn7jdf2d2pFJZ/dg51kGtUbM264AyBAQiEGB3B3HTRv3c7Z 0dKhCXcGmconpaaOvbGJkJOpUOm5ev6yXIzDUAnD0RpCrdLX1i/2cyFns9UNO+VLNeSK puSAA1aLNdUZ2WLXB4Rco98//t4IZJ2az9n6UAS7lddtn/FvPPZxYRkQYxOunpbjAC1h NKD+fCza+3RrY4E7EIAazAm+5jCVIMk7EKOEVDKRD0V4tzH/TWC7dZu99ObatelK79B4 oi8g== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2023-03-30 header.b=ujT23XKE; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=TdLjyEH2; arc=pass (i=1 spf=pass spfdomain=oracle.com dkim=pass dkdomain=oracle.com dmarc=pass fromdomain=oracle.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: from groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id f23-20020a63dc57000000b00588fa0def27si10047609pgj.796.2023.10.09.13.17.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Oct 2023 13:17:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2023-03-30 header.b=ujT23XKE; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=TdLjyEH2; arc=pass (i=1 spf=pass spfdomain=oracle.com dkim=pass dkdomain=oracle.com dmarc=pass fromdomain=oracle.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id ECEEA80BB223; Mon, 9 Oct 2023 13:17:47 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1378591AbjJIUR0 (ORCPT + 18 others); Mon, 9 Oct 2023 16:17:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58130 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378586AbjJIURW (ORCPT ); Mon, 9 Oct 2023 16:17:22 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C9869B6 for ; Mon, 9 Oct 2023 13:17:19 -0700 (PDT) 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 399EXxfB014979; Mon, 9 Oct 2023 20:16:55 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=4H5BtvqSc+0mOYg98doViY1SX0bCxITXGEXdoB6sLAM=; b=ujT23XKEa4nsStIg2waYnxP8CJbixv4PuMHqKhSQjZ2SsHsNWevgZVFPsaLtXMvaMBrO 0DCoKZNKOGhdXMPXtsP+9G9+wCsyL7DEoYozcKx6AyiEqnnRYEdkgnegy/bQ/WvLfiP5 78KvcIm19SbtD1/oieSlenAg2q0j8+FWK2Q68DRMuuE0iC9WdD5cwKUMOMMc+2hY5xi3 Tt4KvUNsqBRLkHRYHjqC0bEgTEMdmGW0+zBWL8En+NzY1kqV3FXC3sxoCoiKxfmcZar9 1FTrlvOLC+t8b+zy61np8EklQOYxKXnpOLNxYJ0bqNf0MYftriAYoMxd+eQZwbMwV7UI lQ== Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3tjx43kmbg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 09 Oct 2023 20:16:54 +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 399JV8q5032145; Mon, 9 Oct 2023 20:16:54 GMT Received: from nam10-dm6-obe.outbound.protection.outlook.com (mail-dm6nam10lp2100.outbound.protection.outlook.com [104.47.58.100]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3tmfhntnbp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 09 Oct 2023 20:16:54 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=iH00Lwo+wX++A266L4wV3K3CXPgllYZ7hWgP6UswUMJJHt/4sQ9zDlrK2G+o5tynaYRWH+UyElx17rUS1iU7slC3+kh4qdUifcuhsfbgkV5OIb6E7KeGKCqzi4owaTo2J9FnSAqnclo2U0T3aeQOBLFlxyHWGGFIhAKeDgLvRqtfKDZvQO/0yjSt/jCIAh73pQVhdVHT0TXApFU1ZwFofUNZvmjrG/I9RP6NI1jKldgDA3VdiMBGE+j6HFjjmPZ8CohaZZ/Z6ZHiZQwGOyEFDNhxbL8UgirM+0zw/MFF6koiDPzD1MvmPuhPvctT0nrT3pxtjXvbvgNizDh1tuLNcA== 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=4H5BtvqSc+0mOYg98doViY1SX0bCxITXGEXdoB6sLAM=; b=fMD707e2ZFbunYtQmMVJVw6l5F+IuQAgOCBuDrgIpc4nD6Q0PaFu/VKWd3H5d51JhSOvopFiC+sQRqnbjmBuxdfStZz9HEu1ddt9IXmE8qtzVnlHvkEIwgPorAuJFW7pZG3NdZwfL8XcKGSumX2RcnjjI/t0xMgTVCNBFceznLUEHCThbsl0hGZPQQ88SWZ5Lum9Q5d/aO0GuHpxIXZnyZ/oeXgdvFmMWjC6BHn0qWv2m4owAZ0CruNuCOB/ZDisyXfirriy7acBpC+n/8HysgF2luJr2tVnYSnoHv63db1e8r7JRuk74Wg3QechjCcR16zU++9t2YMX7/IoMmuIpw== 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=4H5BtvqSc+0mOYg98doViY1SX0bCxITXGEXdoB6sLAM=; b=TdLjyEH2KpbTeQX+VNaECaT5c16v8t/fcjb5HqUnKpZ25qFWFliTpf/L0JsSD+9zkxNSOSdFo+sCkgHicBKNQs8LbKlc2ECL5UDg8hdKo7+57dLo88ItsjrLUqu9n7gquEnv8NTeGVifG8fComXkD7lr0uMYBz932DF7b52v5Mw= Received: from CH0PR10MB5113.namprd10.prod.outlook.com (2603:10b6:610:c9::8) by SA3PR10MB6998.namprd10.prod.outlook.com (2603:10b6:806:31c::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6838.35; Mon, 9 Oct 2023 20:16:52 +0000 Received: from CH0PR10MB5113.namprd10.prod.outlook.com ([fe80::e391:f2a1:a9d:967d]) by CH0PR10MB5113.namprd10.prod.outlook.com ([fe80::e391:f2a1:a9d:967d%6]) with mapi id 15.20.6863.032; Mon, 9 Oct 2023 20:16:52 +0000 From: Sidhartha Kumar To: linux-kernel@vger.kernel.org, linux-mm@kvack.org, maple-tree@lists.infradead.org Cc: akpm@linux-foundation.org, willy@infradead.org, liam.howlett@oracle.com, zhangpeng.00@bytedance.com, Sidhartha Kumar Subject: [PATCH 2/3] maple_tree: use preallocations in mas_store_gfp() Date: Mon, 9 Oct 2023 13:16:38 -0700 Message-ID: <20231009201639.920512-3-sidhartha.kumar@oracle.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231009201639.920512-1-sidhartha.kumar@oracle.com> References: <20231009201639.920512-1-sidhartha.kumar@oracle.com> X-ClientProxiedBy: BY5PR04CA0021.namprd04.prod.outlook.com (2603:10b6:a03:1d0::31) To CH0PR10MB5113.namprd10.prod.outlook.com (2603:10b6:610:c9::8) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH0PR10MB5113:EE_|SA3PR10MB6998:EE_ X-MS-Office365-Filtering-Correlation-Id: 2de33596-c95f-406b-19d1-08dbc904accf X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: M2P9cZnWrh8m/33tYCndTboE7nyH7P8HMx9DM0cVuHPui/3vpkP/a2CXGxUmsPZN/6UeHLbQjc/kRQ10q6ZbmFW1Oc578Rp9doohqUKAyIMAQATwrfkPKu6S9EHLQRYx/TPLTAlSH/YVPLfXITpGxAsffVQ039SKAz5ZvlXBSYAkyl2mYIlKLXgja1EJjRp2na2OCi8KuvdScikmysKo3CH3mcEywek4yNz00hR7f2bt8SrnQzObHjJQImkbVyYs2aQztJ988awdnsRV9nsNvqSR9wTbkL28n3yyZnimvE+fIwZGmhttJ4N4oDhK5v83SbXZy2+7rt1FK6Wv4Ut+SHD2hqwNQ9ViryQ0pioFMwnpblGuJiw/tedrkbRqw3DZMaaknyHB0lAhWNvanw3InLp2kpA8cbyrf35T8Q6Hk59f7MZzo1f402a72NL8QyQ0opLf4bQFE++oyxrTB0IMNfk3bpbtPKSPd0gXw2U1zOsydmNy3v1TElK43dq+YmRmiV5XWijIgOcNgdUYfQh1AnqTjpvHaw9HIWICmpkOsQpZdRaaxUvvwVy9Y5Gtk2CF X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CH0PR10MB5113.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(366004)(136003)(39860400002)(376002)(346002)(396003)(230922051799003)(1800799009)(451199024)(64100799003)(186009)(86362001)(38100700002)(36756003)(6486002)(6512007)(2906002)(6666004)(478600001)(8936002)(44832011)(5660300002)(41300700001)(8676002)(6506007)(4326008)(107886003)(83380400001)(2616005)(1076003)(66946007)(66556008)(66476007)(316002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: CYNtsjwMFytaiHutQniWb+QtCfJ8wzdZx3US3L+9n+zOXCMB9BZxeeYhOClT8WEXudUUffy1vKcGf8R3saRqF9erdlPCJ3UAUglquNfJqFQKe1aOinrkHK72eTZVoDM129nsCKz7URJdO76oADGwMc/x7GlE/l/ByHg4gGFfh3Zm//SyL1CYnXN3RrmhmfWWoikOrVBocDi7xp5zEG9dUdluLpz/d3kRkBvlqC8drCNK3MBoDPmFONbDO1LspmS32uJv8QH9dhyTqKlh+AUltzZyNhnpjHpr5r7lHFe/hIId4foE+oqXPHAYoOWeD2LdBKja/2PPO7BVjgIOk3q+6rlfdTe2H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7NG7ouA0/BZhX7kR9o2fsU/nIUJI3CAMljKeJqDHgjSjieqtJ9roj2CI+4pIvXi95SWFnAiFeMyt6Pok7tMB3GKD6hD/qLRq3Tgibw+Z8lpFhSk5uNHtYHRZ/V14DJaj7I3UDVHd9PcPx8g0+g4QKRe19U2e3FPnoF6CvJuwgNrS7AGkdRg== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2de33596-c95f-406b-19d1-08dbc904accf X-MS-Exchange-CrossTenant-AuthSource: CH0PR10MB5113.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Oct 2023 20:16:52.0423 (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: znOV2H6GjDyY0wwOtwwh6BmvzYZdzEYKiATTmdXiw/tfSZ5aS8Vtqpwu6ubu85gb/EC0XqvFLsiyGprtXvpISkf+8vcoIES60Hljveo1Ab0= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA3PR10MB6998 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-09_18,2023-10-09_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-2310090163 X-Proofpoint-ORIG-GUID: kf9SUGuqoWXaUrzWB7HsuGtKv3iwpWjE X-Proofpoint-GUID: kf9SUGuqoWXaUrzWB7HsuGtKv3iwpWjE X-Spam-Status: No, score=2.7 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Mon, 09 Oct 2023 13:17:48 -0700 (PDT) X-Spam-Level: ** X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779310443010642095 X-GMAIL-MSGID: 1779310443010642095 Preallocate maple nodes before call to mas_wr_store_entry(). If a new node is not needed, go directly to mas_wr_store_entry(), otherwise allocate the needed nodes and set the MA_STATE_PREALLOC flag. Signed-off-by: Sidhartha Kumar --- lib/maple_tree.c | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/lib/maple_tree.c b/lib/maple_tree.c index e239197a57fc..25ae66e585f4 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -5478,17 +5478,33 @@ int mas_prealloc_calc(struct ma_wr_state *wr_mas) int mas_store_gfp(struct ma_state *mas, void *entry, gfp_t gfp) { MA_WR_STATE(wr_mas, mas, entry); + int request; mas_wr_store_setup(&wr_mas); - trace_ma_write(__func__, mas, 0, entry); -retry: + wr_mas.content = mas_start(mas); + + request = mas_prealloc_calc(&wr_mas); + if (!request) + goto store_entry; + + mas_node_count_gfp(mas, request, gfp); + if (unlikely(mas_is_err(mas))) { + mas_set_alloc_req(mas, 0); + mas_destroy(mas); + mas_reset(mas); + return xa_err(mas->node); + } + mas->mas_flags |= MA_STATE_PREALLOC; + +store_entry: mas_wr_store_entry(&wr_mas); if (unlikely(mas_nomem(mas, gfp))) - goto retry; + goto store_entry; if (unlikely(mas_is_err(mas))) return xa_err(mas->node); + trace_ma_write(__func__, mas, 0, entry); return 0; } EXPORT_SYMBOL_GPL(mas_store_gfp);