From patchwork Fri Oct 18 02:39:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yang X-Patchwork-Id: 13841025 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 0B7DAD3C53F for ; Fri, 18 Oct 2024 02:40:03 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 470726B0085; Thu, 17 Oct 2024 22:40:03 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 3F8BC6B0088; Thu, 17 Oct 2024 22:40:03 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 24BEB6B0089; Thu, 17 Oct 2024 22:40:03 -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 052296B0085 for ; Thu, 17 Oct 2024 22:40:02 -0400 (EDT) Received: from smtpin29.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id B7848803BC for ; Fri, 18 Oct 2024 02:39:52 +0000 (UTC) X-FDA: 82685168160.29.B97E6BE Received: from mail-ej1-f44.google.com (mail-ej1-f44.google.com [209.85.218.44]) by imf17.hostedemail.com (Postfix) with ESMTP id 9F95740013 for ; Fri, 18 Oct 2024 02:39:52 +0000 (UTC) Authentication-Results: imf17.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b="RN/mC4J6"; spf=pass (imf17.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=1729219054; 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=SFbwtL/v7jj9bCRMSofMROxDTE33JMhX4NWUpP80bjY=; b=yHYa5wRZ1Ctv9EwGeJbaCt4+hpSNyE49WcdP53p/JoCw1BqS8V9yqLEpqnItTsL5Rm3+M6 MT1SI2GLKBxkFjlKxoLFVt3cvH+Ea3H0mzJ8i3FKfdj1+fh0t0h/PFx/ItsJvT3CMDz6Cu MAtaVZTQc4WdOzCFkZBhu8tAh35e8WY= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1729219054; a=rsa-sha256; cv=none; b=nCEvwciWlyPHWYe15aG8WEFrp4E+ZKBdEVkm4oJgHEjoRBLpUDfxd+m7mpseFpVZPH1TUF /9/5flvcsHZlODwqcLhqUvaK+5DAjVO7izeN6AnKkgGXmo6nEvG838ljVjnpMSwa0/lyoR XaAcud8bCelN4YvSCpR2DEg6B3RrTlI= ARC-Authentication-Results: i=1; imf17.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b="RN/mC4J6"; spf=pass (imf17.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-a9a0474e70eso217143066b.0 for ; Thu, 17 Oct 2024 19:40:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1729219199; x=1729823999; 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=SFbwtL/v7jj9bCRMSofMROxDTE33JMhX4NWUpP80bjY=; b=RN/mC4J6EFxTnqKRDYork559HZcjrPyIgSCb+Uf74owvOhzjxFCOfjk4jLRIZtVp98 +4xMSyHNeE3hON9K4eYzaYwvKCQ/FYC9UdnYk6V01j3sTglJv09p+b6n/UAfIK9VmhfY Js+OdlFhJ3v4Z5SPen7qvRiEGLblN1AxA7M/GIX06e60q3SrakMJj86jhtR6bYVfj+Q0 iNZhexXenr/SfA4NtlvZw/XPaiwkVm2qovx6uYilmm/L12vm/p28Ox2o6EKko71SQcYC Ngn2fZAdTetnMeV/QCu7ycT/s7sdFHrvAJzucM3fGVQIlZdAEW/cpb82GBqScoQ30tza fqXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729219199; x=1729823999; 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=SFbwtL/v7jj9bCRMSofMROxDTE33JMhX4NWUpP80bjY=; b=g3B4LPQjOOhfifV/XoaVV0P7rQIScO6qLBg0nnyiHPrAizjHAo7C5omJFDKWQc1yHV mL3pwRT8gfxDQKdx0GfeMsXGtvOVOmVDkckP6wDqV+DVMiFCkqZzA4TklGMydhHJTSia X9DocbiuBemTB+L1bWAYV7LYA6IAghNsdLx5CdSFSWMpHN+oAyiHSztWsm3BW2b3Szhq I+yWSryuwi/U9mIgm8hf3zlWRh+GPlkRO57/z+WjMC7STqzjTlqF0Zrw3IkxgXzxkcmp D6S5hj2BDQ0hK5KJlz2qh8MiMmKlBIU3G/bq/n3MdOFThaiPXZUEn1yXSrn0C8DQeQIM dZqg== X-Forwarded-Encrypted: i=1; AJvYcCVR4bNYQ/yRdSjyK9dvW67mr1UDWbDiUnXdUVorw8zvlaTkNtLu8G9PqAdBb6WCa8Gz6jvp68nhzQ==@kvack.org X-Gm-Message-State: AOJu0YzSNSHh3jTEldRnleFDtS/xkK/KjCvG5lmDShiwZXRRjHQSQrij EMTtsVNCN/zzlqsrEn8rjQaXSVL+SLa1OjK4WHobE1oiXbYdUSmc X-Google-Smtp-Source: AGHT+IE6xf+aJ7YNspX7vW2u1TFTBJ9nWV/sT0ZqfHMj9ID48Tk0ct2pnIXD6gm33jf9p2/rA56hcg== X-Received: by 2002:a17:907:7205:b0:a9a:4e7d:b0a1 with SMTP id a640c23a62f3a-a9a69ccce61mr68689166b.49.1729219199220; Thu, 17 Oct 2024 19:39:59 -0700 (PDT) Received: from localhost ([185.92.221.13]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a9a68ad506asm34002066b.57.2024.10.17.19.39.56 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 17 Oct 2024 19:39:57 -0700 (PDT) From: Wei Yang To: Liam.Howlett@oracle.com, akpm@linux-foundation.org Cc: maple-tree@lists.infradead.org, linux-mm@kvack.org, Wei Yang , "Liam R . Howlett" , Sidhartha Kumar , Lorenzo Stoakes Subject: [PATCH v3 1/5] maple_tree: print empty for an empty tree on mt_dump() Date: Fri, 18 Oct 2024 02:39:39 +0000 Message-Id: <20241018023943.13860-2-richard.weiyang@gmail.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20241018023943.13860-1-richard.weiyang@gmail.com> References: <20241018023943.13860-1-richard.weiyang@gmail.com> X-Rspam-User: X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 9F95740013 X-Stat-Signature: ppiixqhqcfk19869g69otqzym5un5mot X-HE-Tag: 1729219192-94015 X-HE-Meta: U2FsdGVkX1+yWOsY2HVB2UxA8f867bRy0Y67mgUskrFW5Pd9fMOeYMDtamlrgrJSTDWdwNjA6B0lQn30KjCi4jEvzLw+tsnASGhS+aLKCLHRSNM2neSCehjaAn/2QLjNuaZR+p8Xv8QJzxqSc1kqYWgPNgwR5o0i6XGxI7VlKmEg/4CqKrJsb8MX3jJkfbz6Lli1tKoCmqpZReVHyzhqXoMgwWfAgrBTt9D32CGq6cz/hTS3ke++D/XyTVEJfDGMiqlMbCd1m9c4zS7voKP9VQJ+gWSKINJOkM9g4RRPIP4JIRdy/ivq5GBM66p0dezRgX3k8z9dgdsIEDRmEv58gisyTGNbjyYR1nzeNU/P8rw6643iPfql+ELbGvgGSmMfXis3ZxFGQN8DDY9XPP4PhXLaxHgkeF5umQ6WAMfQvIJxrCn+vztcHCmkEqtm3dfDkBjXB0Pq4aIE5llBU/qic/dYERIQEd3EjY9AQ9hjMyZH9YjNHCQNGpRmian95xufdQkL7r2vvFMrhUbGIsBkgX6FKSyrSeifhWZ0TYoUm68ZZUlXuvAbFXCjbjDv9c3v79GvtC7ierdeM2R96IXbGrRCqzQW6BTH2dCmj6G2RAMA+6nqJ5nyq4/whTbq0w+rPEi5AgWI7etPcZWlT9k3MHgBhPIC885E3nRHJWkoZdTFSqeWtcLOjIR/DqJ74WALCMRjNigzgYwdtGfSi4nbc3xFTIqvtFbpNyDogf2dULgA7nmc0jafnFYmkjUD3yPvKwtQ7FKrKttyMO6f+gQHKeTjAYre7UejUFk26GclE5hhmfZCh1CC/7eX7k5m6T2aXKGAKqGG1ZpJ0D2xS+JaYLovUHgvdYpFllf/zv9G4agr8sJmIO5kuR1IhDE4KiBNy+Ntpj3tKLAnGlVJQLDm84IrLftoNabhmixtxOBgjnjJxgarJjXIvWTE2XzKhmwOZJFC7t0bFLh1rtAK1IG lpMV1Xi+ f+de6H5/8by8EqNqyxQxe8Q2TD3eEGiLXB3HsuC05BLtbiMDmr+fj0cU5c6cTORZUkehL3kOQjXWh/d/ngbrQgUWhFrajuUkPJkxGdT8YYzXIM5YBgkqME9oPcVUEKjogU9HYaT4zoqp4w6toHoPFPwMdxZkLFrtBNUlpGRUQePen1pe672gNIyNoStxSjCtk3pcB5wWznsSeMqEpXmuPJ/ApvtQwnZlBOHdr3mJ9XxC1avmDWLy+aLts7EX1hd/G5RWEPoMSusj92t5bgxuWypHWtCItnEGGvYRVBCqxNcEOMOrjRvlf5Sil86uteC6KFxg/IRI29Y6NajCEZkOwf6poBFtAAOlpf4HIMdWkGvpYdCGGEUBzZWykcnwAjMgHXrxbZR20eS+9shMNMGJHYPsE/AyNvp5RL1kGaQZQxnvxBxgmNbiyAHRme0M4+KhZAXJCZOrQAgHjfKcLvWhQsQa3h+raYVkue1os9ydk9BAdvWqoHladDNscrRTYNdwn3qzu X-Bogosity: Ham, tests=bogofilter, spamicity=0.000025, 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 20990ecba2dd..ec746aca2510 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -7287,10 +7287,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 Fri Oct 18 02:39:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yang X-Patchwork-Id: 13841026 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 1A4D7D3C544 for ; Fri, 18 Oct 2024 02:40:07 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 707936B0089; Thu, 17 Oct 2024 22:40:06 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 6B7A76B008A; Thu, 17 Oct 2024 22:40:06 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 559206B008C; Thu, 17 Oct 2024 22:40:06 -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 35D866B0089 for ; Thu, 17 Oct 2024 22:40:06 -0400 (EDT) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id D3A8A1404B3 for ; Fri, 18 Oct 2024 02:39:53 +0000 (UTC) X-FDA: 82685168160.16.8D9295B Received: from mail-ed1-f45.google.com (mail-ed1-f45.google.com [209.85.208.45]) by imf01.hostedemail.com (Postfix) with ESMTP id 581FC40010 for ; Fri, 18 Oct 2024 02:39:55 +0000 (UTC) Authentication-Results: imf01.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=hud2oBI7; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf01.hostedemail.com: domain of richard.weiyang@gmail.com designates 209.85.208.45 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=1729219043; 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=Fw9lqVXH780eA2Co076ZCgivnQTo3zO1jHl7+cZ/sZI=; b=fiT2CS5PLDr15Zxb0gqK9wA/E8f85byDMU9zgajSCUZ5Op/YHtBrbQFtKV361zKIKV2GAm J1ZLCsKLkob47QGfkusJyyvTGKPkpK+Pj0abPU1WP9tMWBZGfQPYn46/aK6IGQrp2GfssO 4+ds3nZjc3Ew550cz+QJhlnuu0T4FOw= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1729219043; a=rsa-sha256; cv=none; b=wIOcRrwNkgNqiRgJBFF6Gz5pcWhiFWZPzwDNo0c9eHTWDrO7M1ENHosn9u9qifG69cfMWK u2aCqVAxl/bemOo3XE7T9mah3A9TzbSGriyxc0sI9BfGDj4lgRgG2AUWHcNS1EvPH9AGRM YWh/XilRskLOBXTrZBVKOC+mP9skiPc= ARC-Authentication-Results: i=1; imf01.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=hud2oBI7; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf01.hostedemail.com: domain of richard.weiyang@gmail.com designates 209.85.208.45 as permitted sender) smtp.mailfrom=richard.weiyang@gmail.com Received: by mail-ed1-f45.google.com with SMTP id 4fb4d7f45d1cf-5c9404c0d50so1655502a12.3 for ; Thu, 17 Oct 2024 19:40:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1729219202; x=1729824002; 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=Fw9lqVXH780eA2Co076ZCgivnQTo3zO1jHl7+cZ/sZI=; b=hud2oBI7g7YQuDCYukuKEA5TvQLASsoRdRp6mbcqazKih/VtMasdCUaOfUi2M3QGxl GMnX6SiOqIgRz5sOZ9w1QK+TKlot7IcbJMj/KKCx9weGnokmUy7TPDb5hnh6iyQ96ea7 YwV9homAkIg0DzQt/xr7LXFaxuECz1e0zoYlQGa0a9aA5gcf/PQYrf7s0C306AJK2GV/ 3IL8ZiTbfhd2YrztbHLKUW7Ks/34b9E7lcaN0frr79n1tXiT4GDDv1QFBPqPHYE4GnhL rUSlYkDGaxGqHOOvWG4MGbe27wqvWJq2+Nx5BAf/g38SvkRWfaoRK+XsK3mm8MSr9FiP mTgQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729219202; x=1729824002; 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=Fw9lqVXH780eA2Co076ZCgivnQTo3zO1jHl7+cZ/sZI=; b=eJ44HdDkAMiq/17JgKai+DgRmC+gtI7GmORxzkigEZ1wMHMUAk86lzk1N47OGsvHms j4UkvNmafLezlNhKLP+zQjQMCR/8sn7Mjp2vlkToeiSEFtr5+AX+dgg39nIA4wc1w4a9 hK+UNCLBsIrcOCXEwR1uXPEnF9cGAJ1K5rekG0by21qA9O6s77RIjJknhVt0eSG9zBFp CHlOM56sl9KW9/k9hyb9XNLUI2BS7olY27o15vA7JlFrwWSJfBypKg+37w0wRI4XkEI4 4RbHT/Pglcabxv3rngYkcThWD6IgTTmSYbujNGIeSqQpL4D0x3s4qz+OFjBuW7uQ3/im WXjg== X-Forwarded-Encrypted: i=1; AJvYcCViTlMuOrMS58D8obMRc6Tsewe4Wk2Tm8kxcQSE+WeUWpWiFG+T5YaJLKT1EKuLBwMeRWOg1Jh3Pw==@kvack.org X-Gm-Message-State: AOJu0YyTX57u0Wb5bN2c6V3RnK1R9orZSfkRA3plvV5uNuGTOQsHwzzj tVvrgcUc2Z1Y4waK5lSpn82j7Cn6ZTUyZaSRCorTZAxjXVEKe9GRLTdFgFNs X-Google-Smtp-Source: AGHT+IF7WQgNCpDlc/Z1MTitBjpfCpDeX9DX6IieD0NYIuwav77JJR4eRjNHDR+bEQoAs583h39Nmg== X-Received: by 2002:a17:907:94c8:b0:a99:fb75:3ed7 with SMTP id a640c23a62f3a-a9a69a69349mr48963866b.17.1729219202384; Thu, 17 Oct 2024 19:40:02 -0700 (PDT) Received: from localhost ([185.92.221.13]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a9a68bf5f34sm33604766b.153.2024.10.17.19.39.59 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 17 Oct 2024 19:40:00 -0700 (PDT) From: Wei Yang To: Liam.Howlett@oracle.com, akpm@linux-foundation.org Cc: maple-tree@lists.infradead.org, linux-mm@kvack.org, Wei Yang , "Liam R . Howlett" , Sidhartha Kumar , Lorenzo Stoakes Subject: [PATCH v3 2/5] maple_tree: the return value of mas_root_expand() is not used Date: Fri, 18 Oct 2024 02:39:40 +0000 Message-Id: <20241018023943.13860-3-richard.weiyang@gmail.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20241018023943.13860-1-richard.weiyang@gmail.com> References: <20241018023943.13860-1-richard.weiyang@gmail.com> X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 581FC40010 X-Stat-Signature: 7zmaxjoxuy4h1fjzg9s3mjcdt5swqmcd X-Rspam-User: X-HE-Tag: 1729219195-888108 X-HE-Meta: U2FsdGVkX19/1nztg1XrrM74TkDL+Hyo97apxGzE3mhGOwn9svvskFRwBjp2n8l0wHAKAX6CuF7ElmHBSTLQCUO0mftdwHSkjcT2oI0xc6/+iqe0dffeMzErT2ZkTme/ufzFJa4S+MUSz4mNKEbhekrfZDW1QyZKZ3p86Jivj+0hBDf3ZQ1TPP6GveaArg3nXI1cQx6wsyB2AkHcLoviqYX5wsNhYG5QrAePlrAcmZQnTXSeGSdEuwvyaIiMegz4yWG8lZ4ia7pO28Q91+FCk5nJjtnjcUEMzVjfyI1xROth8KxIVzXo6SiSM9zc9UuMHe7c+No9IjTD1BDGbtmaCP1mf5qa/zgNy28f4HzvuSRp94orejWkWj4omF3+298yxxk5XpjZccD5RDD1wNHaqSV/gor876DvubJDz+LpKwMiDp4HdEhtzhMPTu1kB7/SYYcU+rVPKqtkgvxVAiMPpeTo3bdm9NbgAnjzZdK3rYIKJeRiY6jZXchJ953hB6Rw/A3csi/WN1i3ki1v81b6dAN3XNBywgec2Pa+bffXlWxqz4A8PGd56ouPcXGNfSo79rhexaeJYnnxA3m356qCXTlXAOCncY5i/n5QX3ET3l4TqRKfADLVUAVy+DrZ4IxAU2qzLgNxbvacrzXwHtpUFTYT0wRmWURzRo5CgPFmsqZ4kes9K2WHqsd/pnOmAyHNGT2q8RLMlz909rLn7TmfCSBhTQn0a0iztCjwrFDvSO6XBGrBN6/IXwRGOhWPMCzXaSU22H+8eZ7KI77rbR4N93/xBtjCOtPquxJuXXnFDpuA42IxMllRKTv1WgayEP304aM4t6++ENYrESVcMdW6XPGMPZwX49L3Qvqs5iPXU+EqcPP3w7dnTQOVgv76ovGcVwb9s+g8LfQ2q39Ku7mxK8ff3crfDZZYnSI0ot0UF6i4k68v1zyyv0VOoWgjCL7J4e4kttz1eBfMiXzU+xo hVf0yaRT iOgL472eOGHhDU7AxLHzovhemy/U/l+ejluQvvqSYuyLLDsP4UDDoawng6lPG0ilL7/ZNXv0WvEEMP7veHvv1zzqI524KYBaiS4Qbx/DZwGNvqEMZqRxw0eJ8ejhmsl7i+LFL1LMlTlJ6XiZIzYChSggn1qLzQGZBKls1c1TNeurSQLLRtXKNUge0iEWe+TZtIXEPqa6wUzp6x3oYvttgA+lksiet6LapAK83dyw065f322+dTnHmQvyX+nxWO+TO0qoHjY2NRul9nG6xPdZNRZRkX4thoS/YEmkBls0uAHO9cPEDf16mLJML6r5G1AATrP1k57fG+KzwXF3OsgVBldEG7bXVrNu2RD88sTRJIKghtm11w7IBMm3TFB9vNytT0Q40A0RpbLFmnYR4PC+LeudKxVBEifAMOf0z3lCJynRCU4NYIqhiomp39biQvX+of+nsSiLM3KUEecA8SdYwr/uxrTSpOuRsZ7AmJucsBUlRAhs8SfMKZ5YYBUE9cnHvjjSETuS7IGlrwWPRbvHWgeVczcFolT6ywhPC 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 ec746aca2510..cbbaaf60efa9 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -3398,7 +3398,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; @@ -3434,7 +3434,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 Fri Oct 18 02:39:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yang X-Patchwork-Id: 13841027 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 5BEF9D3C544 for ; Fri, 18 Oct 2024 02:40:10 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E33546B008C; Thu, 17 Oct 2024 22:40:09 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id DE2E56B0092; Thu, 17 Oct 2024 22:40:09 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C84E66B0093; Thu, 17 Oct 2024 22:40:09 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id A86B46B008C for ; Thu, 17 Oct 2024 22:40:09 -0400 (EDT) Received: from smtpin11.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id E342DA04CE for ; Fri, 18 Oct 2024 02:39:47 +0000 (UTC) X-FDA: 82685168328.11.DD3D32A Received: from mail-wr1-f44.google.com (mail-wr1-f44.google.com [209.85.221.44]) by imf11.hostedemail.com (Postfix) with ESMTP id ED15F40005 for ; Fri, 18 Oct 2024 02:39:54 +0000 (UTC) Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b="gl/fXwjN"; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf11.hostedemail.com: domain of richard.weiyang@gmail.com designates 209.85.221.44 as permitted sender) smtp.mailfrom=richard.weiyang@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1729219100; a=rsa-sha256; cv=none; b=K4xCvWrBszj+SoUS8Pl6D70cQrS3FQ2tIVxi72vmTaKRGroMuC/kJ0KkcUOsc3REBZiPXk WxZ/FtPxQu7Ww9ew9p6VHgcYZ0rq/j+e+bPQxgXvkFxXDonXxlF1ImVxy1dpyMNFH77xjp PFJe005zUiHzw8JN+ceonPi+I3yIUhQ= ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b="gl/fXwjN"; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf11.hostedemail.com: domain of richard.weiyang@gmail.com designates 209.85.221.44 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=1729219099; 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=LU1gqRwNZikfrOmbGkcP/YBmAvz5LWB64++tvV0tsmI=; b=T/F4oLz0dkcjE5wsKvYf6xCu17kIMq/7hcq5D8R0bRfeyCo7n+BkjWJiiPKx4Gt+Kr1CC0 MX5OqMao8D5IVgTCuA56FGUAbigh/YQirtlRqj6qcYi+DpnkJLYohY/OLPlTF7SBpEOxaI oWgMX4cyYpUeKPcVITvvbj7Xd7fQnbA= Received: by mail-wr1-f44.google.com with SMTP id ffacd0b85a97d-37d6ff1cbe1so1214596f8f.3 for ; Thu, 17 Oct 2024 19:40:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1729219206; x=1729824006; 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=LU1gqRwNZikfrOmbGkcP/YBmAvz5LWB64++tvV0tsmI=; b=gl/fXwjNQzB5zxS51k5PCrN2WPxfn5E0hVhTXYeumjnHdaOXj1gPFGweRX51PM0t0p B1agITiETGOZDOc2vVthLokPyPhu+rPMN3FmozGsNuNUyC/lJWNpwRc/opUJydetFipB 9oEv1uBk0eMB3NFQLP6RpgWu6ME8UVJRhupX3qqusFTkvwKWWGapjp8WNJ/g1jVe6M5U a8FQgg8pABVz4iHKMiqQbw0GnoBrJ4yEOpJbht3c/Abq8WoVtw7VE8H9vuvnTqdr1lld Ehw/JLTQCiSUBY2PxPlK+/Isv3gtqaNmhFWnSJaKrTlVMReAeDFnY5iKBmo6bQJW5bHu nagQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729219206; x=1729824006; 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=LU1gqRwNZikfrOmbGkcP/YBmAvz5LWB64++tvV0tsmI=; b=heQ1GibfvjHMwm2pEpk67Qx7/OAGKIkIHbXQWbKUE7tKiRoxHPBklPhLdkTga3CDkQ uXzdeSm8hVljgEh4fJ0G19/n35/UufNGVVZeDniXUd3vmvBhVI4A4JfyJt9ND1ewiR7z 90V2GWy15aStzYLUpNyXzaBMIUjXXk8O3XDUfPBAt09sW8Nqu6mVIOnLrKIR2dG0k5Rl nKyxFnsYYuY5/PR9wUZPZo1bRuPvGjF1uLf/p6mP5/7P6FF3a01cuHfX92OjZ/8F0xsw xTVi26Wroi15XXT25nGd5b8Lsz0axynAU3xevIl6maXSun0u+HWG3rZSOBDsCgFgII9z i5qQ== X-Forwarded-Encrypted: i=1; AJvYcCXvNp6lBnYKUiyxJ3AdapqDssh6YsF9LI4YpyuF55yqfsQQ71+QXae6XF7tS+i5l3otWw0gAZFsMQ==@kvack.org X-Gm-Message-State: AOJu0Yz6/Q2z5Bwl2ohIzhPnVuHEMT8jFpcXAiRvtSql7fKgBsp4dzc+ yDGJL3kNQLKTS73HSo0NV7NNFE7ECZEHPw4szjvkBqczFyu9R8Lz X-Google-Smtp-Source: AGHT+IER7y0CuyKDEOqRyZ5dsEC5nQRNAAWEbzKmXhnMEIVoiM4m4kmnMsjCExAcuqF2TDBmyNk0Xg== X-Received: by 2002:a5d:660e:0:b0:37d:5296:4b2a with SMTP id ffacd0b85a97d-37eb48bc5b8mr445360f8f.58.1729219205778; Thu, 17 Oct 2024 19:40:05 -0700 (PDT) Received: from localhost ([185.92.221.13]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5ca0b080906sm173477a12.29.2024.10.17.19.40.02 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 17 Oct 2024 19:40:03 -0700 (PDT) From: Wei Yang To: Liam.Howlett@oracle.com, akpm@linux-foundation.org Cc: maple-tree@lists.infradead.org, linux-mm@kvack.org, Wei Yang , "Liam R . Howlett" , Sidhartha Kumar , Lorenzo Stoakes Subject: [PATCH v3 3/5] maple_tree: not necessary to check index/last again Date: Fri, 18 Oct 2024 02:39:41 +0000 Message-Id: <20241018023943.13860-4-richard.weiyang@gmail.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20241018023943.13860-1-richard.weiyang@gmail.com> References: <20241018023943.13860-1-richard.weiyang@gmail.com> X-Rspamd-Queue-Id: ED15F40005 X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: xbuo39hyy541u48fqcgpf35csdn44maf X-HE-Tag: 1729219194-236288 X-HE-Meta: U2FsdGVkX19JA02dOd6SRFcOk0RMcOYMhw7iiGmXdP484lILKbbwYgOdGm4zf+TPytoazhH9ReuuZpSrW2qmfTrha3JScmDkMRpxSjjxKT54jfMaoikrrQPTO5ed6tHfBX1oM7FCZ/i6vVBhY/nyIqvlBPv85ckRraJP6ta7AahTBLEIG2MujJqdMEIro8gEU5X3vxDbVNDqLfwxWFwT9arXTc/m9U98usSxh9em4s9EJu8Qx+r/EfZIamEwbvuXBH7IHSeRCahMt9dEQFGGmSiS9HOn9a7pc/JQ8iq26rjut0flCEXcM6O2o5rUVSILGSxg67I/974sRYNZG5BwmChZJHRewZ7QAilrE7h/7huP1WRXPzaJeC5n6apEbSIC/w3PMa01GUx8Wl/HWTCsSWDMGfLwaopqt0UyRw2VUx4EOsvPkp2dD43uVxk4Ne+K8oHNP4gRc6elIr0bRej+nbel1hInFCZsVDPwYr/s6nQ293YnW13KxD6Bhqg2cIxEMlqZyV+bLqdDVMpHf/iP5uP6zJYd8+TTQA8vG34ItEpSrsS35NoXKze30Cm0ay+us2IRPwbfyKZbA/VAQFZTMfHy9muhVMbb47FDmb70aH84hlygaG4+jWmPzOt8cTxZywPheqJgzUwwavKfxXTtvd4rPK31qDLASNWk7wWgN/ifKxvYvAvcdtGGedxEBTpclDPvt2KKW9iYE9h+iAUa74gkyMSk3vpuY3uPakMx5sq01I1NKv/+Gin2mx4BpLgAsY/vUsdIy4u05h4IoW88jLw3pTBGEu9Y+MgLWDy26GAHBL3mZ1ORy2t+J9XYJdaA07JRaHyIbfBYYuDRWCy3TuN7HGrpWuDizH6Ud1V8XmTvM9RVSv6vpKWN9Qj2j7n7tdSl/7KxTP/rrD4wasjYmjUs5XdMSjP4yKYbJRmYQ93+278X4eQB0FqElDNhGcm6MkTkbbwvZtad8dEp912 05LGHN0R 0NAA6HKc631bElCwFyUZxW/YRCFInoLl/ozt6Vj/m6eDp3g2j1Rfe5HdwSkKUEpAEzMMqHICDWqVPHxJund8fIIyBoiYGyelnbEcjXBYdxbo0yUHBonPkcl/kCZBcj+lnCV8V4KgabTaB+0aPewoYACOh8YU+eziud0qICSdh6DCRSZ/eddCXul83ssDMiz4ACC8Jkk98uQ/easUcKRyXZYkxkk8cVHrfR3PmlURcaZHr7VREtqB3XUjWJ8D4RsQoNSk3oWXMoNbV7EZlwskii8/XO50RFtmHin10JOylVdY86ftvPqQkEzics6lxxE8kBtioTHFLxc6nsVepoFz14EamB2TUaqOuDoHUQwO2fF0xQsf28bMrUO0/NT8dLtFfFadlN6jFWeuFeipyduQvGmdAErtBN6XV6NHWCidTtn4LT1RjZOTZ2TK03guD4p3/2mdO7cFFDHUDKIgO+0cAjvX5UsM2IaNeNWlq7Iu2JPszJLh2KfNThl/fybXwuiKyvBFN 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: 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 cbbaaf60efa9..db8b89487c98 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -3662,7 +3662,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 Fri Oct 18 02:39:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yang X-Patchwork-Id: 13841028 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 450D2D3C53F for ; Fri, 18 Oct 2024 02:40:13 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D4A4C6B0093; Thu, 17 Oct 2024 22:40:12 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id CF9B56B0095; Thu, 17 Oct 2024 22:40:12 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BC0CB6B0096; Thu, 17 Oct 2024 22:40:12 -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 9C9746B0093 for ; Thu, 17 Oct 2024 22:40:12 -0400 (EDT) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 51A961C70A9 for ; Fri, 18 Oct 2024 02:39:59 +0000 (UTC) X-FDA: 82685168328.26.75F14D1 Received: from mail-ej1-f43.google.com (mail-ej1-f43.google.com [209.85.218.43]) by imf26.hostedemail.com (Postfix) with ESMTP id ADEA214000F for ; Fri, 18 Oct 2024 02:40:02 +0000 (UTC) Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=ez3KOF69; spf=pass (imf26.hostedemail.com: domain of richard.weiyang@gmail.com designates 209.85.218.43 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=1729219162; 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=6NOQnU7l/vxZduKt4YJrTIL/mTO/1Bx4jBBaczXOYH4=; b=7GIRcDz6laHGQLg+Axjy1ZmO3OAQDdmYrfbaGf9teIQ6QcAZ6Xrjw6IQxAS73OBZjc6fz0 aQ/ac9absiqkhDPYqL6COvS4PvXlYcNhnMCoITmWYKwLD/5VzVSCqA9U84qKpKkswPbRjv aexMHlNj6I44Di14WQbx7/9/xUQEiVE= ARC-Authentication-Results: i=1; imf26.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=ez3KOF69; spf=pass (imf26.hostedemail.com: domain of richard.weiyang@gmail.com designates 209.85.218.43 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=1729219162; a=rsa-sha256; cv=none; b=xDkwY6XXFKNKSfobylbOVc1EhxdGWlKFZCP3tG7Zkj976baBTq2lOGp5AoQmRI0PF7abns QTayjw84TXyTN5Cvms6nIyuOW90cgd6UsZi7wBKJFnylWoMeYPgymrgJ9yd56OJw8rF4rG G4GAcQ6J35Kd8672HK5FwqG+IeD6G3E= Received: by mail-ej1-f43.google.com with SMTP id a640c23a62f3a-a9a0474e70eso217153366b.0 for ; Thu, 17 Oct 2024 19:40:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1729219209; x=1729824009; 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=6NOQnU7l/vxZduKt4YJrTIL/mTO/1Bx4jBBaczXOYH4=; b=ez3KOF699MQ55fPdAibdVRU/BqZ3h2WUmodhadP8OV2pQUaE+ozp+kH0Meu4vMzgOH WbD2f+ufb7MhB1UzclqJTIXLokB3ZhRnZ9ISaUQZ5PEQua5a5fBObPuw+cTgXpKGPI3h 9fLuZLz6pbDrclld8Zo/gWpVPKE6Qrt447rpQhx9oihm5WK3jpIcdwq83DH6AT/+d4D0 yGQQSxcmukoKiFfsOmIJSYHMV6rTo2sMG3kTIpRmn56QMm0NcoIMB4jJAd0JeL6pTyeZ a8vw/QLWqbQUqV5vEkGyGwaw3OlKoCJpMG8kbi2hz/yVWjygX8Xo4/r1cKjvPTN/LmtS vomw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729219209; x=1729824009; 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=6NOQnU7l/vxZduKt4YJrTIL/mTO/1Bx4jBBaczXOYH4=; b=v2bK716tGiZUwssVtX46Vsk6V8U3D0zQBi5+uk61p9KlabNiNpgIFc9e8Nie2uFM8a ASGk6HvC9ZhHJbppqYaKVwcTy7rX8oZcQiKYDz/46+ipIQW2/hTMrhe11EK1VPuraJSg qniL82xk992ZkVqHj/eES3enaSgAbC7+r06qjRXJKsiKY7aUbA1ytHn7o5AtJagf+0Z2 5kBl1Ggo3TErHXGkZ3WishuZGqJdbHHjnQBOSjHvNGy5Y2BDZ1pAk8q6GkVM/Tr7elOE SkAEbeZX5quTfw5kC9Ig4+Ktmq+omfWgoswDRV/osjxpaB4RYj35Cfz5xR10LBn2mFVa 6Ayw== X-Forwarded-Encrypted: i=1; AJvYcCXfj8pZ8bjTkv2FpK0dVsY2pc+IdVdSMyy2CFFaJG/BSHusE74LAZ1dT0gXjZQQTrQ3e5MalU6R3Q==@kvack.org X-Gm-Message-State: AOJu0YzRHnysLtnn3xjQhchhDuRUa8mmuIC9C+jRFx1AYQUeH62zEQRR jlWlT+dp4Gx2OpSihpIKAEOkD9sPCBoRSfQEDczEG6a96i/GGgTq X-Google-Smtp-Source: AGHT+IHcZZSRDhGOSRfEKtfaBUoyY6i5MzyoGnGZyCyxVrgYQoLDmxmMhvH6sNkCgDgHtkdlNOoCYw== X-Received: by 2002:a17:907:989:b0:a99:40e3:23e8 with SMTP id a640c23a62f3a-a9a69ccf8afmr62279866b.51.1729219208870; Thu, 17 Oct 2024 19:40:08 -0700 (PDT) Received: from localhost ([185.92.221.13]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a9a68ad3ebbsm34661066b.50.2024.10.17.19.40.06 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 17 Oct 2024 19:40:07 -0700 (PDT) From: Wei Yang To: Liam.Howlett@oracle.com, akpm@linux-foundation.org Cc: maple-tree@lists.infradead.org, linux-mm@kvack.org, Wei Yang , "Liam R . Howlett" , Sidhartha Kumar , Lorenzo Stoakes Subject: [PATCH v3 4/5] maple_tree: refine mas_store_root() on storing NULL Date: Fri, 18 Oct 2024 02:39:42 +0000 Message-Id: <20241018023943.13860-5-richard.weiyang@gmail.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20241018023943.13860-1-richard.weiyang@gmail.com> References: <20241018023943.13860-1-richard.weiyang@gmail.com> X-Rspam-User: X-Stat-Signature: drmkioomsg1diop8a6uocj9hekqqi18w X-Rspamd-Queue-Id: ADEA214000F X-Rspamd-Server: rspam11 X-HE-Tag: 1729219202-208846 X-HE-Meta: U2FsdGVkX1/RwWGVDwcVk/stFIqg0LQ6TW2bpZFyerNA501T9L6Fu1Gb6C1NLEmDeKsRyAGCrlUeXRlK+w/hNg4p/kCeOZVIGzHTP19mZ/2Z/+Ozcyy9o33mAV4nOmrYxtSwp9HqfFubwZBfhFtdUm5HG6fMtDfAg1lk8ggG5zzL9u447zjDKY44OfrbGJJrZCvYXvLYRr8l0ccqjZ9Dx11lHvDij/e8bjWDdj6f06Y+6bVp78G7SX/1qJWiQXj2szpXfmdU91m01tX4hQl2cwuB9IagFfRavENt7dcu0PTH3ybyhWB37qKF45AQFtzsa/dId9v9a2dTWCsaASw+D5NreJXkL6P+24OKHT0iNPtnFM747XDuvVFvDCZBPMNAqgTEqIjEnQda308uIqWLN+lBPlgJPOgXtdBR3gdlG+/iMwJO+mybqluhpZkybDHfhU0WgradIaB50Yr14VUKs1GFPoOTeKN2i1Rayfs3NdmIbT5SHSCoHDTk6j6y0AVb5cZfIz9ch7kEgGKrPGnpADgQN1Z3Fpyc8tOa9CJROUwMASk5PePcO6ARtu7cJO5Gou+acj4y8vxPZyVZVa/TV22WsHQvflaa+vo7AM+zSEk+OnUYUgBQuohimMYE4Xr02JRcXGwcZOdtogJCsOi3MSXfQlQBVxfN8KTSGjxTSC5hsNkl/tkYjGrk89xfSYu9ouxt2RW5feJhK8frvNgFFuzq/UsVUASqvrmobQq2J8VilGwcIndNjFUkcb0Cw566EnZEE1mqRD+uvPWxTsKzoFINO99TxjCiYA8Fh5itca2M7MAMyIyx1H34oxM5r63yMyvX7QlbOsgKbnLAdfiR/NP+OYz06JVMR45jgnC3szf+/5xWuC1JhhP6FHBE4jJ46lawxIjsA5x0Dhwl/EGfyJ+oDxro/W0zZSEcG4TbJ4ZJ/7vEGAAdTnews6wBsqMILdsFjVaHgm/modtP4x1 KChJDfcE IJ1FbT6kf3DPB0Rpg7ZpWUfltLtwTZ7V0fp+BiWBkJI2qWcGhzkUbnGo7ZStlDK4ek0k02jzmkoRBDmbbs4pkT7Q12WPkKXAAZbsJ+ZspKxjPiCNnh37AX9T3YPybDUTN7SH8GY8jtkgj3648lu+zgzWanUyd0vBwYS8IIaY92XFHYL9AFobHqbLYAtYrRZZiRv8At1RGsr51PEMVbjKhV4CgiTfyhvJ9rcO0IU3lVsnsw0NEICtnYaMoTXsobM1smUn76VbC2tWOvqCYWNW3eRCZl9OFmYynF776IEB6k3lNvucwVmX5Q0e5joh0flq9RpVJfhEIf5NDcfNw8XeD3ajJGt2XLxAHZVsieNnvwxCRWmTFmB8FN7aLc9bDAareAubaA9SODk5nDAONC8htskbyBVfyxQMuydesL+VOdBinwSk6KlTt+4clxbn0rNXHEvdGUsi3Bwhv8NFhF4NIlmRO+3MCu6BJB2KlLlzJKd358fuwv8sWgl9GkVLGCyTaFgAq 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_store_root(), 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 --- v3: move change into mas_store_root() --- lib/maple_tree.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/maple_tree.c b/lib/maple_tree.c index db8b89487c98..03fbee9880eb 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -3439,7 +3439,11 @@ static inline void mas_root_expand(struct ma_state *mas, void *entry) static inline void mas_store_root(struct ma_state *mas, void *entry) { - if (likely((mas->last != 0) || (mas->index != 0))) + if (!entry) { + void *contents = mas_root_locked(mas); + + if (!mas->index && contents) + rcu_assign_pointer(mas->tree->ma_root, NULL); + } else if (likely((mas->last != 0) || (mas->index != 0))) mas_root_expand(mas, entry); else if (((unsigned long) (entry) & 3) == 2) mas_root_expand(mas, entry); From patchwork Fri Oct 18 02:39:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yang X-Patchwork-Id: 13841029 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 52B29D3C544 for ; Fri, 18 Oct 2024 02:40:15 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 02AD86B0095; Thu, 17 Oct 2024 22:40:14 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id F1DD56B0096; Thu, 17 Oct 2024 22:40:13 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DBD386B0098; Thu, 17 Oct 2024 22:40:13 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id BA0116B0095 for ; Thu, 17 Oct 2024 22:40:13 -0400 (EDT) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 9127F41798 for ; Fri, 18 Oct 2024 02:40:06 +0000 (UTC) X-FDA: 82685168244.03.0F133F1 Received: from mail-ej1-f41.google.com (mail-ej1-f41.google.com [209.85.218.41]) by imf06.hostedemail.com (Postfix) with ESMTP id 0F53618000A for ; Fri, 18 Oct 2024 02:40:03 +0000 (UTC) Authentication-Results: imf06.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=KSraYkdv; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf06.hostedemail.com: domain of richard.weiyang@gmail.com designates 209.85.218.41 as permitted sender) smtp.mailfrom=richard.weiyang@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1729219093; a=rsa-sha256; cv=none; b=OisM/cQsPcnL8zT632+auRkl3DZtQfeow1bvyF4uI7fxNVu4BCJSmsiOF0oUbW2udvw4d2 7+0T6Veo14AdX9dAyfLSVqRUXMqO73KnhMp8aznT1o8WpC/pMPDh0gXKQwcbnEcI36VA4s JP3XivuYbUTF4GhObOo+zL37FrFk4qM= ARC-Authentication-Results: i=1; imf06.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=KSraYkdv; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf06.hostedemail.com: domain of richard.weiyang@gmail.com designates 209.85.218.41 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=1729219093; 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=OB4aw/MWjvXDmbK8D7r6VWSH+ZtnOwNKP21OPvmuvq4=; b=7pg2S11eOnHdK6m7PRojoy4cyF53AJd0q/mvnMX1OtZ3MmTR5J77eKwMGSIcWCisydgnOK KZmvK6/yA6aJU/qc9IDyaUkl+bC/n+W7LjCpHT+hMsJAUmSEkXfir3WXjLp+4VQ3Zwp+jH QsjAuj+3By0Ql5gIaL1huZOctZEMFgI= Received: by mail-ej1-f41.google.com with SMTP id a640c23a62f3a-a9a0474e70eso217154666b.0 for ; Thu, 17 Oct 2024 19:40:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1729219210; x=1729824010; 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=OB4aw/MWjvXDmbK8D7r6VWSH+ZtnOwNKP21OPvmuvq4=; b=KSraYkdvA9W44n8Ql/nKkmIFYAQ0nfT1CTTZe0QM2bveNkCqoC+7pchb8zJK3eSAPw PqUhBOebQ03VjPhfiu3L7dm7tktpG/i9HAlrFyxKYTWrQhycisk2R+lrKX5ov0U8LuHY szxrEcOCuEjq5jqnUPXfG9fIM+U6cV2vX8gB1Rd8xNpyCgPh0yxVdqYifoKkhJqHtSO4 AoViVL4N08slZLRhy0ZSJb4XmZcchMDVrTgbzZd0eWkOa7gMB8N8/PNJKZDYuV+DhukB HcpoQC6KxueYrGrMEnnmP1FGxu28fTojWjDadBntBr/LVUO+Lq+k76Fm9B8uMrxJpS/r iFew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729219210; x=1729824010; 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=OB4aw/MWjvXDmbK8D7r6VWSH+ZtnOwNKP21OPvmuvq4=; b=MA60FK9UYI9supzxUpGdOQx33XVvSa19XvQOrc47VGXYA8K7SgeQAwP1c4KKD6Tyde ENiqc1UP6n2zmkmwtMrTBGbKjKyJEfRodCOgHgXI/9SFZPcqN9YYg0MLgnp1D3ywJmo9 q8L0huVCg7vExNwlyjtNSel/w4ha7R0PbGfvjsyBq8L8BcuPx0g4H+ikP9x/IEqs+doj GKTfEYDBpFyUBLYoz0MSwii0G2Fgvo9ZKNpdY326thPRsxwYPC1sWuQz/PY55LcmELVJ F+BMnNxwLhRBSSkZ3mtnDL6vRTeMN7Ir79Yy3XdcPv8Ktkj64N+5i5JbRIJlC5amA6RJ /51g== X-Forwarded-Encrypted: i=1; AJvYcCUFoTqzMRDjReSVWBsQYzA0epHGNNe32XPzKujQLShztGIUv7zcYv3zTWfEsIsUT+GW+3nxCKme1Q==@kvack.org X-Gm-Message-State: AOJu0Yw4vWkVVKHvscRTwFpdDhWI5OxdJCMbNGXf0heSBBuRp/N0+CMQ ZrNtRD3YzeR0hP+KFy7R7nMlm4iCO/FPpu9qMrA4rCyK+RQZBNFfExe2dOAJ X-Google-Smtp-Source: AGHT+IGqC29DcQDFewDeXZ+UrsBiayCraGpxIdQo8g83Ep8MgqOaZanImDVTrzY/HsroUXwjn6SyiQ== X-Received: by 2002:a17:907:7f17:b0:a99:742c:5b5 with SMTP id a640c23a62f3a-a9a69a63325mr76706866b.13.1729219210156; Thu, 17 Oct 2024 19:40:10 -0700 (PDT) Received: from localhost ([185.92.221.13]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a9a68ae545esm34373566b.67.2024.10.17.19.40.09 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 17 Oct 2024 19:40:09 -0700 (PDT) From: Wei Yang To: Liam.Howlett@oracle.com, akpm@linux-foundation.org Cc: maple-tree@lists.infradead.org, linux-mm@kvack.org, Wei Yang , "Liam R . Howlett" , Sidhartha Kumar , Lorenzo Stoakes Subject: [PATCH v3 5/5] maple_tree: add a test checking storing null Date: Fri, 18 Oct 2024 02:39:43 +0000 Message-Id: <20241018023943.13860-6-richard.weiyang@gmail.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20241018023943.13860-1-richard.weiyang@gmail.com> References: <20241018023943.13860-1-richard.weiyang@gmail.com> X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 0F53618000A X-Stat-Signature: fook8oxqk8uozzzhttsw9i535otbr41o X-Rspam-User: X-HE-Tag: 1729219203-574374 X-HE-Meta: U2FsdGVkX18wJC3de1HRa0ql7G3eYN/LRhK05jvyd/eNUeZdxhvmXrRP2OoHv8DLl8Npr1KVbCoWUzJ7OSHBy/IZUe1a20qY3F/wyb3REQ9xn3FBjg35GeoY6eAIexrRebHTF3qlO9cwNgmtMLOOJhuz3Wa+nZCYeGhAApi83mndgJXbBEHQCHA0iKvcD3MYFE0crRkAXCufhPFnN9Ong4ZLQNHZH3rZ8ojPHJPGWfXTuoinoP6+KIRClR8ZBypuS5SGUehIASDVjf37WFKpLtURZ4KmXsty0VpZfHTzl6pZzEx0ILdhqTqwDiYwicYSoHmDqCI2+VbRJFdOEoBfq6HyZQkSUJPYHBWSnEyqAUAIVrc7rGosHAyqgBcU6LKdTuVHitkzV595Mwh8M9baCoqXAF9ELnjql8KTn2NdCW2JS83t/0youKxfrdOJIo1+utnZpqzTa0HyPIEWrpXN8pQBkRoKj97e40UV+L3sG+OPwY7PcPIb3/lhRYKj17gPY07bM0OYafSoTUmy+d6PFEDXOKcNovpJoiOxU8wdqeiE5Q6iJG21hyyGvpL3FQLDSmPhZqI3M+R8DHCrsYyErg84iFG3vlDFTG/QYsp7rST2Rpp2ykGFlHqWX0fmAzp/pmhlWa6hn/sNwOcOgpEJ4Sugv9dwsclW6G9gPGFQJkryk64N7Sc46d/t8S2tBl8KUgFENnt2V93itt0wEHnteVBgdu56ZzHnyN/7600feHogM3m5Q+xx1uUxTwibo7eVp7NW0K8tr9f2iYrRxXYM+2yM2TDdxYcXBUwIDpzuKWk+bn0ImV+EAqxAiWyrxPCy9Ke9GnF1qBoP2kHwSHfMzLhMbJUSCnttH9w3N9lb4AOHdxhNI4oIZP0+gmlF79F+Y/Q3NnGxbHHXFHGKfIhXXZXzUboDhlmW9ZSuSytpKKgFL54oAYEyllzM/xwuBnZkZ6ToUaMyPEGOnOSmMT8 W0fpIKeJ DoWfjcNA2h/k+XAXFyJR8sI3ObdwAljs6tXOwvXKunHIPYNgJ1PE9UZGjzqtwCxMHpMe0nhxHZQ3uPz9+XcToQHIWv2gKck0JaphwpCacrg638HAr+UEDilk14OrKaA4MWw2LBSj0qS6ZEorR4ZRgVGHStX9oTXWDnu6ijKHzdQE8/CAXVP1VTrtbqgMsNhxqsUcpkY6ju+4rbw3jpt2BYbnsvU4zXXdPmDT+CBRpsiEm6RA8ZKVIzv3K3zHB3G351+umC8nTyoUpHjKp64Un1QYgROiB3Z7d5pJ+BMHWTEE3tA1Su9+zDOrgsimL2kZoCuV4tkDpPyQqFABeA2LJJez0aO3BZO1L4glwhNhw7SpH8mWw54R3hVUEgLNMS5LG8WulPF1bBNPCR2pDeHBA/gYAmVxOvXA/5pVBocTzORKzHvLQhwKQeoyaN9dnlYGfPSnoOBXzdIBdUeuhj0uUPEUBIVecrzxxmNtP11PvKxxmT4e5HShTWtv1ndq0mPqjHaLp 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 --- v3: move test into lib/test_maple_tree.c --- lib/test_maple_tree.c | 90 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 90 insertions(+) diff --git a/lib/test_maple_tree.c b/lib/test_maple_tree.c index 31561e0e1a0d..2ef72f6c6d1b 100644 --- a/lib/test_maple_tree.c +++ b/lib/test_maple_tree.c @@ -1387,6 +1387,92 @@ static noinline void __init check_prev_entry(struct maple_tree *mt) mas_unlock(&mas); } +static noinline void __init check_store_null(struct maple_tree *mt) +{ + MA_STATE(mas, mt, 0, ULONG_MAX); + + /* + * Store NULL at range [0, ULONG_MAX] to an empty tree should result + * in an empty tree + */ + mt_init_flags(mt, MT_FLAGS_ALLOC_RANGE); + mas_lock(&mas); + mas_store_gfp(&mas, NULL, GFP_KERNEL); + MT_BUG_ON(mt, !mtree_empty(mt)); + mas_unlock(&mas); + mtree_destroy(mt); + + /* + * Store NULL at any range to an empty tree should result in an empty + * tree + */ + mt_init_flags(mt, MT_FLAGS_ALLOC_RANGE); + mas_lock(&mas); + mas_set_range(&mas, 3, 10); + mas_store_gfp(&mas, NULL, GFP_KERNEL); + MT_BUG_ON(mt, !mtree_empty(mt)); + mas_unlock(&mas); + mtree_destroy(mt); + + /* + * Store NULL at range [0, ULONG_MAX] to a single entry tree should + * result in an empty tree + */ + mt_init_flags(mt, MT_FLAGS_ALLOC_RANGE); + mas_lock(&mas); + mas_set(&mas, 0); + mas_store_gfp(&mas, &mas, GFP_KERNEL); + mas_set_range(&mas, 0, ULONG_MAX); + mas_store_gfp(&mas, NULL, GFP_KERNEL); + MT_BUG_ON(mt, !mtree_empty(mt)); + mas_unlock(&mas); + mtree_destroy(mt); + + /* + * Store NULL at range [0, n] to a single entry tree should + * result in an empty tree + */ + mt_init_flags(mt, MT_FLAGS_ALLOC_RANGE); + mas_lock(&mas); + mas_set(&mas, 0); + mas_store_gfp(&mas, &mas, GFP_KERNEL); + mas_set_range(&mas, 0, 5); + mas_store_gfp(&mas, NULL, GFP_KERNEL); + MT_BUG_ON(mt, !mtree_empty(mt)); + mas_unlock(&mas); + mtree_destroy(mt); + + /* + * Store NULL at range [m, n] where m > 0 to a single entry tree + * should still be a single entry tree + */ + mt_init_flags(mt, MT_FLAGS_ALLOC_RANGE); + mas_lock(&mas); + mas_set(&mas, 0); + mas_store_gfp(&mas, &mas, GFP_KERNEL); + mas_set_range(&mas, 2, 5); + mas_store_gfp(&mas, NULL, GFP_KERNEL); + MT_BUG_ON(mt, mtree_empty(mt)); + MT_BUG_ON(mt, xa_is_node(mt->ma_root)); + mas_unlock(&mas); + mtree_destroy(mt); + + /* + * Store NULL at range [0, ULONG_MAX] to a tree with node should + * result in an empty tree + */ + mt_init_flags(mt, MT_FLAGS_ALLOC_RANGE); + mas_lock(&mas); + mas_set_range(&mas, 1, 3); + mas_store_gfp(&mas, &mas, GFP_KERNEL); + MT_BUG_ON(mt, !xa_is_node(mt->ma_root)); + mas_set_range(&mas, 0, ULONG_MAX); + mas_store_gfp(&mas, NULL, GFP_KERNEL); + MT_BUG_ON(mt, !mtree_empty(mt)); + mas_unlock(&mas); + mtree_destroy(mt); +} + static noinline void __init check_root_expand(struct maple_tree *mt) { MA_STATE(mas, mt, 0, 0); @@ -3710,6 +3796,10 @@ static int __init maple_tree_seed(void) goto skip; #endif + mt_init_flags(&tree, MT_FLAGS_ALLOC_RANGE); + check_store_null(&tree); + mtree_destroy(&tree); + mt_init_flags(&tree, MT_FLAGS_ALLOC_RANGE); check_root_expand(&tree); mtree_destroy(&tree);