From patchwork Thu Oct 17 13:46:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yang X-Patchwork-Id: 13840066 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 C98B1D37492 for ; Thu, 17 Oct 2024 13:46:29 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 446EF6B0082; Thu, 17 Oct 2024 09:46:29 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 3BFA06B0083; Thu, 17 Oct 2024 09:46:29 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 287726B0088; Thu, 17 Oct 2024 09:46:29 -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 F3BF16B0082 for ; Thu, 17 Oct 2024 09:46:28 -0400 (EDT) Received: from smtpin17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id E07A1AC8C1 for ; Thu, 17 Oct 2024 13:46:06 +0000 (UTC) X-FDA: 82683218226.17.D66E8E6 Received: from mail-ed1-f42.google.com (mail-ed1-f42.google.com [209.85.208.42]) by imf09.hostedemail.com (Postfix) with ESMTP id B00FC140004 for ; Thu, 17 Oct 2024 13:46:19 +0000 (UTC) Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=KQ5p3fTY; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf09.hostedemail.com: domain of richard.weiyang@gmail.com designates 209.85.208.42 as permitted sender) smtp.mailfrom=richard.weiyang@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1729172753; a=rsa-sha256; cv=none; b=192T+un0LivE3lGTuQbWfPn4HX6yyIAmW5JnhiInpNDwLoQJnXad5AAGxjc77BHXSj1XnR dkYrT/sMD3epDCEqHe8M88JeM0xSf76TvEzb6xz0s2V0H71VizvoC8O4xIOqVo3vD1PG2M zThiWOjklVpxSTHt8I7F3sLFJZ0TQH4= ARC-Authentication-Results: i=1; imf09.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=KQ5p3fTY; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf09.hostedemail.com: domain of richard.weiyang@gmail.com designates 209.85.208.42 as permitted sender) smtp.mailfrom=richard.weiyang@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1729172753; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:in-reply-to: references:references:dkim-signature; bh=gd/gvzJZk2byqAlrxbcyfUB6NXNbKaEpQPGd+XTepUQ=; b=cV3BAsTjD/Mo2nH9JyHtU1S1Nvq8erUAtHwWCua/94b+V5pdVr4tPPU8ixWcCFypsXHgKx Bpj5rq9jSDeTlOUErgENmkkcS1yI8i0j7XFL6jVlvnTXCdtFPknQv2IqbIW+Vl/LB33CwD IAJsaNjJz/NL/rAvBwayp1Tsha3dmTc= Received: by mail-ed1-f42.google.com with SMTP id 4fb4d7f45d1cf-5c40aea5c40so1745784a12.0 for ; Thu, 17 Oct 2024 06:46:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1729172785; x=1729777585; darn=kvack.org; h=references:in-reply-to:message-id:date:subject:cc:to:from:from:to :cc:subject:date:message-id:reply-to; bh=gd/gvzJZk2byqAlrxbcyfUB6NXNbKaEpQPGd+XTepUQ=; b=KQ5p3fTYCl7V6HknpcVwkHUEV8FSlr6jojLEf0X4HTJyBU6iVPmxpGu64nX2M5G9Wx ovQZxbjK8yhDuRJCMmTKHxSLSC8KGNEUb8nebXaW3BUlsM//YL+yAQMZl/R29ZKKQ+OZ PKM1tBUssberiIYtMNErOXLv7KIPUVFh828WAinhlFrEsy1WbE/AzThEggDIns8fyMjT EBV1R7HtBOVG3DWP6kAkulj6TYf4crjo5P7h1VFOZ2w1YhaGVpFs5HM6UZVOoy1XqNH/ K8zL4RvlrSiH4yR2zd85LWwIi3lcr5J2IpmqktCgGwIYwERxohU8eCkhI+NKZ9sW7OyC b3kA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729172785; x=1729777585; h=references:in-reply-to:message-id:date:subject:cc:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=gd/gvzJZk2byqAlrxbcyfUB6NXNbKaEpQPGd+XTepUQ=; b=I9Ntb7LrrkRcPWSOBrlfl2nfAYStfTjqk1viGbd1dXJqBw7IQ6j3r4o2chQ1nnPcGW aQ7s37d8NCfpQS05vn2b9LuBhT6kAOoRvVjZ20VnU1pGvDWE3DEeRLaCB1e0r/g4Diyq uOqNgi4IRcFp/UOt6uFxMX/7XML/8zhYnWkld+GIWjTFhCJHnDeeXQ1co1DyHeH5HgOk ws+w4GJHkRKeA9f3DX5dS+qIoT4Fq0Z9DQ/yyQXgZjYnNS9Rlk8oO1OmAJGbSEXXHD86 S+jBvuUoYlHAo7+TcGREN1q20LA5uRB5XtM0GMMpjGykqpKIdtlZGkS0zbHWxUO+taBv 7QSg== X-Forwarded-Encrypted: i=1; AJvYcCVpNaVmqVfU9JSoBe0tGSkCNDDk16/VOK8qcvkEImROug79mgE72VGa/p84GJfYZkoJcJwkEXlzWw==@kvack.org X-Gm-Message-State: AOJu0Yxwcz4452zwm4VHyaM4f3ouyr6b6zU5DwRCM+Mdq76SE7MBHpW5 h5JbhuGJOoBR/XeVSMWtBCNpBDJKrQj/N1wOPLX0gs0O4U/JoOU/ X-Google-Smtp-Source: AGHT+IG27tQSBevQcbOxDL6VorRxQSCki9fKb1svCCWOQ7EVnG8t1SQDqyzEwKRIyygydNdrwskYnA== X-Received: by 2002:a05:6402:90e:b0:5c9:6c7:8b56 with SMTP id 4fb4d7f45d1cf-5c9a5a1c04fmr3409607a12.7.1729172785213; Thu, 17 Oct 2024 06:46:25 -0700 (PDT) Received: from localhost ([185.92.221.13]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5c98d4f9612sm2788184a12.32.2024.10.17.06.46.23 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 17 Oct 2024 06:46:23 -0700 (PDT) From: Wei Yang To: akpm@linux-foundation.org, Liam.Howlett@oracle.com Cc: maple-tree@lists.infradead.org, linux-mm@kvack.org, Wei Yang , "Liam R . Howlett" , Sidhartha Kumar , Lorenzo Stoakes Subject: [PATCH v2 1/5] maple_tree: print empty for an empty tree on mt_dump() Date: Thu, 17 Oct 2024 13:46:03 +0000 Message-Id: <20241017134607.30206-2-richard.weiyang@gmail.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20241017134607.30206-1-richard.weiyang@gmail.com> References: <20241017134607.30206-1-richard.weiyang@gmail.com> X-Rspam-User: X-Stat-Signature: tts89fxgqosfrgw5grfhn697e9dzqzmx X-Rspamd-Queue-Id: B00FC140004 X-Rspamd-Server: rspam02 X-HE-Tag: 1729172779-406733 X-HE-Meta: U2FsdGVkX1/Vu3lSAYdc3Sr0fExM5ICnKMf3hKmpBiKyzOBHf7OfTCHguhL63Wx2jkevif4/McTXEYpXA5qQTquLwUz7T2SjmaEOTjcg3nKNlAxRtCc0key5nWOSqpOH9Xy9ZSQwC4MR9L8VupaEQU3un4Cq29VxuwbTY+ORSuwhvvkgQAyzN/J+A3sFHaKGy+AGQI51C0xbpQNCmhdBWhgCAEQp8iYqgjqi2hto6RrjRKwb8+JE9P75oWpZzMhgo1MCV8H/E3Xoq8rQNIeBlneutMNcgQ06sueMkZm+D+EcGgvDl6P7CrwpBABPU/vzBNONPabpcyVs1T4UveFVhf83XU+SiY34xvgEv15Io/3nvVjvJAs4H2DnzUMRMrTmWxqUyZn8IYorPNM8UsYDgecW+F83AUK4A/U9L7pG+7LFOC3sZ6rz1M+BggDIEVPepo2if/Gs5z9PPLX318kfSFwT+3SryLL7SrxD8yH06CqKfS7zX4jic1E4F0X6PmoVsDU4/BJYfw0bhmbHvcTl+e+a0DkvCFAj0IclyDhZQMta6NuqhXPP6LXyVFFUXqSbxqKTzSuRvA66H1r9QddKH8h6/RybJLGvNghmpYUjy+N+fYLWy+DtAu0yg2wXx/v7XaakDVNus1OVhbS9zRxjpX6l3f5M1C+eI91wToQkVs1gx3w9HVwDU7rYXYx7uTTC7+QxJUSgxqFOj95pQkPHiSbUjPKVwN8kITUK15Q8C7aBEp9yxtV6fF5CZljEAAHHViQ0lACLNIs51ZOtq0UAOsEkBO1XTNNahOhVrjsmAR1kLxNHSSqrgz3UdQUoUZy1i9aFFJ9E1ZEZ6doyYJqAqwpk+ZOAtHiAENG7itVKULVmJJZlxWBRaZwdbL2njLBddmUC/HPEiuKXKdBSz8THSmEPjU0+nl3DtJF76mks1gbGvEn3wf7lqdl7Y8rjwvOdb15WQTOXONmzWxFzSfj caOZLltG 7l5S+uYrj/JxubnRZRYieNM+/tu547CFQk/ba3OFfjCxVnGj5EFo8PwW9M9ZWIKbU2Ql7x3wKxhuk+J+mZZ2Bi7Bc54QW5EwYrGHEvI7dxC1064bvk2E7V5yhyD5V7A4+HuAIkVYecepu5zzN2VVesKDSWLcY6doCnJBEVrKfg43uF2IUr8qcz+01bEGjNVK4iMbQauY4jqRF9If28iv2Kv6nthByxyDlgBl38OMxmWf/6qLWaTCVT2FMkcphx1HegPo96xpNQMsKbGXiEeSa03Ou4QEYjvpMnyhdU5xgKcq7+74CxYmOvLxsCcSIU/TyTNAwRFj8nlUi/bTwlla0HWayGUBkwrwJFYPPSvA8FCCLuY7pJcE929elJaqVUwc5f57vd54zf1zp9+h27+jmD6ZoeAXpc+vYetZJBQ7HibfK+Rbq06qUyhySSOrmkbKFVBzge56xGxFYFTM8zxsl5GMJZzU5YCxyPx0+EllNCVtglwTSlflRw414Fp9xmNPWUddV 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: List-Subscribe: List-Unsubscribe: Currently for an empty tree, it would print: maple_tree(0x7ffcd02c6ee0) flags 1, height 0 root (nil) 0: (nil) This is a little misleading. Let's print (empty) for an empty tree. Signed-off-by: Wei Yang CC: Liam R. Howlett CC: Sidhartha Kumar CC: Lorenzo Stoakes --- lib/maple_tree.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/maple_tree.c b/lib/maple_tree.c index db3de0b9aa9a..63a969d581f2 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -7204,10 +7204,12 @@ void mt_dump(const struct maple_tree *mt, enum mt_dump_format format) pr_info("maple_tree(%p) flags %X, height %u root %p\n", mt, mt->ma_flags, mt_height(mt), entry); - if (!xa_is_node(entry)) - mt_dump_entry(entry, 0, 0, 0, format); - else if (entry) + if (xa_is_node(entry)) mt_dump_node(mt, entry, 0, mt_node_max(entry), 0, format); + else if (entry) + mt_dump_entry(entry, 0, 0, 0, format); + else + pr_info("(empty)\n"); } EXPORT_SYMBOL_GPL(mt_dump); From patchwork Thu Oct 17 13:46:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yang X-Patchwork-Id: 13840067 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 C1527D37491 for ; Thu, 17 Oct 2024 13:46:31 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 941796B0083; Thu, 17 Oct 2024 09:46:30 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 91AE96B0089; Thu, 17 Oct 2024 09:46:30 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7B7F36B008A; Thu, 17 Oct 2024 09:46:30 -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 55F956B0083 for ; Thu, 17 Oct 2024 09:46:30 -0400 (EDT) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 7E35241427 for ; Thu, 17 Oct 2024 13:46:23 +0000 (UTC) X-FDA: 82683218520.08.2E7632B Received: from mail-ej1-f48.google.com (mail-ej1-f48.google.com [209.85.218.48]) by imf28.hostedemail.com (Postfix) with ESMTP id 8AF3DC0009 for ; Thu, 17 Oct 2024 13:46:18 +0000 (UTC) Authentication-Results: imf28.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=LNOt+l3p; spf=pass (imf28.hostedemail.com: domain of richard.weiyang@gmail.com designates 209.85.218.48 as permitted sender) smtp.mailfrom=richard.weiyang@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1729172642; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:in-reply-to: references:references:dkim-signature; bh=vDv4Bp09gC9DZzAkjA26gXKku/6wi5oKcWSb8e8kMzM=; b=f1115a+yhe+OY0fH/AD6Wzg0Gj2HjpNBo2p+Laj0SJq4DmSZWw0DSEJt+rnM+1MbWK+vU+ aLKMKxRPJ0bqCRVFu1p1KYG5S7CFC3oFfMsX15UypZeeDxQTS+x1eoIIEad2rQrfxndHaq P8wSGOZgWwzNBYuEE5+lj1ZPhZtVP7U= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1729172642; a=rsa-sha256; cv=none; b=eUFykaLaTxYTvn+/46d+rwOCSGDzRpOf/jiFeHntI6IVBx16FWm0Yp2wk7mkXIUt/9IW2J nkEJEyf8oZk+H89ZQ7DP0Rssb4EylcGBwRaVUTcdSZ6nBBRUx/JJxdPSXUzTF2GxhQpHvQ iBQ55x8dZsyr794r/g6gomhQVn+acX0= ARC-Authentication-Results: i=1; imf28.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=LNOt+l3p; spf=pass (imf28.hostedemail.com: domain of richard.weiyang@gmail.com designates 209.85.218.48 as permitted sender) smtp.mailfrom=richard.weiyang@gmail.com; dmarc=pass (policy=none) header.from=gmail.com Received: by mail-ej1-f48.google.com with SMTP id a640c23a62f3a-a9a0472306cso126793866b.3 for ; Thu, 17 Oct 2024 06:46:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1729172787; x=1729777587; darn=kvack.org; h=references:in-reply-to:message-id:date:subject:cc:to:from:from:to :cc:subject:date:message-id:reply-to; bh=vDv4Bp09gC9DZzAkjA26gXKku/6wi5oKcWSb8e8kMzM=; b=LNOt+l3pIlmds4Paqc1zHbVadlNcF1xKP3iFuwK2kK3ntXY2l0e1pHnrLSXop3+7hE o9nn1rL1gn75MPmJSidlhzblWm7NJjAE8OoJiVhPPWCs7DhFRMyJW6q6meCj5vJwSD+m SZ0S1z5BfE4nlnuPjLNbDvDz1z+08ku7VVO84IYGatv/kS6JkfXHuxzg8FX9qn3NDlCy TQxp3hsTr2fe7ZVs4i6AeQHFHjOB6hMuXTUCzryarXfFI8Qe3fsyCbgoZx9tuA+Ta3s9 0uF3Dl3wHs9EJ1TIZB5LIDu3xRjmz9JE7IdxpIXqANMSfw2w0ElJwKckrRT1JpEeHIt+ mCSw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729172787; x=1729777587; h=references:in-reply-to:message-id:date:subject:cc:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=vDv4Bp09gC9DZzAkjA26gXKku/6wi5oKcWSb8e8kMzM=; b=gsAQLdTRzBcW8e366NX8rM/ky/ZeNUy6KThoJZi95ySViU5TVeGsY1kk9gyFwOJH6t MJ2nwxZ3hhWtWdmu192Gj3EzZI9AvjJwdlyE+6Mj97la3gCsnrb1dn6lq2fpW/Dcuqsu SkS/u3l1CVChAAksQZKFSZOLxlxIT65WZ/sW6TKx59pN0CssOiPvWF7LW+33xuKFAY5U Bt3vSIi62MqmJ6d27FxB9uMvNFLz1ejSFzwo079TbI+fOVPImIljugPH1ayWvygHosI3 YPX+0ME0wogTSX0sDO52EahiPn6/Sp23o9H/YY72CrJ0J0sDr3anT92cFEMHPy4UTqKw eWHQ== X-Forwarded-Encrypted: i=1; AJvYcCVg7NmIchTFNimaHS0Lz06q+7KjnRgE3HzFF6+0WtECL5We+H91rrOHnVBubRRMgCzHiJ+5ZGELow==@kvack.org X-Gm-Message-State: AOJu0YzArg5zGePzAGHL4qwP0S06YRo5LoKdP9Lgck8b1n0j/m2XyMLW +duAlv1wi7S2fHY3wadoO32GWUK/jf/lsp3GsU1xYAnjjtoJKpqu X-Google-Smtp-Source: AGHT+IGd78M11A97v4Y51/Hr2Lad5cs1I+/j8mxj/Eng8BkFzHDhvSn10U/UeLtIQ+JfNq8AsJ8xvQ== X-Received: by 2002:a17:907:1c2a:b0:a9a:13c2:2b07 with SMTP id a640c23a62f3a-a9a13c2368bmr1211329166b.31.1729172786678; Thu, 17 Oct 2024 06:46:26 -0700 (PDT) Received: from localhost ([185.92.221.13]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a9a29823d5esm299349766b.113.2024.10.17.06.46.25 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 17 Oct 2024 06:46:25 -0700 (PDT) From: Wei Yang To: akpm@linux-foundation.org, Liam.Howlett@oracle.com Cc: maple-tree@lists.infradead.org, linux-mm@kvack.org, Wei Yang , "Liam R . Howlett" , Sidhartha Kumar , Lorenzo Stoakes Subject: [PATCH v2 2/5] maple_tree: the return value of mas_root_expand() is not used Date: Thu, 17 Oct 2024 13:46:04 +0000 Message-Id: <20241017134607.30206-3-richard.weiyang@gmail.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20241017134607.30206-1-richard.weiyang@gmail.com> References: <20241017134607.30206-1-richard.weiyang@gmail.com> X-Rspam-User: X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 8AF3DC0009 X-Stat-Signature: dan1tca5xyz55opwa7cs9b1u7rehbq4t X-HE-Tag: 1729172778-403773 X-HE-Meta: U2FsdGVkX1+DcyWN6WdAesDXEFfEc/oJgSQzIQ2H55znCpYMj+ujaYJdKtEVKyXgRXIUxhfPXaZjTzUsWc3u35po8t9ujlk94paTYH95zKcs1IlecBKVLUTIA/spY0DWhXJcYnCeYI1CA/ycF/bUDXRnF4fNUzyDR6D0GtE3sIMEjxXtouinKI6UfI7lS/oURU/k0m/wjMUNbz16s8EVFvxsclWQPUBuksv2rxnMzrqUvacyGWwXLCxvDyVNrtqc7FAvxBl62adXmgZm0TavmDSGQ/w0q4OMrT9yCUJ1a96UE4202Wm3hfxyNYIVHJpicbu9BnUcvkB57Y1SamF/jiwVY0oXLgLwxAX/kPYF+i8sb4MaRsqTh8mS7dBQC8TsJsLo2g8dAKwJJjACp8/61Un/XsAy8PNQ09A2B3KQDfFDJKqC1HBM5g9jTrXfF0V/CWYdJxoZ3B5IiQZsxBFfqY3AvYCPg1syqOUbXyZSUVFOUygQtJ6VhKOXzvL6giYgI/dcWGPCWbm68knYNUUJL7TspnTdsjcbPOMyy84kHeYPw32cSvnAhxJWW9V+5ExMwNFSr6tJd3tP/pE4Mpo6VPcFdNTrUJcFHemACBOLilAuuMXBzRFqW719PleFp4xr5UO52UnD8NS//bFRDR9+lyH+Hu1LLAwxcaWf63S3rSujmd7lL6C3sFDwbvncwqOcyJAEXH92oc9IiqvNZ5LwiM9kXrCrGdwa/SIeH/BtfFXPncMG+K/8qy1Gbs4kKuAd7ravE3UNUNf1UJsrMlTGa9hI1LlnIRtSX5mkxHW8IblCCwDNNaP1lxiNPCk/xb6Z8Hj+NzLYW3x59ShsvaxZE4AP6VrQinqUEdTpvEgcwwFDZie5IvIQck1TEl1sAYry2OfblEC0FFOiZVQrmILhqYsh2fqu+2yXLaCPtSpudiyAjimU4RBGoZZ18nyzP8IWmONor5y1RCbvjE7/6R7 SEJVzhwa gzmzbV+q7uKAwUCN9ztgWCqjYU+9bh+nTTesmZ4uE5sbGTaeLf+8fSHRbEI+GSn0aYscsKKFUnNTzvVOxb/7zEYD7ZuEHbmJsws/hGlvy5dygnu/EX5XrCX0wgCLAhVw1jB2J5LyrF2E1m++b2zdhfFGavcyYmaV8JU8z48XRCYUPYeNVrkX19FfYjzNT73OxJuqTe0m1dIQs3KUdIC9T5ZuJ/XvKqiHHiVu41qPxPtcGXb1jS4v7qIR1r3YLfo2to3u9ivNBoKQuGT2SKupWe6iSRmw/PgIbJkFg8/KINMfApO1OzgDg7lrXCtm5RFzHdxkdWKBWX+7tOzM4w4K3WsLsCYunNdX39SPhHvcqE093xuFVq8r3B/z+YViCABl+VaPIMBcnQbQeuomjoC7Tbh5+0s3KQYpLK8w51ngu1RhvzmiIlGc1LFZllBR5tzd1UmiMqbUom42loLUk43m7n/9H+HbIIKNLfI3Mfts+rAVbSsCM6PUZxKHrMRVlXXzftLEylqSSqMZaYgAzMJ1NptNCN39cRGAJ/zd/ 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: List-Subscribe: List-Unsubscribe: No user of the return value now, just remove it. Signed-off-by: Wei Yang CC: Liam R. Howlett CC: Sidhartha Kumar CC: Lorenzo Stoakes --- lib/maple_tree.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/maple_tree.c b/lib/maple_tree.c index 63a969d581f2..ff9d972dba4d 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -3326,7 +3326,7 @@ static noinline_for_kasan void mas_commit_b_node(struct ma_wr_state *wr_mas, * @mas: The maple state * @entry: The entry to store into the tree */ -static inline int mas_root_expand(struct ma_state *mas, void *entry) +static inline void mas_root_expand(struct ma_state *mas, void *entry) { void *contents = mas_root_locked(mas); enum maple_type type = maple_leaf_64; @@ -3362,7 +3362,7 @@ static inline int mas_root_expand(struct ma_state *mas, void *entry) ma_set_meta(node, maple_leaf_64, 0, slot); /* swap the new root into the tree */ rcu_assign_pointer(mas->tree->ma_root, mte_mk_root(mas->node)); - return slot; + return; } static inline void mas_store_root(struct ma_state *mas, void *entry) From patchwork Thu Oct 17 13:46:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yang X-Patchwork-Id: 13840068 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 5161FD37491 for ; Thu, 17 Oct 2024 13:46:34 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E9A0B6B0089; Thu, 17 Oct 2024 09:46:32 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id DAE116B0092; Thu, 17 Oct 2024 09:46:32 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BBC1A6B0089; Thu, 17 Oct 2024 09:46:32 -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 98D1E6B0089 for ; Thu, 17 Oct 2024 09:46:32 -0400 (EDT) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 8378D1C723F for ; Thu, 17 Oct 2024 13:46:19 +0000 (UTC) X-FDA: 82683218604.27.E0E70B9 Received: from mail-ej1-f46.google.com (mail-ej1-f46.google.com [209.85.218.46]) by imf12.hostedemail.com (Postfix) with ESMTP id 56B8440012 for ; Thu, 17 Oct 2024 13:46:25 +0000 (UTC) Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=F9z223jW; spf=pass (imf12.hostedemail.com: domain of richard.weiyang@gmail.com designates 209.85.218.46 as permitted sender) smtp.mailfrom=richard.weiyang@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1729172742; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:in-reply-to: references:references:dkim-signature; bh=UJ+bQOr9/QM0H0RV0ApGOWUZvav2eGO4ARNqrpdi1d0=; b=3libsgUWQrLOERcD7P8Bljj0lk8m8ZUqZrGbDikR45kRXllA5r/mAVeBrDC6ZuoCvpdDqZ IWOyTg+lyc2lj1Iy4SMjt8GvYvfcpkvoZpEL/kjhssd4e2+AfxBCB5VZF+ylBbbb7cetf9 1oLOxPsFJVRYjJe9lrpuuRjp1FTQbhg= ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=F9z223jW; spf=pass (imf12.hostedemail.com: domain of richard.weiyang@gmail.com designates 209.85.218.46 as permitted sender) smtp.mailfrom=richard.weiyang@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1729172742; a=rsa-sha256; cv=none; b=IcHn7YWd3jXi/EmbwRLOsMH1RJgDF2q2/VVLB71doDHpAJDzlMw+bXegppcaB998mVBk0j 8nf5ZIK1Y7CA/mV5y/PHLxpWCF7WPeeGLoEwIXAHrPxZ/zlV8d6A7Pvx9XJhUVevZicXvg P0Av7i8Zn8a3e0pUWc1pgO1e5E5JcA4= Received: by mail-ej1-f46.google.com with SMTP id a640c23a62f3a-a99f1fd20c4so126956266b.0 for ; Thu, 17 Oct 2024 06:46:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1729172788; x=1729777588; darn=kvack.org; h=references:in-reply-to:message-id:date:subject:cc:to:from:from:to :cc:subject:date:message-id:reply-to; bh=UJ+bQOr9/QM0H0RV0ApGOWUZvav2eGO4ARNqrpdi1d0=; b=F9z223jWC6uDY7N0Wvk/4BYTO3OLkVJSIqZe3kXcLcfpWhKDUD5I1/67CB1VqLPlh6 4yw+roZYhU7MUHOV18tnhnzSIUKwGLB4NQJIi9c46hbiQTFTYur79Ujvu6WejhfcAN6G Z6KiH4XWWkwueo64EqpETboJV7uWBqtko3saJqDzrlcTxqJAkXorUGizIvGwsYmGpMo3 8+8t1rz+PlLnapbpEqNwlCLRHjrwp0pNF4vDRRiKTvCffnckdKJBk6ZP43xjuHHx31YO GC4JuYGd2Mr1aX5v+C9b8WzGpFNqOOu8buZ9dC1ycrn8lHKaNZvExVO2wqisfOzZu0H4 uIrQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729172788; x=1729777588; h=references:in-reply-to:message-id:date:subject:cc:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=UJ+bQOr9/QM0H0RV0ApGOWUZvav2eGO4ARNqrpdi1d0=; b=ru9iF7FlibVT28OX4RwsrKa3vwqpAAA7bHEdRS1GpLUnaVvD2MeSbOw3uttLsLeKIM oEnAj+YO4RoBJDzBXipF3pNBPmYbNIp5UY7Fto+isfixygsZ+aExoJ1eUNu6KtxlHBaU D0xG5pLdH7PvTyFDHuAz6aq6m7OyZ2Z0pB/RmLn+8Cwh+E6NySJf3L4SNxi5A9sJlW4D zwPQAMgv+uAD/bRBgTf5u1GAhiS69RuEyo54rM5/uTRUSE8Ftvt+RRwhHA9tUzLIV1+x oQoFCyTkfIJy9WU32yqF/SQF6ZuXk/A4vQ8J5oizjhQPPRoE0kmVwde0FLKDvBo+rU84 2+EA== X-Forwarded-Encrypted: i=1; AJvYcCV6nEqcmEsINmuCk0opAD43uK7sSKGTGF/H4iUkODkv9g++3XHABLsMT2h5MaRCyoZB2p6VaZb/cw==@kvack.org X-Gm-Message-State: AOJu0Yy8h0085HpKxX/rzJiUxvNBX5xJDI4kjrdKsjfLMih8uoLw543F xhx+S0G0gvMzt1dFmYunzjXc2rXCx9R0zqnt40rQhkV+UA36qFRcXaZfsTOS X-Google-Smtp-Source: AGHT+IGw8HkQAhg4F160G1+4xn7VcrsuB/0JlG92c9b4F7StirUCFDBFkdLld9oSrjt1hdmUwtceMA== X-Received: by 2002:a17:907:3e1b:b0:a99:ce2f:b0ff with SMTP id a640c23a62f3a-a99ce2fb227mr1873098866b.33.1729172788248; Thu, 17 Oct 2024 06:46:28 -0700 (PDT) Received: from localhost ([185.92.221.13]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a9a298443b9sm300399866b.170.2024.10.17.06.46.26 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 17 Oct 2024 06:46:27 -0700 (PDT) From: Wei Yang To: akpm@linux-foundation.org, Liam.Howlett@oracle.com Cc: maple-tree@lists.infradead.org, linux-mm@kvack.org, Wei Yang , "Liam R . Howlett" , Sidhartha Kumar , Lorenzo Stoakes Subject: [PATCH v2 3/5] maple_tree: not necessary to check index/last again Date: Thu, 17 Oct 2024 13:46:05 +0000 Message-Id: <20241017134607.30206-4-richard.weiyang@gmail.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20241017134607.30206-1-richard.weiyang@gmail.com> References: <20241017134607.30206-1-richard.weiyang@gmail.com> X-Rspam-User: X-Stat-Signature: pkq1bhw69smnyk3tbshss3wyx1aa138g X-Rspamd-Queue-Id: 56B8440012 X-Rspamd-Server: rspam11 X-HE-Tag: 1729172785-917129 X-HE-Meta: U2FsdGVkX1/JKQ+5jovyPfxlZLjWNslqv9v9TLEQA2c3o3ISLkAoJiwyJ+tN4E95h0+OhNf9ISzA+p88OlwI5pulaPa4MvYuNrOQM4mbJBOo400MO3Pg1lVYezbw0nCQa5Q4X8TToEnuASV0DHjO0PLVxYRMjqHwHn2jsMXDFQoVQm66lXq99UsTSw3bjZzfkQS7w1+onYlOoen+A5wO97S+FklNPqcLBLTIbASaAfHkfH1EHs0DTvNzy9EcEoLDbwbRwK4kgZziK7D2fiC4o6jiwHOLaD8nh8HajgBRN0sjVhTNc5PS2Iw9fT1L2bNHANQvT62PqGaNJVDBW0SLmkySGLOCJi8invOTansA7EJfEDU8lbANOQOH56G5T+n0exA5/VyVbAfROZGEyCuBgPAs1LB/2pK//nGQ9W0nIS/Ko8nJhUy9KZH9KhyQA9yAB9AN6EzEqaGzgIviDYvPReLOLrRKHrBFeelc5eEoyxLNdCAL3wIIfUQPjI4irtLcwEmm1FY+UWdWalqaios6f2ZAfn8Jest7vF75CXyd08tlML/CRZsBdSVt2MEn3pD+YdPnkY2rhDZ+K88laV9jKEkq5FKZDSKvWyuA0/pW1kbJ2VNnSvtnCIE3o8UGY+ItljlvjTxNwkxpTXbtwF4fOJzmmjwtZZEuEyTCMgMU68G4ANGY02jAN4/3/txD15JKBCaOlDfckLopcYxV8qnjyJNfS2QJ4C8arOHuBye1d0mrzNE03GIBMgHnXpNrsc0CJF3mpIR1sMpye3led97hPAIs5Lj93eFtvnPuYwUBdycQ+kSLW7y6QEbI/+NnqSswySZ9ceY6D74uR2c3hXKdxf1xh+mpPJS7buLwJrxwZqL9y3m7nZmRqiOdKt0G4GdX5N0pMj2Hkjq2/TMmFvwlnOT6Cb32mg9WEHRAITFgTpLJnEprFR7NpENXPntFJGJRFNfveg1Oe7lIQsXa/01 jPFRNuEP 8fByJGQRb2ItfzCb6PQe4LrHS1AwUce7HARc9Q5ecePURkt0QfS0y9/gxbrQp++DugTpf/+wOS0Lg5cd9TdrfVUfSCMxLVOSOFmTaPQCoJWMjqO77ujuqg1g8cyHbtrLq9yMtd/N2nMR+g/zUn1bbZcjehB+s9QCykUlwStKd5YQABRAnvFTlqQL0zF3lMCkw2/hyWklpInIzIosS1Bcs7woZU1qHJtGwVoH1r/vtAc7pariNE52AO8fHQx1f47BHzvMIIkefUWD977TCa4iN8CzcZ/6VEL56ldeWQfPGWWxZat8R8oMjzrUtKfEC10Z90mXoZi8ifNPJEuLYZggVTL1K6DVGBqESLAD7C+wPqb0N3g39djmA71KVBCsRBSB5P5iYrjOAxUr9SIptC5ak/bcFwD7PfqMHpbdB35pChaPsMyT0wj+n6CUu1PC5k+Y9nt+jatEF3iwbXN9SzaahFHOE6h9R41MRARwjZ7/t3PI3spTgDNhyLNokFk3LhnJCxxTy X-Bogosity: Ham, tests=bogofilter, spamicity=0.000146, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Before calling mas_new_root(), the range has been checked. Signed-off-by: Wei Yang CC: Liam R. Howlett CC: Sidhartha Kumar CC: Lorenzo Stoakes --- lib/maple_tree.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/maple_tree.c b/lib/maple_tree.c index ff9d972dba4d..a90c29156fe2 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -3591,7 +3591,7 @@ static inline void mas_new_root(struct ma_state *mas, void *entry) void __rcu **slots; unsigned long *pivots; - if (!entry && !mas->index && mas->last == ULONG_MAX) { + if (!entry) { mas->depth = 0; mas_set_height(mas); rcu_assign_pointer(mas->tree->ma_root, entry); From patchwork Thu Oct 17 13:46:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yang X-Patchwork-Id: 13840069 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 00C98D37495 for ; Thu, 17 Oct 2024 13:46:36 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E706B6B008A; Thu, 17 Oct 2024 09:46:33 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id DF8EC6B0092; Thu, 17 Oct 2024 09:46:33 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C4B156B0093; Thu, 17 Oct 2024 09:46:33 -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 9A2EF6B008A for ; Thu, 17 Oct 2024 09:46:33 -0400 (EDT) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 0B31016143F for ; Thu, 17 Oct 2024 13:46:21 +0000 (UTC) X-FDA: 82683218478.20.274B586 Received: from mail-ed1-f52.google.com (mail-ed1-f52.google.com [209.85.208.52]) by imf10.hostedemail.com (Postfix) with ESMTP id 15D80C0019 for ; Thu, 17 Oct 2024 13:46:26 +0000 (UTC) Authentication-Results: imf10.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=HkthxkUf; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf10.hostedemail.com: domain of richard.weiyang@gmail.com designates 209.85.208.52 as permitted sender) smtp.mailfrom=richard.weiyang@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1729172758; a=rsa-sha256; cv=none; b=Gf3M5o0vSGt50DHL75YJ2+h0Q+QTQmxIPeRVsB7lBoYpzWZOY95eUqaSuNeTNMRBxxoLMq 9cUPAny2wwluqnw+3QAZCa+rAUB75gAQWjHKWhSONuELf9mhepSFa30sx245BkBfGi+4Dg 5bhTiC1ORQVl0rRDKgeVb9APn3b5HjA= ARC-Authentication-Results: i=1; imf10.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=HkthxkUf; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf10.hostedemail.com: domain of richard.weiyang@gmail.com designates 209.85.208.52 as permitted sender) smtp.mailfrom=richard.weiyang@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1729172758; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:in-reply-to: references:references:dkim-signature; bh=l4KlshdcAGBITRxoNc7cGIOi3SZuuj5B9eyadiG0Uzo=; b=B9ParPIB131eMuZ6XQFwQWSyxDI7ziCMFtXkvqOB8vgORxh9HBzuozZ0REDZyB50uc4zd+ 8uwe9etq8hQ3FXUyh7JBQJ0wS017Wj+2wemdT24lRiCpw2Y9nozqh/vb4MXDCNVDthIgzD twTJDfaRpFVV42jzTRucjFyXU2tJ+N4= Received: by mail-ed1-f52.google.com with SMTP id 4fb4d7f45d1cf-5c948c41edeso1218663a12.1 for ; Thu, 17 Oct 2024 06:46:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1729172790; x=1729777590; darn=kvack.org; h=references:in-reply-to:message-id:date:subject:cc:to:from:from:to :cc:subject:date:message-id:reply-to; bh=l4KlshdcAGBITRxoNc7cGIOi3SZuuj5B9eyadiG0Uzo=; b=HkthxkUfMvrzK4rqFEUNPJHdolTB7+LX5BeRo9OY0WI/uc99vESeJi3kzVIKLK9Gq7 2nbUgQwhw1jCk0lJFBsKL/D3WfPy+2rX9xx0jr9XlX4LZ5P0oUY/g2ARBHqJ9SuT0GDp o3d4lD0iz1Qj0DBTEi6s4QL0EiNHhcqQR4ZdAZocYWAZEo2zuajozqazBMLBerj4W3MM BHM0frWlGeyARCAP0aLXRnDLpN6GV7leoNV8SIUtF15BTtl2Nne0nF2BtmSXCh6HQAdV LxJEbKFVQRgj6x6hMnjpoeSYfXsCk+hHoetjiQMhhCAra0gqmKYvYwuw6wSb6DVskyrA Wd4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729172790; x=1729777590; h=references:in-reply-to:message-id:date:subject:cc:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=l4KlshdcAGBITRxoNc7cGIOi3SZuuj5B9eyadiG0Uzo=; b=gjW22dhqxd8OMn5YU8d3FghhvN5Ctzz4LvDFEHHT/UA8XbBsInEIgeh85k9JvMlNk1 f3IonyRHSuYv0Lb4ssTo+UFVjllijJ6zHpRb+xJbc2yiNXtoxIYdNcfeZ3JTlZmXyut2 3zOICmQ2KM0tWM89hu8OdLBnkJ6K9ATbgp/bv+HEh2Xb9xdcs7LxwnlnBYUw5nlL2vwo i8Nyp3ByxxVk7So9L7BPgr5+PRGthpadakdN6K2L+dIyoM8OJ+U0pfhW1Ihz+M4i+O6c ljmLTXXLiyeeu/cD6PitSewmPAvl+xqP5ik8yJ8cuQ2wgDuANncBRQvR5kKrA+yR0++a zwag== X-Forwarded-Encrypted: i=1; AJvYcCUrsVHmqJacL/02zeQcjhSEQGPoEg6aDqFhRrNLKN5gPlLPe8IPHgYgXX1Uq6tnmkwaf0h1OOqkbg==@kvack.org X-Gm-Message-State: AOJu0YzoM9FVN5ig6v7YUmjeRsmyW3Am54QqBMDyKHFxNYB3e9zL1mRD rgk+gaB4hfaiXqRTzrDEyjfiOW3HTOMPVbXpmUP1eaF4LfO1B4SWRyBKT2gP X-Google-Smtp-Source: AGHT+IHImx1d1O/6cwAX3TWmEzp/CgNdlPdgMg6RM+qOfS/QWKac/K/5fKxRq3Y/S0iyB2UMwiuEdg== X-Received: by 2002:a05:6402:13c3:b0:5c9:2a8c:8961 with SMTP id 4fb4d7f45d1cf-5c948d48286mr18272009a12.22.1729172789814; Thu, 17 Oct 2024 06:46:29 -0700 (PDT) Received: from localhost ([185.92.221.13]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5c98d4f9dc2sm2787071a12.38.2024.10.17.06.46.28 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 17 Oct 2024 06:46:28 -0700 (PDT) From: Wei Yang To: akpm@linux-foundation.org, Liam.Howlett@oracle.com Cc: maple-tree@lists.infradead.org, linux-mm@kvack.org, Wei Yang , "Liam R . Howlett" , Sidhartha Kumar , Lorenzo Stoakes Subject: [PATCH v2 4/5] maple_tree: refine mas_root_expand() on storing NULL Date: Thu, 17 Oct 2024 13:46:06 +0000 Message-Id: <20241017134607.30206-5-richard.weiyang@gmail.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20241017134607.30206-1-richard.weiyang@gmail.com> References: <20241017134607.30206-1-richard.weiyang@gmail.com> X-Rspam-User: X-Stat-Signature: b6s6dh6xanwwngrt5emtk3p1ym56uikh X-Rspamd-Queue-Id: 15D80C0019 X-Rspamd-Server: rspam02 X-HE-Tag: 1729172786-331491 X-HE-Meta: U2FsdGVkX1+Po1uJvJlJIgQLUkXpyd3NlUjgWAsPluSM36eMUKIjRZoZFjO9jShC+mRm8oCO1ODGGO0d281GNvB4QO7320ptiF6W/wm8Da3Vkvdka9Qm7U34QN8pKgNdX8vA0NiTC6uUaaitedam8eEjUcWV0+8xePLg/3mYYqmggssyajVzjXShNCnSSRcFizkxsRI8gHxLRWiLkjII236HiUMvZr8u80uDOBqZsDFQtWza5p6igr29fdVx1X8Q3BHD/pfqD25LrJPA9hbw34pv6F738MMluKfeWogLrBxAVc2idv9sHlc78zal2AGA4oy+NXQ0ySzVj7lMyAWhbpPTnOKRBWcu3odNFY8V4PQr1i8ER7GqXtOfjlLGGFX5f1slw8Oz6DgeFdyv6nq1uQYt5yaazSxq6t78Mh5qYYrc9mPr8wBSmHmrlDhhB1QvBBnj7mPraBinmCItvct6gzS9v+adzCWQBGmiclYVp51SfmxAP8t/Kf7l7PFgqPayuZmhoNia2B4Tag0j7NEKsKBKTAp4S5GILBFdEih+jQpumocwVOFSjXQGs5Ql1l5zmKqxrclT8NHzeaX5HYDkSj4aJsYROBE76fyGM66Il4Ia6p7rwAkWs5LOO1iL0StoQm6n4E6RZsl+h/bqxLFkEoizGn4yIVrFyQ+W0AJoP7rzCtGS6UmKYxqoX+ikyl3C8c7kbirydbet4HBPpBaVsAhYUCdhcf5azWZiwI23jD+KBIuuKWmftMxgjEK/OvlEUJf6fkbfYUjei1hRrETssYB0Bn0SeWmafbW+acLCVo9Ns7wq3kzzBCd9c41gosgCgxNL5ZJwuBvaxNXtwS4KJznbZe8ObvBzagF0w4vjIfUb9s2q+jDDMQsiCHrdaIb89kOfGtpSN3M3kxNJHr0MbF6/yPHLVrnTviY5UOUFUChpQ7zTILI+uS0CRmQRcKLGcxUr+8Ff/B7GpyIFQJz 7V+xLYpO eH69UyaOvY2TDUVVaossTUPHWXz/nUjqSVeFgwlR7MoF/E66Wm0fLP+A3SE/rTN8XngPkmdWICnOjyItXDshLrzXwP6l43+iFJ80hZM38ubQTVnstsOMYcGwd6w4djS5VlNIf19dGxc6OSnbIejd5jqMICI06hR9dW1OtG36Cr4gUeKaYRDehrBXXRf38nXfLNukw5+4VZO4VvG/etulbtvZlPhTe8T4rKzpOHEJa5+8jd77o0aWDMlJJ+0wC8A7Lg/SvuFm+udxlyBjcmwiD9+k83QM8zCkiSMAIplHDUtOBYUvG7evpH4hohKphixrqhUC7ZWN7Na6wtWU3VNJrQRoVH6JgnwMINSss/Y+tS8WM+FGR84GMpLQlv3Se2RYyRFx7AdCQJGPqgsagY+byosbIvI8xJ1PeF6kUOXnd8I9fQYFMTmBVY1TQiBhRIZ/E5CVaAdSnrmBVcThipIisdi+lv5zv/T1E0ndpW998AFoKI250A5xMdw0nzF0stSdSmj+g 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: List-Subscribe: List-Unsubscribe: Currently, when storing NULL on mas_root_expand(), the behavior could be improved. For example possible cases are: * store NULL at any range result a new node * store NULL at range [m, n] where m > 0 to a single entry tree result a new node with range [m, n] set to NULL * store NULL at range [m, n] where m > 0 to an empty tree result consecutive NULL slot This patch tries to improve in: * memory efficient by setting to empty tree instead of using a node * remove the possibility of consecutive NULL slot which will prohibit extended null in later operation Signed-off-by: Wei Yang CC: Liam R. Howlett CC: Sidhartha Kumar CC: Lorenzo Stoakes --- lib/maple_tree.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/lib/maple_tree.c b/lib/maple_tree.c index a90c29156fe2..15d2124acc36 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -3335,6 +3335,24 @@ static inline void mas_root_expand(struct ma_state *mas, void *entry) unsigned long *pivots; int slot = 0; + if (!entry) { + /* + * We come here in two cases: + * 1. This is an empty tree + * 2. This is a single entry tree with range [0, 0] + * + * If this is an empty tree, the result should still be an + * empty tree no matter what the range is. + * + * If this is a single entry tree, we should set it to an + * empty tree if the range cover [0, 0]. Otherwise, we don't + * need to change it. + */ + if (!mas->index && contents) + rcu_assign_pointer(mas->tree->ma_root, NULL); + return; + } + node = mas_pop_node(mas); pivots = ma_pivots(node, type); slots = ma_slots(node, type); From patchwork Thu Oct 17 13:46:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yang X-Patchwork-Id: 13840070 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 AD5D5D37492 for ; Thu, 17 Oct 2024 13:46:39 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9B5EC6B0093; Thu, 17 Oct 2024 09:46:35 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 96A9D6B0095; Thu, 17 Oct 2024 09:46:35 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7935D6B0096; Thu, 17 Oct 2024 09:46:35 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 506A06B0093 for ; Thu, 17 Oct 2024 09:46:35 -0400 (EDT) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 65D7E41429 for ; Thu, 17 Oct 2024 13:46:28 +0000 (UTC) X-FDA: 82683218898.16.74D2A50 Received: from mail-ej1-f44.google.com (mail-ej1-f44.google.com [209.85.218.44]) by imf22.hostedemail.com (Postfix) with ESMTP id 3777EC0013 for ; Thu, 17 Oct 2024 13:46:20 +0000 (UTC) Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=ftouWhaf; spf=pass (imf22.hostedemail.com: domain of richard.weiyang@gmail.com designates 209.85.218.44 as permitted sender) smtp.mailfrom=richard.weiyang@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1729172647; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:in-reply-to: references:references:dkim-signature; bh=vQUsLpJVYTnYrFCC75ffC0wcR/GYWw0KCo4i+B13an0=; b=fjxsxdoD/RV1InQmsI+rdZR5oJPiA5e28ES6u2xS2zy3Tw/hmfFMhXjWisSeKL7JM29Y4q 3jLVW93XzbuLiFEHEFH5aszRtWIp+cQwoFm1ChCj67p4jfVRTw2hjvzxMbeL709/ezzJkH AlnJrgOZnfz6joyvKmmfq8cn/0cfKQI= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1729172647; a=rsa-sha256; cv=none; b=PriP5K0G28M116bDuk74EtmKZYLtKxMpbWXTodavHwP17pbqEJYdFpcrQu1RKffqq/VbES kfJ1SLF/eglPWeD/au+Db6wS3ja3UZ//b3myNFDDLRg9CXPExxnAbSAMiAxH327VrfuMZU eF/kkZjbc9/rO+l6N5bw8qTxY2UeL4k= ARC-Authentication-Results: i=1; imf22.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=ftouWhaf; spf=pass (imf22.hostedemail.com: domain of richard.weiyang@gmail.com designates 209.85.218.44 as permitted sender) smtp.mailfrom=richard.weiyang@gmail.com; dmarc=pass (policy=none) header.from=gmail.com Received: by mail-ej1-f44.google.com with SMTP id a640c23a62f3a-a9a0084f703so131488866b.3 for ; Thu, 17 Oct 2024 06:46:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1729172792; x=1729777592; darn=kvack.org; h=references:in-reply-to:message-id:date:subject:cc:to:from:from:to :cc:subject:date:message-id:reply-to; bh=vQUsLpJVYTnYrFCC75ffC0wcR/GYWw0KCo4i+B13an0=; b=ftouWhafNIYapXEKYILA+zqgmZuT+5O4d6pnOc+HYDJE0WWM4vvtJBqlzlB/gpRdPa RrQlYe4I7oa9VBl7w8XKuVxYVenmiFaG1fZH+s59N8soDqHJuqTMZQ5p+xmNcSkw8qWa iPKdXphbwR7XXS4H5h5NAvuHKtQe39XgjxLKuDH3hPnx6rt3uEPlIIzRukKnhhvC/K/s +6Qa+JyJtJB3VEP9O/NsFVs34RLCZwu22a6skXLJ1NDnQQj6ghPje/l9isEus5ycSKHF nWiJNG/nRmjLOBwRIcgszZd+gsFc8w+RTT3oifog7zI1o0RixFGDP77DdDBzTl88wxpJ S34w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729172792; x=1729777592; h=references:in-reply-to:message-id:date:subject:cc:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=vQUsLpJVYTnYrFCC75ffC0wcR/GYWw0KCo4i+B13an0=; b=weyp74wblqAumh5RkDxevIOVkVKfPjbiRQqBCRyNv8DzW0SlQ01FfjugVfDBrqtd9O +8nF6ce8Aq0xc2Gpz/2uY5/bKxEM2acr9Lnpx3MtS2d4tOnIKi6TJQn3Okm+mDAyAKWW IjPyADUcrzNpZouXAJGQi0rF197uSz2SiGim4cj5A+frKrAJmUeShxVQ9DWwCSSsVmeh u9yIEPsHfqU0n07qBRrCL+Dl3qu3tNlLoMyDTg7nVqOJe5EaYtGkI0mH++JpTZvViKnG uQ8iqvQxRzg+TlNnTyTUM99eastSVcchXEfU2SggYvbSlUEZtFClz+YfmtYFoeRFSrMF MhOg== X-Forwarded-Encrypted: i=1; AJvYcCVadvcxUDocUR6igiRJvcg2A4WIwwG/hLQ8yEGMrr7Pc+FymxFkyVrZ45RxOCZaha4iBc31YT4TFg==@kvack.org X-Gm-Message-State: AOJu0Ywc5ix5/PPZTlvl4F58tyTf9aXQ1ULOYQVihEBUGQ0/VTZuF50Z 7xZuobDMI52871zamhEFLpXhgIQKH8BddiBgaXAChMkz1l7wQq6a X-Google-Smtp-Source: AGHT+IFLHHKovlEcSp5LeVVlvgM58L1AB9wvK9Zmq617AL37nHverGskkXGKCJSittusdeStlcZ4Qg== X-Received: by 2002:a17:907:f789:b0:a9a:4a:284a with SMTP id a640c23a62f3a-a9a34d714d7mr670402366b.26.1729172791473; Thu, 17 Oct 2024 06:46:31 -0700 (PDT) Received: from localhost ([185.92.221.13]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a9a2984dc13sm304730466b.149.2024.10.17.06.46.30 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 17 Oct 2024 06:46:30 -0700 (PDT) From: Wei Yang To: akpm@linux-foundation.org, Liam.Howlett@oracle.com Cc: maple-tree@lists.infradead.org, linux-mm@kvack.org, Wei Yang , "Liam R . Howlett" , Sidhartha Kumar , Lorenzo Stoakes Subject: [PATCH v2 5/5] maple_tree: add a test checking storing null Date: Thu, 17 Oct 2024 13:46:07 +0000 Message-Id: <20241017134607.30206-6-richard.weiyang@gmail.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20241017134607.30206-1-richard.weiyang@gmail.com> References: <20241017134607.30206-1-richard.weiyang@gmail.com> X-Stat-Signature: 1wxro9jj5bft5ffqu348p57ooef5846y X-Rspamd-Queue-Id: 3777EC0013 X-Rspam-User: X-Rspamd-Server: rspam08 X-HE-Tag: 1729172780-300969 X-HE-Meta: U2FsdGVkX1/MA/SUoCQDsJsyOSSfJfLGWv6LsHZG0Pj8dFxOTxvnkwSWie+Gtae4EzP2b90WhGIl4PfFrE/z98P08v1aD3B10oyjPopsuu6i2qNI0xCP8sZhc5EQx4xP6wCoBF6HSVI3G9kXWIy65vtZPuf1qchun9JKfWMFPK7wR/KzheHD1pNf04PA9BA+8JAtyRKcMzRyNeHUmGsys91HFRev8b6qm+AU2q49iohlWTfvUevLoqdIg8B0ljWZT7cE87GYuxy1dkmrIlqiJP74nrxq0Q6sIgKGBAfBvAXb7dx7PcrvLcPRvaOLBoC/0S2FyDCISi8/OR+dJqG95D9MT15MvvOrl17ninzYmEyEtNQqSVmvk4S4s44soFilGq1ZrkFPlh4Y5rdmvgseGSbPuYbx5xkyY3FGt1yvyci8QVLZ49UHwuH+sDT1B3rzO+uxy505dUfzjJjIzhKQ6JnwhmcX43BUBUzM+eH0sUTRq8EORTp1dbXmfYqUX8W3GnwdP+VjLsLHnrctTn1t9LjGaFRbbkYQgQpX3CBX9fK/x71OFL/L+7VCGYorvEa8fufx9pTj6+RgPEopNOd2G5TEu+uytdz0aN1bIhLM+WirhzeDrF44yTA9I8S0vP3V0To36TIUtY8Jrhp7zwdTFMu+quJrtblDXdOO919KsoTRiy/udJxCEknxCkJl89pHFz/VZpLSH+DMbWievSrPYxXXP1nyY0GW2hA4V+P1UBnNotaMEGA2PgGo1C9UnaSpzYct51Sld41pJ7To0nicUH9tYwaCOfiEBrPQUTvZ4r/MVVvtTwx30wQZp2kOqdBI5MXMwrqHONZi3MfVD6l2slW3e5tcHS4Toh4HBla3fPM2QGjlcN0QYoGQWVy3lI2t1bkXHSdVX4Nex94HY5tVzLUTfmEBcaoYrCadgZa0qYB2+6PfboVJsIX4DIT5tIXPjQbjXgdbSXzW3Jm3Fnz MXRwi8E0 9Jbk2ctlO3Vq0ciYrAv5/KP0kiouVeoZhBnHKJxFGdt/wFj+U2kDHlNTuavve6PB8d249lGd5KF4V/pqc9nhVHOX6IZMIq8dJclhtY8XSt3yv8Sf/20wRtr8K4pl+JC98aVMrZ1UTkB+5tmiZNoPm+MrzQ+unHZUc0DB5Y6N6rg40bOjQHTzS5l23k5gVoRy4sq2iEhbeP9DSZ3dANjAMxMqtaerLdcZ92e5YAWgoTlBBphpuVxPIUx9+BZqj2tRKDs06eddMRm/rL4/xVNcHP8dqXlQA1qYNGezfvkrQZgmvhUOfPzB5RreRIeIsY9gu31yBaEk8aW7q4xENrT8MxFMBRy09+402HRkCllr0M/fhed9TotXe4S6TUFQ7DE4FpNQWvmDdT9gmvFVpFdGgEoUDiecgvlLOX8kuybNn5Uu3enYBA0yEOto1hLfSAg2kjQUDSxXCt2s47ZPuX1yprBmeOgIkqo8g9n0xTQkoCpZabs1JlygC1KK9Xgr8CA44TNzF 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: List-Subscribe: List-Unsubscribe: Add a test to assert that, when storing null to am empty tree or a single entry tree it will not result into: * a root node with range [0, ULONG_MAX] set to NULL * a root node with consecutive slot set to NULL Signed-off-by: Wei Yang CC: Liam R. Howlett CC: Sidhartha Kumar CC: Lorenzo Stoakes --- tools/testing/radix-tree/maple.c | 73 ++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) diff --git a/tools/testing/radix-tree/maple.c b/tools/testing/radix-tree/maple.c index 5fde09999be4..fbb08f151b01 100644 --- a/tools/testing/radix-tree/maple.c +++ b/tools/testing/radix-tree/maple.c @@ -35867,6 +35867,75 @@ static noinline void __init check_locky(struct maple_tree *mt) mt_clear_in_rcu(mt); } +static noinline void __init check_store_null(struct maple_tree *mt) +{ + MA_STATE(ms, mt, 0, ULONG_MAX); + + mt_set_non_kernel(10); + + /* + * Store NULL at range [0, ULONG_MAX] to an empty tree should result + * in an empty tree + */ + mas_store(&ms, NULL); + MT_BUG_ON(mt, !mtree_empty(mt)); + mtree_destroy(mt); + + /* + * Store NULL at any range to an empty tree should result in an empty + * tree + */ + mas_set_range(&ms, 3, 10); + mas_store(&ms, NULL); + MT_BUG_ON(mt, !mtree_empty(mt)); + mtree_destroy(mt); + + /* + * Store NULL at range [0, ULONG_MAX] to a single entry tree should + * result in an empty tree + */ + mas_set(&ms, 0); + mas_store(&ms, &ms); + mas_set_range(&ms, 0, ULONG_MAX); + mas_store(&ms, NULL); + MT_BUG_ON(mt, !mtree_empty(mt)); + mtree_destroy(mt); + + /* + * Store NULL at range [0, n] to a single entry tree should + * result in an empty tree + */ + mas_set(&ms, 0); + mas_store(&ms, &ms); + mas_set_range(&ms, 0, 5); + mas_store(&ms, NULL); + MT_BUG_ON(mt, !mtree_empty(mt)); + mtree_destroy(mt); + + /* + * Store NULL at range [m, n] where m > 0 to a single entry tree + * should still be a single entry tree + */ + mas_set(&ms, 0); + mas_store(&ms, &ms); + mas_set_range(&ms, 2, 5); + mas_store(&ms, NULL); + MT_BUG_ON(mt, mtree_empty(mt)); + MT_BUG_ON(mt, xa_is_node(mt->ma_root)); + mtree_destroy(mt); + + /* + * Store NULL at range [0, ULONG_MAX] to a tree with node should + * result in an empty tree + */ + mas_set_range(&ms, 1, 3); + mas_store(&ms, &ms); + mas_set_range(&ms, 0, ULONG_MAX); + mas_store(&ms, NULL); + MT_BUG_ON(mt, !mtree_empty(mt)); + mtree_destroy(mt); +} + /* * Compares two nodes except for the addresses stored in the nodes. * Returns zero if they are the same, otherwise returns non-zero. @@ -36344,6 +36413,10 @@ void farmer_tests(void) node->parent = ma_parent_ptr(node); ma_free_rcu(node); + mt_init_flags(&tree, MT_FLAGS_ALLOC_RANGE); + check_store_null(&tree); + mtree_destroy(&tree); + /* Check things that will make lockdep angry */ mt_init_flags(&tree, MT_FLAGS_ALLOC_RANGE); check_locky(&tree);