From patchwork Thu Oct 17 01:58:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yang X-Patchwork-Id: 13839297 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 EE1F2D2F7DE for ; Thu, 17 Oct 2024 01:58:20 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 79EEA6B0082; Wed, 16 Oct 2024 21:58:20 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 728626B0083; Wed, 16 Oct 2024 21:58:20 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 616A16B0088; Wed, 16 Oct 2024 21:58:20 -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 4553D6B0082 for ; Wed, 16 Oct 2024 21:58:20 -0400 (EDT) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id A09FFA0D40 for ; Thu, 17 Oct 2024 01:58:00 +0000 (UTC) X-FDA: 82681433940.13.49613A2 Received: from mail-ej1-f44.google.com (mail-ej1-f44.google.com [209.85.218.44]) by imf15.hostedemail.com (Postfix) with ESMTP id DC5D1A0013 for ; Thu, 17 Oct 2024 01:58:08 +0000 (UTC) Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=VqN84w52; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf15.hostedemail.com: domain of richard.weiyang@gmail.com designates 209.85.218.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=1729130138; 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=EaEg0wGc17TdM1UZZJx2y7Net+EjkdZZR/dSLX+TIiQ=; b=fz9TUwtIK7ZVRP+jTJFF0ugbSE5tTn6RDZuRjOngcO3nDHFcfDSh53oYHtWhpEdAoFB6fC IKxZypwU/HbBLE1HpOfCMKzr0iKKwBuP9uQjZCZb2WAX7kvib+nMX7gR4Z4kJQiqSOQldt 8B32zK1Dq/t6EQ5RR9/owVp2KcnR4J4= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1729130138; a=rsa-sha256; cv=none; b=4fUD8ZafHsCzaJ0aR5ywXxYvtnfvL+E6odWA2fL9eKeQLJ08fif6h5ex+0kZdyEjUvxVaM 91Id7Q8B9v5r5oArnb3zbOux9+VTrmiovfhwhdbbFSElq1U3j+Qr5+lSjNzKpvW0dKl9Ko CBZ7Cte6g+zX1SEmz0WEcaTz2NgthA0= ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=VqN84w52; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf15.hostedemail.com: domain of richard.weiyang@gmail.com designates 209.85.218.44 as permitted sender) smtp.mailfrom=richard.weiyang@gmail.com Received: by mail-ej1-f44.google.com with SMTP id a640c23a62f3a-a9a0474e70eso50799266b.0 for ; Wed, 16 Oct 2024 18:58:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1729130297; x=1729735097; 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=EaEg0wGc17TdM1UZZJx2y7Net+EjkdZZR/dSLX+TIiQ=; b=VqN84w526W6hsHgYeOJijPVi/cEfyRGZY9ev2aMJJ4JuEIUCFGGfyjEYPUwNfzqHO2 UozOlDcHHIMENDX81MTPyXsvezC47yqlwYTcQJFoTShbh6f2wOmOqX7jv3jkbM9aPrg6 ab9ofX0OV+QRkdGjq3vaZfplgcb0XL3J89EZwFT9mt8o5SBtsK3b5Lzie5MmnY6yfDbW qqKVqBcFYFXjr6hbJXCuN5ImN3rgfxqVi69333M5u0G3Xy7XtfPUwOPXjc7HVCjeyVT1 AZPK/feePLD5ZzZTql7CYNLC0EIRc7HJ4cdjEc1xWrIJizBWT+ursLPr2sNWydp0p8iV +OLw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729130297; x=1729735097; 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=EaEg0wGc17TdM1UZZJx2y7Net+EjkdZZR/dSLX+TIiQ=; b=MYZHXquT8AP3DGG24XOlAwZ2AgrsT4Tw+z934kxal3cA5cytmF2GauPLjN33gPKEAp wh0kdpsqgLdzejJVtK1Yjb3ml3cPUR+mZq/NA7N4hmQvlm33bOPPkxwv3oL9K0vB+hLB pzNWYW3iwdUpWvvZOjXcLCtkq5jarWd/yh/UxdYWZWM1MGxlTws0kvNhXwg/RvNhTsbb Oj4r5qOx1/J4LcsXdHfe0/P6VFhbRihYUSRq5w7mKDiRYV3ZBbG64p+dDJRZ4ND9QtxK kQ13++LvgAGxedwfa8wjU86O+dqwV0kdZF/UKA5APoelBhxvhtDmsK1CL5RQPMpqgAxx qXLQ== X-Forwarded-Encrypted: i=1; AJvYcCUhlQER8jJ7ilIw0wqwFo3dmGEoBWkRI0B+yP4ZnAvIT34f6jbwXaDjTezOGW+2h6bTjFu95C1BWA==@kvack.org X-Gm-Message-State: AOJu0YyzRP3IisqvVUAAbMm+/RIguwBHrNmw0/CkTW+cojW1+RFM37Y0 YmvxRujz3vPppEeRab87YxkApIcyVI7rkz0caT/NxlItI0cuht7k X-Google-Smtp-Source: AGHT+IHl66GNqs8n9QTMGMM5F1WL20o8QHz3zzNlLsjl7MQ1VZtjuZCbXx+J1xqkKfR5BHqHYNCoNg== X-Received: by 2002:a17:907:1ca1:b0:a9a:bcd:b726 with SMTP id a640c23a62f3a-a9a0bcdbe59mr1209399566b.25.1729130296498; Wed, 16 Oct 2024 18:58:16 -0700 (PDT) Received: from localhost ([185.92.221.13]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a9a29818257sm235963566b.99.2024.10.16.18.58.13 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 16 Oct 2024 18:58:14 -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 v2 1/2] maple_tree: calculate new_end when needed Date: Thu, 17 Oct 2024 01:58:08 +0000 Message-Id: <20241017015809.23392-2-richard.weiyang@gmail.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20241017015809.23392-1-richard.weiyang@gmail.com> References: <20241017015809.23392-1-richard.weiyang@gmail.com> X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: DC5D1A0013 X-Stat-Signature: igm6mc76t65g89gormykcx6tbgbgajzh X-Rspam-User: X-HE-Tag: 1729130288-592637 X-HE-Meta: U2FsdGVkX19mhN3nWXvx7EzOyYpFk5YuLfdtPPdAf6RIgfZCTFc5gK0Y3fmH4sqPRALowhgeTcF42HT26tBUuIRxMrFQtaM+ETBNOjDJQOlcth6TdKSqu50EqBI5vhjdmBHj4ii50yTwsjZKXOWQcyli5j9EsISpyip8H2rtqqjNx7l/DJWebW9mobsf59ETLM5KK3eC6Aj+Dhe4J1Ii8G8nXNOnmV2mc04F6U2xFeR4GCxZ7OF/mJo/7dVcZxW17Ryrgl386E3I6Yl4bmXlTEuPSD+/NZAXdJ0nn2eVFWdsqLZ8OQgTNURfNvYJbLxZpanotfao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Ziu+cmRBG3QKgFHj0MFhtoNSmDB0Z8C1vdx2KJnQMxsudWcjWKC/SZLj5BQV0yFku3nX0SwfAOMWrdfx+UFby19bqHZAWAuDhyjOa 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 511afb8ad1dc..b26f8df09588 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -4117,7 +4117,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; @@ -4128,6 +4127,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)) {