Message ID | 20240814161944.55347-11-sidhartha.kumar@oracle.com (mailing list archive) |
---|---|
State | New |
Headers | show
Return-Path: <owner-linux-mm@kvack.org> 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 80BC6C52D7B for <linux-mm@archiver.kernel.org>; Wed, 14 Aug 2024 16:20:34 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 77BF96B00A2; Wed, 14 Aug 2024 12:20:10 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 6E5C96B00A5; Wed, 14 Aug 2024 12:20:10 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 380BE6B00A3; Wed, 14 Aug 2024 12:20:10 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 0BBE26B00A2 for <linux-mm@kvack.org>; Wed, 14 Aug 2024 12:20:10 -0400 (EDT) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id B0E9380DC8 for <linux-mm@kvack.org>; Wed, 14 Aug 2024 16:20:09 +0000 (UTC) X-FDA: 82451362938.28.6792AE7 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by imf26.hostedemail.com (Postfix) with ESMTP id 46677140003 for <linux-mm@kvack.org>; Wed, 14 Aug 2024 16:20:06 +0000 (UTC) Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-11-20 header.b=ka68dGYh; spf=pass (imf26.hostedemail.com: domain of sidhartha.kumar@oracle.com designates 205.220.165.32 as permitted sender) smtp.mailfrom=sidhartha.kumar@oracle.com; dmarc=pass (policy=reject) header.from=oracle.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1723652395; 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-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=hIn+8Yybfsr43/VXbr2dLboHCSAINfu362LGlbxAENo=; b=D0WgykZGwIhMC+NICuE9SvKAIryNwuHgUjQHPs5Qp/CE9R14Jv0UtDtfcXvWQUe2d7Pw4G qN/KMo2bYIDtx+Qx/R/BEuGwsFBLN/or0/tqeHWH+Vat2T1THQZOJGWuoGdOG1TSE1pO0J 3lczRJPHQW41R2dmcDyjc2AGODkjsLg= ARC-Authentication-Results: i=1; imf26.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-11-20 header.b=ka68dGYh; spf=pass (imf26.hostedemail.com: domain of sidhartha.kumar@oracle.com designates 205.220.165.32 as permitted sender) smtp.mailfrom=sidhartha.kumar@oracle.com; dmarc=pass (policy=reject) header.from=oracle.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1723652395; a=rsa-sha256; cv=none; b=DUVo0BeZCd5bB84TXKaKNt38bkXsuMmb+gzeiKY+P5gl7xULQjAVmjBqiFVNf7+YZguaAS xLrcJAN5LGhVAZpdxch5x1rS9xusfd0E5iy4fgpyXqtoeAeqmOeZTmsv9NFKSSEf2i53XV c5Yq8Wf7O0gZKoW3vh9IvquFF97BYn8= Received: from pps.filterd (m0333521.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 47EBtbNK006104; Wed, 14 Aug 2024 16:19:57 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 :mime-version:content-transfer-encoding; s=corp-2023-11-20; bh=h In+8Yybfsr43/VXbr2dLboHCSAINfu362LGlbxAENo=; b=ka68dGYhm1Xqj6yu0 K5fC28UFxeARsgcEQTd+TXLxOUBI63cP6S2h8jpQM95oaCjkZBwxc9anmwSsS2aD LHkcjoxks3v9UNNtC0auQvhtRIxietTzPzq6Op57O9PW/WjRXFli0sO5x/7Rj2Mn EEHvEIjTm7Qzdp7aKE3yoNVmflNb+HE8C/W2k7GJcU37ifynndlll6i7MtTd+rhT fCA+GfOCo/ndmk0+9l96Sm++c5BIXDCx6Ik86naRcJar6+V27AjqTnDH2LM+EY3N 1o3FkNlmjB9Gc8GJY//1f2/1macb/Ye1bYV7rWSFciUhGogSZOkZSGOCaEgTFvsy SXcuQ== Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 40wy4bgub4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 14 Aug 2024 16:19:57 +0000 (GMT) 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 47EFxhpc021064; Wed, 14 Aug 2024 16:19:55 GMT Received: from pps.reinject (localhost [127.0.0.1]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 40wxngn7qe-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 14 Aug 2024 16:19:55 +0000 Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 47EGIvCG035951; Wed, 14 Aug 2024 16:19:55 GMT Received: from sidkumar-mac.us.oracle.com (dhcp-10-65-174-212.vpn.oracle.com [10.65.174.212]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTP id 40wxngn7gt-11; Wed, 14 Aug 2024 16:19:55 +0000 From: Sidhartha Kumar <sidhartha.kumar@oracle.com> To: linux-kernel@vger.kernel.org, maple-tree@lists.infradead.org Cc: linux-mm@kvack.org, akpm@linux-foundation.org, liam.howlett@oracle.com, willy@infradead.org, surenb@google.com, Sidhartha Kumar <sidhartha.kumar@oracle.com>, "Liam R. Howlett" <Liam.Howlett@oracle.com> Subject: [PATCH v4 10/17] maple_tree: convert mas_insert() to preallocate nodes Date: Wed, 14 Aug 2024 12:19:37 -0400 Message-ID: <20240814161944.55347-11-sidhartha.kumar@oracle.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240814161944.55347-1-sidhartha.kumar@oracle.com> References: <20240814161944.55347-1-sidhartha.kumar@oracle.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-08-14_12,2024-08-13_02,2024-05-17_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 mlxscore=0 bulkscore=0 phishscore=0 malwarescore=0 suspectscore=0 spamscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2407110000 definitions=main-2408140111 X-Proofpoint-GUID: oVTmzFlSWob157LVeIvGqKVdGTcYWCQB X-Proofpoint-ORIG-GUID: oVTmzFlSWob157LVeIvGqKVdGTcYWCQB X-Rspam-User: X-Stat-Signature: ikfu5exwmg7bryjys4hdgfo3dfehc8wm X-Rspamd-Queue-Id: 46677140003 X-Rspamd-Server: rspam11 X-HE-Tag: 1723652406-536550 X-HE-Meta: U2FsdGVkX1+8YdvFZFVZ8aGjKqXfT0HCO7OjIaj7XTfi4Sz3Qie0nJCIlqC5yUIgYc7JSstO4GgevuFFQG981FFqrPQc9NPNsvzroreh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AXJRrh6WvD+sq3n/4Op0PnLy7Eu1Pu0QM3GKIptdNeJzphprJsaHjn5X+D1nhXQ/YDcCbtvW 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: <linux-mm.kvack.org> List-Subscribe: <mailto:majordomo@kvack.org> List-Unsubscribe: <mailto:majordomo@kvack.org> |
Series |
Introduce a store type enum for the Maple tree
|
expand
|
diff --git a/lib/maple_tree.c b/lib/maple_tree.c index 2242e07a46dc..bb940f61d713 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -4457,26 +4457,24 @@ static inline void *mas_insert(struct ma_state *mas, void *entry) if (wr_mas.content) goto exists; - if (mas_is_none(mas) || mas_is_ptr(mas)) { - mas_store_root(mas, entry); + mas_wr_preallocate(&wr_mas, entry); + if (mas_is_err(mas)) return NULL; - } /* spanning writes always overwrite something */ - if (!mas_wr_walk(&wr_mas)) + if (mas->store_type == wr_spanning_store) goto exists; /* At this point, we are at the leaf node that needs to be altered. */ - wr_mas.offset_end = mas->offset; - wr_mas.end_piv = wr_mas.r_max; - - if (wr_mas.content || (mas->last > wr_mas.r_max)) - goto exists; + if (mas->store_type != wr_new_root && mas->store_type != wr_store_root) { + wr_mas.offset_end = mas->offset; + wr_mas.end_piv = wr_mas.r_max; - if (!entry) - return NULL; + if (wr_mas.content || (mas->last > wr_mas.r_max)) + goto exists; + } - mas_wr_modify(&wr_mas); + mas_wr_store_entry(&wr_mas); return wr_mas.content; exists: