Message ID | 20240919234832.24237-3-richard.weiyang@gmail.com (mailing list archive) |
---|---|
State | New |
Headers | show
Return-Path: <owner-linux-mm@kvack.org> X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 49411CF397D for <linux-mm@archiver.kernel.org>; Fri, 20 Sep 2024 00:40:11 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id CF65D6B0088; Thu, 19 Sep 2024 20:40:10 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C0A636B0089; Thu, 19 Sep 2024 20:40:10 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A5CBD6B008A; Thu, 19 Sep 2024 20:40:10 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 81DC66B0088 for <linux-mm@kvack.org>; Thu, 19 Sep 2024 20:40:10 -0400 (EDT) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id E7117810BB for <linux-mm@kvack.org>; Fri, 20 Sep 2024 00:40:09 +0000 (UTC) X-FDA: 82583259738.14.6EE6548 Received: from mail-ej1-f41.google.com (mail-ej1-f41.google.com [209.85.218.41]) by imf19.hostedemail.com (Postfix) with ESMTP id 2D34A1A0004 for <linux-mm@kvack.org>; Fri, 20 Sep 2024 00:40:07 +0000 (UTC) Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=LzPADjBv; spf=pass (imf19.hostedemail.com: domain of richard.weiyang@gmail.com designates 209.85.218.41 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=1726792695; 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=M+FlXv9VSxUPXYP9UaFam8TPdb0cG75x0AMwZCionVA=; b=YA8ncb2YC/R1DNIv1rSODAEl8b9Byfq32VI6ZnMj5EGXTjdDNCFn++xeq66vzSLppGqKEP xk3FLRiU1uJl/UR2SN9kFHbeHyyuCUWeJEXv5q9zKOd2//52DUwbwFjfktgO3O4/dXgXjR GJ5xBLCJz4v/tK+6tQHVAF6rymCE2PI= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1726792695; a=rsa-sha256; cv=none; b=3Xb3FcL20fkjmF3PRE5oWiENk2wznXcepP7L1abguOOkAt2fbXlgTRwAoUzY+WFmz33P6+ WubBpFIJgBuY0X0e+p5H+6dDr4eWGUJvyJEDGynN6Hk3Al7XH7OzTGbgFOHsiDbKH58T5i uQto02lMHLOcioFdcvhFg8xgUy1lT6Q= ARC-Authentication-Results: i=1; imf19.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=LzPADjBv; spf=pass (imf19.hostedemail.com: domain of richard.weiyang@gmail.com designates 209.85.218.41 as permitted sender) smtp.mailfrom=richard.weiyang@gmail.com; dmarc=pass (policy=none) header.from=gmail.com Received: by mail-ej1-f41.google.com with SMTP id a640c23a62f3a-a8d64b27c45so231804466b.3 for <linux-mm@kvack.org>; Thu, 19 Sep 2024 17:40:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1726792807; x=1727397607; 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=M+FlXv9VSxUPXYP9UaFam8TPdb0cG75x0AMwZCionVA=; b=LzPADjBvrmN9iPeCWVP8am+sdVHGpRtn9s3aONPCPgAjEbmqHw27JfnWpA6DZrCk27 O48rMhEYtFmp7dMI3M2QJlt5cnOYpZzKkzUFxP3w49o0a1tb9ZaeR5WWQFBaNbCXcpww SJb/23Fp5t9riTll9vI/jVkXodrkeq5YrYkz3tUoG/yF/ZP0FZhBpOHsmr+cyIxpzRYS AB0DqvAWfrFEk5Uf1DMU83LDglxBBngPVRzOFJNG3kSMqDSLIofmVDFkzquXKH0Fjvrt 66Tn41ne9+0yCAKbWsgkiIHgY3Qtsg5PugpUxVKwzlmN46YdWZShoyATU4JxPQlRK5Up 9EKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726792807; x=1727397607; 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=M+FlXv9VSxUPXYP9UaFam8TPdb0cG75x0AMwZCionVA=; b=a3rMDJZhadMZyKudg4rEtQeFi4BrL2YNQkhF9+FcY9sRAeZY5x08K9dKcTUQLMAHOl VQGkIgrrhqRH9ja0Jt8SGNFaCD754dl84rtbljyL+HO2trkrGC7qtwdgXrksGabr4biV PjPa21dVU9oc6i0wFwe+b5YUhuhjppXAYaXy2/5IXcpXEK/P/lGqRMO2gfCmwVUVP7Bo KIpACMpJfqFcxx/Khu1ofTYDMagANCZkQxFs/QJEC4oT/PSR5fm3TSOQUmISrDmpwx6Y IiqDxkCJq5k6hMR+iGNFKLf1qnPZ8Iw5VHPg9BQtLBnoA8giC+I0XrZHzkYeUq/KmxT2 5YFQ== X-Forwarded-Encrypted: i=1; AJvYcCWeLdvn1vzk5bsTJQ/rxZJUp+ni85me8AiH3dntRyK9sqTTm6qGZ+vDuitd7KIBpiH42FsfiMDtmg==@kvack.org X-Gm-Message-State: AOJu0YzQQVq/BZFuOPakEB+aX4SRPriXhFdlS1KzwLsAqrZfKshEKKH6 2uSLzX5z6i1/uw3luUoYCfSS/ekRpuO42DOEFLlQ0AUS0HuCA5XR X-Google-Smtp-Source: AGHT+IGrqjpCieBItCOKZ8kVY+x70MQUMKtwiWuNg/o2vxmq5m/0vWVc6YUpc/Tl8U3XudDRHOCPcA== X-Received: by 2002:a17:907:e655:b0:a8d:5472:b56c with SMTP id a640c23a62f3a-a90d4ffdc5dmr71154566b.22.1726792806704; Thu, 19 Sep 2024 17:40:06 -0700 (PDT) Received: from localhost ([185.92.221.13]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a90610f4438sm777494866b.51.2024.09.19.17.40.03 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 19 Sep 2024 17:40:04 -0700 (PDT) From: Wei Yang <richard.weiyang@gmail.com> To: akpm@linux-foundation.org, Liam.Howlett@oracle.com Cc: maple-tree@lists.infradead.org, linux-mm@kvack.org, Wei Yang <richard.weiyang@gmail.com> Subject: [PATCH 2/4] maple_tree: use mt_pivot_count() to replace mt_slot_count() - 1 Date: Thu, 19 Sep 2024 23:48:30 +0000 Message-Id: <20240919234832.24237-3-richard.weiyang@gmail.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20240919234832.24237-1-richard.weiyang@gmail.com> References: <20240919234832.24237-1-richard.weiyang@gmail.com> X-Rspamd-Queue-Id: 2D34A1A0004 X-Stat-Signature: 91rqjw4x87dng9ayuoh5akd69mqdwfce X-Rspamd-Server: rspam09 X-Rspam-User: X-HE-Tag: 1726792807-169051 X-HE-Meta: U2FsdGVkX18YKRXnWUGNkZCIidVHJ9c8e0gO7f2L2UVQ9oMrDPkoR8EgTkw7sPRSz8VjVlmglUnJan6DTwpGghiLaIMjQj197z7YcKVSIxISju+3Fjqu6zNUt1bR8/BS6zQNOZUYxLmv75oarX4pp+oZnham5ax6mRqdbT/mtT5W8A1P+njhrFjONin7f64yYtNMRlJnm0rIyu61KO5XVwNfzOQigIWXFBSoNYJkk2ygsASVbY/yr4gnBMLE/9oqQWKqA4Vgd20m+7PD91GmIZo0WJ9LCPOHNdWTbHbq2ctpMCQUh2Upw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JLjp+FFVjsFWaEG7fejrKaeJirE1saTLylbP03c/CU9Ow4yw/shP99Kvzkjrop/GBvseReC5hKeeKspS7XJw= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: <linux-mm.kvack.org> List-Subscribe: <mailto:majordomo@kvack.org> List-Unsubscribe: <mailto:majordomo@kvack.org> |
Series |
refine mas_end of mas_mab_cp()
|
expand
|
diff --git a/lib/maple_tree.c b/lib/maple_tree.c index 51f49b29b8b0..8ff075645f21 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -3167,7 +3167,7 @@ static inline void mast_fill_bnode(struct maple_subtree_state *mast, cp = false; if (cp) - mas_mab_cp(mas, split + skip, mt_slot_count(mas->node) - 1, + mas_mab_cp(mas, split + skip, mt_pivot_count(mas->node), mast->bn, mast->bn->b_end); mast->bn->b_end--;
We have (mt_slot_count() - 1 == mt_pivot_count()), except for maple_dense node. Since mas_mab_cp() doesn't apply to maple_dense node, it is fine to use mt_pivot_count() here. By doing so we can save instruction to decrease 1 from mt_slot_count(). Below is the comparison of generated code. Current: .L1595: lib/maple_tree.c:3165: mas_mab_cp(mas, split + skip, mt_slot_count(mas->node) - 1, movl %ebx, (%esp) # prephitmp_234, movzbl mt_slots(%edx), %ecx # mt_slots[_90], mt_slots[_90] movl %esi, 4(%esp) # _26, movzbl -23(%ebp), %eax # %sfp, movzbl -21(%ebp), %edx # %sfp, split decb %cl # tmp258 movzbl %cl, %ecx # tmp258, tmp260 addb %al, %dl #, split movl -16(%ebp), %eax # %sfp, movzbl %dl, %edx # tmp261, tmp262 call mas_mab_cp # After applying this patch: .L1595: lib/maple_tree.c:3165: mas_mab_cp(mas, split + skip, mt_pivot_count(mas->node), movl %ebx, (%esp) # prephitmp_231, movzbl mt_pivots(%edx), %ecx # mt_pivots[_87], mt_pivots[_87] movl %esi, 4(%esp) # _26, movzbl -23(%ebp), %eax # %sfp, movzbl -21(%ebp), %edx # %sfp, split addb %al, %dl #, split movl -16(%ebp), %eax # %sfp, movzbl %dl, %edx # tmp256, tmp257 call mas_mab_cp # Signed-off-by: Wei Yang <richard.weiyang@gmail.com> --- lib/maple_tree.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)