From patchwork Wed Oct 16 00:22:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yang X-Patchwork-Id: 13837476 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 31DD5D20687 for ; Wed, 16 Oct 2024 00:22:48 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B58E76B0082; Tue, 15 Oct 2024 20:22:47 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B091D6B0088; Tue, 15 Oct 2024 20:22:47 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9828C6B0089; Tue, 15 Oct 2024 20:22:47 -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 6FE736B0082 for ; Tue, 15 Oct 2024 20:22:47 -0400 (EDT) Received: from smtpin17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 8ECD9141981 for ; Wed, 16 Oct 2024 00:22:37 +0000 (UTC) X-FDA: 82677564270.17.72487CF Received: from mail-ed1-f49.google.com (mail-ed1-f49.google.com [209.85.208.49]) by imf30.hostedemail.com (Postfix) with ESMTP id 5D1868000F for ; Wed, 16 Oct 2024 00:22:30 +0000 (UTC) Authentication-Results: imf30.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b="I3ZLDB/E"; spf=pass (imf30.hostedemail.com: domain of richard.weiyang@gmail.com designates 209.85.208.49 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=1729038021; 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=OOtMx79VBXCrKkiz0LeU3UCvAvH+TyMdK09OT/IDMfg=; b=ShqMIKKQ0EswfY4p2DbXpCj5xCEOIqcY3TmwkMa9mOu2NDwIFcshV6UJ6ueqeJIiXsdnQc vZe+U1hvcKNuGD9s26nNWFNNXaGORg36LsRWBpK8gHeD0Yylb3ykOawx6bpkdAavyAirrb zBsHmGkzN7aw/Puf5Jfu+rTBWHmhOi8= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1729038021; a=rsa-sha256; cv=none; b=PwSyCSgNXJhZcqFyz5B+/aW3AHMl/ZxO1tztntTWfnHVPT9Sih0i6PCVDPHlCzg+GcymP3 rV95L2pxKr8pxrF7CZnJjI/o1b6QLE78SEbAgneeGGF9d22SWhqH6gZjTLkRrOuCBvzWTC D7GFTB4q6XaooNyON4u9zzlRnZ/I1I8= ARC-Authentication-Results: i=1; imf30.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b="I3ZLDB/E"; spf=pass (imf30.hostedemail.com: domain of richard.weiyang@gmail.com designates 209.85.208.49 as permitted sender) smtp.mailfrom=richard.weiyang@gmail.com; dmarc=pass (policy=none) header.from=gmail.com Received: by mail-ed1-f49.google.com with SMTP id 4fb4d7f45d1cf-5c941623a5aso672136a12.0 for ; Tue, 15 Oct 2024 17:22:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1729038164; x=1729642964; 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=OOtMx79VBXCrKkiz0LeU3UCvAvH+TyMdK09OT/IDMfg=; b=I3ZLDB/E9dB0xEl5xI7+HY4TkRVz5D6BvJ0PHWF/KiwyqvROSRyRXLSCcxqa13QdcT yhAtuqzxeueiErBGg0Snqs2WDHhtpeHCviBOyQyIhitjSHTeLnfiedIDhAsGxSvvENCS 33QpJe+czTurF7/CUwYtLqU2X/n5YH8UeZUXV3lt0yH9sgL9iJ3VtbMq/wtUurZqn7CR KDXDxfTlw6JxiQ2Hn/KK4yvipdx6MiAwcfzcEz3mRar0M5Gcqja94op8ZoxyJ8QcOrQb FY/Q9xAZyfisgIHqj2zveUsjPFGy2R1K6O5tdk5p1Ou6UIhJEhsXuFqG0qILzRtsGu64 67LA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729038164; x=1729642964; 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=OOtMx79VBXCrKkiz0LeU3UCvAvH+TyMdK09OT/IDMfg=; b=QBgCS8W7eY2jLEBrA6aWiITr24uf83RzsKAV8j57UqnQbv6cfFJslwAr7DFtfXpsof Ex4+YPkgWdlXcYTGBoXDrBFS21Z24Vt5f4Uaf0z/UInD8WMx8G0RCr6jzVFfs44OWHVR whEGAIp0dO/n6X562fT7Y63RaPmfCFj0LcdH+uAcHLegIv1RE80fb9YbcyIplG2yr++H kQGSL15r6oD9zb+iM9UHlbex9snyUApPejiKnXlPTWkMVs1NRtkCDYdH1Bx/RKj4XvAb 66D/Rv6izoWVVUS5/+gzFaERsJhq23iSlLETGL/A0Bz0RD3Qp/hUZP+BxTFaYUaM5Lx/ MKnA== X-Forwarded-Encrypted: i=1; AJvYcCXIFejBcrhJXFPqp6I3XZRCGpXTSjkvoRXdYFrjPNgJDoNZCABgxnDickIXojEA4eWGDhgTY9zOgA==@kvack.org X-Gm-Message-State: AOJu0YyYlitkrXZOTA3SsCJwTTQ78FAP80/Mf+PDmmJtPCJSCqMJg3CQ 4SyvDzzsc2KzalvFRsfj3Zmoqeavi8xFcZVaOqxukT7v0lh0mUB5iT4kgMOO X-Google-Smtp-Source: AGHT+IGiRJD2/hw0nBZOgYEdXRqEYRky2AQ+3HNzkeC4OqSoTzZpS/WvhTKrCcDsJn+qip6H/13BNw== X-Received: by 2002:a05:6402:27d1:b0:5c9:763e:e2e9 with SMTP id 4fb4d7f45d1cf-5c99497f24dmr2001841a12.14.1729038163473; Tue, 15 Oct 2024 17:22:43 -0700 (PDT) Received: from localhost ([185.92.221.13]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5c98d508160sm1152733a12.50.2024.10.15.17.22.40 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 15 Oct 2024 17:22:41 -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 1/2] maple_tree: calculate new_end when needed Date: Wed, 16 Oct 2024 00:22:20 +0000 Message-Id: <20241016002221.32428-2-richard.weiyang@gmail.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20241016002221.32428-1-richard.weiyang@gmail.com> References: <20241016002221.32428-1-richard.weiyang@gmail.com> X-Rspam-User: X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 5D1868000F X-Stat-Signature: ntxfnj6k44c7xceoaejfks83ct7d3433 X-HE-Tag: 1729038150-699549 X-HE-Meta: U2FsdGVkX191igMf+hDEdvRUk55ctf5sUXWzgswCfAR03/Zt7N9dSXUHKhyWDRSh2O4HCaJmdib2Em7scXFxM/w2pwnwkVIh/0gFZ21INf0c3m3QXU2AlDMmsQORynSzwaoO+MoXEle7z2uBYHrNYKlRshcZpKQUEQz444uD+B8YQrDfKu2sKagi3Zivj2Qrldqx6HOuchBh5GVbYa+qL3QPCiVXP580VBtNS4eCc6sY66zGTRMp7apsM0uvQCYZOjbqLdsBw2/GbYGmhD+FSY/TrmhJO0p9yaDT22Hsaza8Jpnzkf1Jq0gWXRuEkIU4y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hkJr5BttwV9tufcb+5E/lKxQjta3IjX/vFPyBwIBb38V+VutSLPsHt1pq9XWvbMsCcJlKtPidBwV+OSQtd69ghahrw 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: For wr_exact_fit/wr_new_root, we don't need to calculate new_end. Let's postpone it until necessary. Signed-off-by: Wei Yang CC: Liam R. Howlett CC: Sidhartha Kumar CC: Lorenzo Stoakes Reviewed-by: Sidhartha Kumar Reviewed-by: Liam R. Howlett --- 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 61de8f1daee8..f2628e3f3efc 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -4122,7 +4122,6 @@ static inline void mas_wr_store_type(struct ma_wr_state *wr_mas) if (!wr_mas->entry) mas_wr_extend_null(wr_mas); - new_end = mas_wr_new_end(wr_mas); if ((wr_mas->r_min == mas->index) && (wr_mas->r_max == mas->last)) { mas->store_type = wr_exact_fit; return; @@ -4133,6 +4132,7 @@ static inline void mas_wr_store_type(struct ma_wr_state *wr_mas) return; } + new_end = mas_wr_new_end(wr_mas); /* Potential spanning rebalance collapsing a node */ if (new_end < mt_min_slots[wr_mas->type]) { if (!mte_is_root(mas->node)) {