From patchwork Thu Sep 19 23:48:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yang X-Patchwork-Id: 13808061 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 7CD4DCF397B for ; Fri, 20 Sep 2024 00:40:08 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E2EF26B0085; Thu, 19 Sep 2024 20:40:07 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id DB7D66B0088; Thu, 19 Sep 2024 20:40:07 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C0A766B0089; Thu, 19 Sep 2024 20:40:07 -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 986E76B0085 for ; Thu, 19 Sep 2024 20:40:07 -0400 (EDT) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 0D0AC810B9 for ; Fri, 20 Sep 2024 00:40:07 +0000 (UTC) X-FDA: 82583259654.20.11CB494 Received: from mail-ej1-f51.google.com (mail-ej1-f51.google.com [209.85.218.51]) by imf04.hostedemail.com (Postfix) with ESMTP id 452074000D for ; Fri, 20 Sep 2024 00:40:05 +0000 (UTC) Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=Dg83uhRf; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf04.hostedemail.com: domain of richard.weiyang@gmail.com designates 209.85.218.51 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=1726792679; 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=o+pwZSX6Ht1Aqcgt6hALFzoc9rFXm9RKG51oarHOWo8=; b=Ha1oeku9tpOD7sV+ByE4Q7U12P+Hs5dp8304N+9/Zi0SG9dC+I4ij0RYuDwe/+ExCO4MY9 mjU1HQqKNyot137rdJhoYE+7pEznSiq+6ipJtytvvoCQQWiXfMANXHrGacOGaApGzziBc/ jm+TzYQN4ec2CI7t5rXhkBkU1qTtyNI= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1726792679; a=rsa-sha256; cv=none; b=SNBoomXggoyVUxx9aYj0uX70Ol5OuIDjry/DIapW11RaSOvOAeNRxN2H7xJGC1DkKaYJdK HQqVnF43BYQ5hyHt6ptxjbpX0RGWW5Bq3Za/08/ao6lWabhRZ17zWK8b72xqjx/NUMeGOg rWM4QGn03giORwOntzaOAZ1uTgz0I/0= ARC-Authentication-Results: i=1; imf04.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=Dg83uhRf; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf04.hostedemail.com: domain of richard.weiyang@gmail.com designates 209.85.218.51 as permitted sender) smtp.mailfrom=richard.weiyang@gmail.com Received: by mail-ej1-f51.google.com with SMTP id a640c23a62f3a-a8a6d1766a7so198111266b.3 for ; Thu, 19 Sep 2024 17:40:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1726792803; x=1727397603; 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=o+pwZSX6Ht1Aqcgt6hALFzoc9rFXm9RKG51oarHOWo8=; b=Dg83uhRfBYYgjuMh7/Q0n0N4O/N4yFIcjDP4zeRuhW8GdSohlarfIEzmxdS+lvr4uZ fH2S7WDnPKM+bm5elfXW4Ccn3xKkbyswF75UrdXDmXuR5sFxjcyALMjpjIiLUg3TgRU5 ZCUBVRBdinJudxDbffNaNRii6JqHmRieMH2dFaCDZZzGb1JkwYy0oZsBP5C/lL3ZdqmA cMqu7jelPIQ6wQr349SGMSJUu6dTJ11Wy4XRelDffTJm3hRM0KsbaXgaoO4v6JpDQvvL 8ceGAfgGM65o7f2tO42w7PT2cZGOb635vpR/4WAnt2I9PcqKrMCJ6ZVNMS9yNc/ZuAiM 9yOQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726792803; x=1727397603; 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=o+pwZSX6Ht1Aqcgt6hALFzoc9rFXm9RKG51oarHOWo8=; b=HhokGi2T3EMFAEBRIdZb4XzVvwj8i3/mgp4WDfLi8YiVfstewMHcAAcq2Dy/Prlcs9 iqD8aHrz8UMGXKV0rpVesfIRTuvqeB5i9JtOSz1FXwViy//u/8FIzmcsx7fWK0xRq2xL CNgXprlLHksKghrF4eeVRySabRrOpXQoffQY8XkjlhxWDQHuIwwKLYNGk5UEg1LtY0WF t5GaJ396bM1OYS3Wb4N7RTdUASHd5PgTJQx0cAkbvk40UKBe6iJQHGP7VnXgo/bVfb1b 3XQaxWs/cFKT9PHrtA+tiJJLRDpRfISVZ8KQZ+mqBi7WMyg+HwdIz7/cCqI5dhy6kOqA u7YQ== X-Forwarded-Encrypted: i=1; AJvYcCVjDOGL+xnIKE8HcS7RVUbWy+lRLRtV2j7shRnlzMCtYS7sxMRObP2ViiUxzvKc/2WVqsJaoHVQwg==@kvack.org X-Gm-Message-State: AOJu0Ywo+QysE+bdbtMQJb+k9SDGyzE2OdVFtHrLer2FxT0RBrsu0MJv N7+RXk8RmBPZD5Vr074yPegiUYvNNyCcVokqKEsCjr8/lyEF/S3r X-Google-Smtp-Source: AGHT+IGxuBsjR9reIAIOk6I5thdKSBvdeP3Wj9LEQXt1SRdO+PW8OfV1/ydj+RAxSrZCbTK3WUtTww== X-Received: by 2002:a17:907:d3d8:b0:a8a:9054:8391 with SMTP id a640c23a62f3a-a90d4fc883emr59850466b.5.1726792803352; Thu, 19 Sep 2024 17:40:03 -0700 (PDT) Received: from localhost ([185.92.221.13]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a9061096735sm779739266b.44.2024.09.19.17.40.00 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 19 Sep 2024 17:40:01 -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 Subject: [PATCH 1/4] maple_tree: not necessary to copy mas->end + 1 Date: Thu, 19 Sep 2024 23:48:29 +0000 Message-Id: <20240919234832.24237-2-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-Server: rspam07 X-Rspamd-Queue-Id: 452074000D X-Stat-Signature: wbgeutw4cmxeneyjrqqcqzfrak1k15b7 X-Rspam-User: X-HE-Tag: 1726792805-974580 X-HE-Meta: U2FsdGVkX1/4xqkrpUSdQxE+SHRp9E9J1gJNm5Z4omCchItU1AfHHYtpReeUTy7CAUlz/R5Ezwps7722riwpYOsWL4UJ4Yd/A5xpEtxYO9vKOfvrTKQX6jmhS/GE/AFgrbzKAj+lusXC/PQSvAfclVfYfcENFb0JFQabR1QagCDOi+NrfnmpFN/Y3oggD7rmiOMdG1ZoNsLA8gkFHOLaCG3ltzkAjqbHTYc3YAF4OkZp+udIWBk1QaKD3s89pGLSHBxPt4M5wx8PxOb13xWJ7uaSq5MEFqflo4Yg3k4bIfzBVLfkEeQdbIoklwT1OkKNWHN8ZD16+clD+Vi1JXhvO7OQvNLzHlLbcqhHE4z79AubH3sYERaDUi7/eP+xiXlSN8QxH46V90Ug7E8x7OiTwHR6J5Ticat2NTrMfABguehqWR81Foh6HnlGXCvvZ82U+Yr3lY4uebtVBxWVGV7MkICSkho49R7mqWndn4Jt8c088kqY2AeUQtgoF+4bLjuoOVjn30axFEjnCnVXr4N8p2uUsH2wJM6/AqJ1kTQWgatNh/68ctO94iOZ1QB6yC97cCgoYNJp9YDF0kWvj9Unp6dzO510b3NldSU05ZielEGXtsC0qYSwxSt/R2WaYV0V1nyxXc1uPH2f+fnstBrdPtsOObT1k2pkp7U2PnY5S4bBITtlBlSUy7esQnhPTrVW8VscL0BUVP4PcenbPAqHJ4Y2qIkzmE/k7yAfDMPbNHgcnvpsVw8r1speq1eXI4TBaVC/j2osC/fgW/4lUgr2TCBH7VeCTkF3zaeJAT8iDyAQaIkl5Ve6GDn5EZvG00oCQgEP8QAg6y1ZStcX2+32TvdUpDyXwISJy+pYpSQ+uqxO0gmzRMNEWlXFU1sUpcHlS/oT/2TkCoYzqiCP6/OQYVrkdLmA1xBX4RwKwz2Lhln0rpAbFoefpxZb8EO2Bj0UxXlR/L/k/8BDyDYwTta /XzxtVv9 DQAm9aWj1LDAugL5Zf5rZGR+CWweMT6lfjh2jYX2v4id2xqS7kxpW+PyeE33p7N0re8yNupGyDPUQp85vFzouD4lYnG1f16sBI6n+hJGDmrS1hBnJqGDSrTLyODmkMfLPNUqec++NqzctgpOM1HRB44Lme7mjz2mL+lDqiVakKhmamRMVY0ZayKKmep9ejbr6PNu9vo+0M86rq7j1s6lagt8EsfR+a2HTaqmkr8MBGi0FUWv3zMi7qdHZfXW2ntHnO36XPQg0vZfn6ui/JXt0hKxcQmv1gpAF0bV1Lc5uASGU8/mwQMpnM37OMcyZ0V/v2mWp+PshnQkuzAGMResoUv3Qye1LtjENAYYUcUFB392oKQUE7naP7Rz5Hnn0u21fgiNaV62doX8EE2oAIiceHVIT9s1MzbQUWfEafhZMTDGO5z5mkLZO8qIze84Ybj2taZOFhv6MMHajV+TPKI6RwukczXfZyiYrY1fwDDUgNzuCdwc= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000392, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: mas_mab_cp() copy range [mas_start, mas_end] inclusively, so we just need to copy to mas->end which points to the last valid data in maple node. Signed-off-by: Wei Yang --- 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 a4796101decc..51f49b29b8b0 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -2099,7 +2099,7 @@ static noinline_for_kasan void mas_store_b_node(struct ma_wr_state *wr_mas, goto b_end; /* Copy end data to the end of the node. */ - mas_mab_cp(mas, slot, mas->end + 1, b_node, ++b_end); + mas_mab_cp(mas, slot, mas->end, b_node, ++b_end); b_node->b_end--; return; From patchwork Thu Sep 19 23:48:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yang X-Patchwork-Id: 13808062 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 49411CF397D for ; 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 ; 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 ; 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 ; 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 ; 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 To: akpm@linux-foundation.org, Liam.Howlett@oracle.com Cc: maple-tree@lists.infradead.org, linux-mm@kvack.org, Wei Yang 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+7PD91GmIZo0WJ9LCPOHNdWTbHbq2ctpMCQUh2UpwV02LuC3jJDwIm+JbaKu3zZ/PQdgQs5/5kBUPiXqsry/prte3uinXQwoOf9GSusHHsOhejHh+ERdwkuaf+iAtKe322s+m6Sqf/hKStI0H9Frrdcsh+npBb4kumY1SwvhI8WCOQE3GZmd+i7v1jGwhxQ6hD0+pvmVT0pwnD/RKOCcWZjANZFvdXwoB4OyzgPkEpoHBR35hPM3irQxWqnh1IRFes72+h4mrNQZdvb9PmsUwJ6wUIoygpAs6UNQXfSKywH6I4PfJhOVJACopN4mBfrelszVwBaINybhbU8ZCPMqsEb5X4c0TvB6qpoQerFHhQIEclw27QONQPfrWY5rdVUzGPh+TuFYzecxLRVi4dATPLWc07neH80kr4H5hx5pRhfyPtg4rlZVfDnEckZr3GbEXLNgVwR6j+0J27Yv+Z2zhJpHcZ4d2cRsXrRNRvFJ5F0sW+CW0EEtnLmWgAWV4+f8LYyDkZtdgvzQjiDzhV4zUdlTNIAdDjDfQ1GiHh+zD9WreFiIycHWf9dnA2QeGMmrseisSSpPXrzLgu9PdeZog2QVRSxsanAdWYbXfL5+obAg3af64OeLFqS7B/mUsY9hx9DjpTDjLLZqOrGiR48XtFLqkLoHVGZI+GCEmrpudVTtcivvSXzjW1Yo3/oxO9NJCxggx9B tZCaIIwP zL3Vpmby65rJN26Qxx3JLK0t/qtckUxnQYD3YUermYPZJZWo5WWA+1Hj8mU3gYIDCbrD6bYWQ/+d2JG2sLzKXanQJHTVjHvMLTF1gYdv7FzTaWAph9866a0RDueSZz0rcSy5UOzvS76nU3xh7okeO7PdZQBbrCztzfO9yhYLT33EJzzfFZzOod91PtWLNQSvano80p1r4VaAb5AR3d/lp0ZMbsu0doQLEy0HdIiVbC4UbF/8C30dRqhZ3ht8pNRZX95OgIlfzDRPCpE59IroqogQ6F3EwyU65Ql/cTusOrLeGtw8aoat0twMGvXHPIJ5ynKHkekjxVjMgOA+dMXVQvx7lE0Q2QwA3QIa8Ium7jQpirO6XxlytnHY/XizlhnOpbjELJQQFVN+7YWaUues8EFFemZuJLjp+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: List-Subscribe: List-Unsubscribe: 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 --- 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 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--; From patchwork Thu Sep 19 23:48:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yang X-Patchwork-Id: 13808063 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 DB427CF397B for ; Fri, 20 Sep 2024 00:40:14 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6B6DD6B008A; Thu, 19 Sep 2024 20:40:14 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 63D5F6B008C; Thu, 19 Sep 2024 20:40:14 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 41AC86B0092; Thu, 19 Sep 2024 20:40:14 -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 1B0376B008A for ; Thu, 19 Sep 2024 20:40:14 -0400 (EDT) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 8E7FB1A112F for ; Fri, 20 Sep 2024 00:40:13 +0000 (UTC) X-FDA: 82583259906.16.259260C Received: from mail-ed1-f51.google.com (mail-ed1-f51.google.com [209.85.208.51]) by imf22.hostedemail.com (Postfix) with ESMTP id C69EEC000B for ; Fri, 20 Sep 2024 00:40:11 +0000 (UTC) Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=HHmmCwCC; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf22.hostedemail.com: domain of richard.weiyang@gmail.com designates 209.85.208.51 as permitted sender) smtp.mailfrom=richard.weiyang@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1726792728; a=rsa-sha256; cv=none; b=rni2rrBitYjGjQ1iMUWCdPQQuRKLXdOJdflODqvlFPnF0DUxwo/v6qxo8dyiLRvbxqalLi F0+ZLMVTjJQYjyu3aXsGtus3v5UMlKh+1HMcBPy3lAz2x11XfNtuCAETaGvyjm5o4jxdqm wCOePjcmu1v7o7AbZqsf3EaS6iskwrk= ARC-Authentication-Results: i=1; imf22.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=HHmmCwCC; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf22.hostedemail.com: domain of richard.weiyang@gmail.com designates 209.85.208.51 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=1726792728; 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=fmbAFMGUuyPIVLChk1SjH2boTL+656uQ3JpO53WmJ0A=; b=sbo5KY/Qyh5qSjcqAHQ9dNrGodHzV8xkqriulNrwOks1lisDm3T0RJqYkzO6pr7/QDqXMY WvrbMRGMU/mDXRIBj3TdYWbRsZpNQdqAg1v3a6n7SaCA3UVE3NrUYVzp67CxVDq/c2WRWQ 0dguyLRQYzRaPUBGMKoHgZd3GXrwK10= Received: by mail-ed1-f51.google.com with SMTP id 4fb4d7f45d1cf-5c42e7adbe0so1593348a12.2 for ; Thu, 19 Sep 2024 17:40:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1726792810; x=1727397610; 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=fmbAFMGUuyPIVLChk1SjH2boTL+656uQ3JpO53WmJ0A=; b=HHmmCwCCJNWxc1KZp9OKQb3L8uvtGY6BRsINvuCUR2NTquWuYIDdg+wfv2e8e+yhwz ZjgJ8wnqOFpyNnny0rDb42ghSg+gUBKcTNoZ9KQTQ1I5BL/JmJSX03KGLWLNnVsVNJg0 lrNi8/uM8iYbVmrWSXPXBOBMKAFXZjQTKrCS67ClduMFeT2Pi0HdXqXWTxVa7mrTHrYj oQQAQzslZP/Y9403AotYrk5ZJXrjMWXdFTTye+fyw683388tjkzIk4wi3vkJUtml+jrB +tLef9cgL7edhrA7XUD4LrpjxgwbnXImU2cHX7Y37Kgx6S1TMveq9aW/t345A3LSalOs A4TA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726792810; x=1727397610; 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=fmbAFMGUuyPIVLChk1SjH2boTL+656uQ3JpO53WmJ0A=; b=oFrSd9edynB/6KRp4bFXJTXPrNbPiYZXseREitsW5niMsMyAjtMYOLBivn/tJ1byao Ms/sxbu5W+gcb9/Kuc/4GQ82i5LYlYtk7Qcc+s2tRuVLswrXseYxTcLifgBP+Ft1NJ5c DAW+Nvgaaf5PEoe7gvewnOciSX1bTgwk1OwG4SfnnnUo0gzX8/QxbE52d+zbxAmHuLGo B1o0vF2ngn60g7PTJIYfOJwVZJz9Dc2ghMhxpWvWRYsAfCYKM/FhJj2b7j1l1QyXZpcp k9cmovtvlMeOhdKcuHtD+QJmykQLQ/sgRsPrXxbRxbN0L2m1GcsLVj03gnOXePgNuDSn G75A== X-Forwarded-Encrypted: i=1; AJvYcCWb0I2cqnX2L9/l+4sObLd8vwbn+esGp+yEZdrYf/IUgAbIcJARMurC+rBV8I2cW2TJpr4CSrvUrg==@kvack.org X-Gm-Message-State: AOJu0Yy25JO3BcVdw4b5yDYn2kWARtKGlYkkK0U3wcSayxuMC+fhHxlF cOx+7vwKSrwpsD/CIS2TtKcR3LFII8MfZhb00EEKhcXIOIDcdm17 X-Google-Smtp-Source: AGHT+IEBKkZHRVaDyhKGiI6GVXPDcRT/TmGFW23gZOzbRg7Q4uESeMDfM6pLOzlvE1if7genczIWxA== X-Received: by 2002:a17:907:1c28:b0:a8a:3ece:d073 with SMTP id a640c23a62f3a-a90d5672848mr55267266b.10.1726792809964; Thu, 19 Sep 2024 17:40:09 -0700 (PDT) Received: from localhost ([185.92.221.13]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a90cbc7122esm111084366b.124.2024.09.19.17.40.07 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 19 Sep 2024 17:40:08 -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 Subject: [PATCH 3/4] maple_tree: copy to mt_pivot_count() instead of mt_slot_count() Date: Thu, 19 Sep 2024 23:48:31 +0000 Message-Id: <20240919234832.24237-4-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: C69EEC000B X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: mku5qc5zk9gasc97sddfgwziwe1iwoyp X-HE-Tag: 1726792811-839278 X-HE-Meta: U2FsdGVkX1/2vHhqzd7xMHJMJdkCBf40vu79xLQZOLNpyL3kHV5eGGELIUdBRI6GWY0X8TrU7rimzDLr3DpFRcegio2xgwv/q8pS1m6rM7cFjnuY0XIvSWM3JtbtueTFZIF8pf0D946aNTH20KK4deY+1SWMnRQeXy5ND2z4tKaB96YaOBDJU2H+vj2lJXIQ4zTR0mJRPZqbQl+cB5RM8geK/zvPME6OdST20886HgviWJgg2euYKeLZxEr1WS6+iSkm9sILTsvTGrdV8oVu+y3IRf/YenWVdV7uZqyeYsYPEefgskGhBIA2KfFSFX7POuTge4xOwQi3t23Lrv+I08DYr7z3TYA+OlquA72pwrthPmkq6V0U9jnEm4gZOsNNmrM/VDeKMGIQVLuBmfR6WlLUayRSG6eAeVnuxZYNxRuXRvLusuCNtCWuuGeWcvRRygAysW3AoQZJSeWoXxuB0UMS1mcQFzW+oVdx18hAf+H7Xkm71wCXTW20S7p9MameEV6iRMUAmIG/WS6o1b9FtYJTMSYprvJHqdhzniF5Sgezot0BKyamc4u53H0l6ZWHgt8PeWWV1K5LKJzY2FqLnHXZ+epmlW2icPNOZ4yvjw74rYdavgX/xgN0BDGuGXuRrn8QgdbiWsRPvuIIUlZCqluejm9lfL3yZ9h/Mnrp0hk1DpcpyOKCd5W5g/jPI7jgyuFifqlkVBjEa4FFxRs6b0QAGWWa0+1LW0BZxD38QX1lzbU8YQ2XqY4qSHT7Gv39onY44PvbW93Wyvi1/CUTwgomYssa2j5JhR6N5+UH+43yvSmBLq0YtVCk+QHYCSs7V3oFlPNj+ylxKgVUo+hqkDF7ncRR1T4dW2H3UbpmXHWulB2o4HFvcTPAjC75vNONWnSFqa5hpBLWdDKzBbmJRdginp7ew1RPQbD2WECgm+sDW4pv0LFPhyNVMYCWco/d6Z5SYXcq7IoInrbUTvu /nuv5EuT ybba8CjiRKwJuQxnvQRyd7WuoUEhz8WC/UEsB1gGKLDoNdccGoAaab3FiWPhWe1Cv0SletyQiEYL4kK+cZrIf0FxDUOG+T0p7gE63MGrHiEnynasbu6OUUXqSccDxqwunuF4OEytDBrsUdYYHEGxPPIfeQaERIxLa6wGmkkcd6Pa9AwG2CfuLIrmpekZ5RmggXavCYeoSw/8WnWxTs450y2lz+EfUZ13+LNc8oN8yYth+BU29zHTLTFKCjOrBgys5yaIDepj2M8qfEDXG4R17UyuQpfQ8KubAdX9Bzd0NCnYZF0faE91typjEC04MjIJZg2cWUPObB6rbK2hlb1pE4DLc0RvRhMYNmTM1Q/MowbhSaZs0BnP3FJTbBNlxQ58LFTMI/LRm1GyO6/+ppD+3Wr47ESE3GtmsvlqPxhtL7e9SarUHQ7OGhVZcDwXP5hAhK4gXVlLHoZENyVUGCLGstMO57pXc5x3M/mb/ X-Bogosity: Ham, tests=bogofilter, spamicity=0.011445, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: mas_mab_cp() copy a maple_node's range inclusively, and the maximum valid data index is (mt_slot_count() - 1) instead of mt_slot_count(). But if using (mt_slot_count() - 1) directly, it would have more instructions. The good news is we have defined mt_pivot_count() == (mt_slot_count - 1), except for maple_dense node. And mas_mab_cp() doesn't handle maple_dense node. So it is safe to use it. By doing so have almost identical generated code: Current: lib/maple_tree.c:2209: mas_mab_cp(mast->orig_r, 0, mt_slot_count(mast->orig_r->node), movl %esi, (%esp) # _135, movl -88(%ebp), %eax # %sfp, _137 movzbl mt_slots(%edx), %ecx # mt_slots[_142], mt_slots[_142] xorl %edx, %edx # movl %eax, 4(%esp) # _137, movl %ebx, %eax # _138, call mas_mab_cp # After applying this patch: lib/maple_tree.c:2209: mas_mab_cp(mast->orig_r, 0, mt_pivot_count(mast->orig_r->node), movl %esi, (%esp) # _135, movl -88(%ebp), %eax # %sfp, _137 movzbl mt_pivots(%edx), %ecx # mt_pivots[_142], mt_pivots[_142] xorl %edx, %edx # movl %eax, 4(%esp) # _137, movl %ebx, %eax # _138, call mas_mab_cp # The difference is we access mt_pivots to get ecx instead of mt_slots, which doesn't expect performance difference. Signed-off-by: Wei Yang --- lib/maple_tree.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/maple_tree.c b/lib/maple_tree.c index 8ff075645f21..bb4183b973d4 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -2211,7 +2211,7 @@ static inline void mast_rebalance_next(struct maple_subtree_state *mast) { unsigned char b_end = mast->bn->b_end; - mas_mab_cp(mast->orig_r, 0, mt_slot_count(mast->orig_r->node), + mas_mab_cp(mast->orig_r, 0, mt_pivot_count(mast->orig_r->node), mast->bn, b_end); mast->orig_r->last = mast->orig_r->max; } @@ -2692,7 +2692,7 @@ static inline void mast_combine_cp_right(struct maple_subtree_state *mast) return; mas_mab_cp(mast->orig_r, mast->orig_r->offset + 1, - mt_slot_count(mast->orig_r->node), mast->bn, + mt_pivot_count(mast->orig_r->node), mast->bn, mast->bn->b_end); mast->orig_r->last = mast->orig_r->max; } @@ -2963,7 +2963,7 @@ static inline int mas_rebalance(struct ma_state *mas, l_mas = r_mas = *mas; if (mas_next_sibling(&r_mas)) { - mas_mab_cp(&r_mas, 0, mt_slot_count(r_mas.node), b_node, b_end); + mas_mab_cp(&r_mas, 0, mt_pivot_count(r_mas.node), b_node, b_end); r_mas.last = r_mas.index = r_mas.max; } else { mas_prev_sibling(&l_mas); From patchwork Thu Sep 19 23:48:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yang X-Patchwork-Id: 13808064 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 060E4CF397B for ; Fri, 20 Sep 2024 00:40:18 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8621C6B008C; Thu, 19 Sep 2024 20:40:17 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 7EA926B0093; Thu, 19 Sep 2024 20:40:17 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5F0DD6B0095; Thu, 19 Sep 2024 20:40:17 -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 34B7B6B008C for ; Thu, 19 Sep 2024 20:40:17 -0400 (EDT) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id ABE5DAB7E6 for ; Fri, 20 Sep 2024 00:40:16 +0000 (UTC) X-FDA: 82583260032.16.A0F338E Received: from mail-ed1-f51.google.com (mail-ed1-f51.google.com [209.85.208.51]) by imf24.hostedemail.com (Postfix) with ESMTP id E284618000A for ; Fri, 20 Sep 2024 00:40:14 +0000 (UTC) Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b="Vb/O1XRK"; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf24.hostedemail.com: domain of richard.weiyang@gmail.com designates 209.85.208.51 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=1726792689; 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=IooE48wMynEcoclDwBLR56J5Lm7xR6JbzWdlx2vrATs=; b=Se7kvM/Cn1ciAD9I1K7qAeuDFFC+g93YwgovAt+DSlxwRBHh05oXBKLfzpd52dwNZDslcN aQyaQiYOLjZN1C8Q8qRL/Ehgi3AzKnXoV0ZfhFT9uOJvrNFHzAoU97BiyetD84WOs/Wo7m /Q0IJsF8vn2MKtzr963QgBg+QxxhYJw= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1726792689; a=rsa-sha256; cv=none; b=RjHF5Gf5eL27ia1ykJQy38/lxvB5BNB6I3FfZN7MurjcZi/UtysBKAoBdtK8O055tmWzy3 XURvsILUy+AgUsKYft5SXwSdxvF5RZOfnIweSvdyGipO4DMCMLEkWMHpUg9+/MqTiB64fA Vh5N4eBufzfsLXaHUGKYSsrceNBeYqU= ARC-Authentication-Results: i=1; imf24.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b="Vb/O1XRK"; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf24.hostedemail.com: domain of richard.weiyang@gmail.com designates 209.85.208.51 as permitted sender) smtp.mailfrom=richard.weiyang@gmail.com Received: by mail-ed1-f51.google.com with SMTP id 4fb4d7f45d1cf-5c42bcf35fbso1931783a12.1 for ; Thu, 19 Sep 2024 17:40:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1726792813; x=1727397613; 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=IooE48wMynEcoclDwBLR56J5Lm7xR6JbzWdlx2vrATs=; b=Vb/O1XRKBuuhVHRPfzZv/k3oOF6sVzwm7k92yxjrnQJjPHUXdT2/y9aemH6/xx9w6V XyROZKbcMfJ4nbUSuhKyE0BkV3qE6hjWI+92NVHAElrweIBWnokovxO9/ekXkdswgFGX OhJGOawXawsUAqPahP44tfQfep/SPxIKZQiFAvA5N5DiyKLyN67hrGbHkYvj3QCAHNOb eRgvwWCb9gyjWZE3Ujb5U08L/g5msK/9qy59dlZZp39MKwDsv0OKxHcfxpcv3GPP6N3Q fErde/7R8u47uTujCpS57G+wjcFJ3qw5HcLSIynLvA/ZhwRIYnXgmmICafXa5df7g0pZ ZAZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726792813; x=1727397613; 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=IooE48wMynEcoclDwBLR56J5Lm7xR6JbzWdlx2vrATs=; b=Df8hBB8o7VX3Bji4Hi+gO7L2Az5sjokmE0EzQKZRxPJAZbVDphJ1cyyJbHKRovSJ46 kgCV5F7d2s3l+7+DqaimVeM6CL+hQfzmZR8VJHO4yqZyJ1msVpxpI3AM9YKZACSwg3oP YRctY++2Ap/XubADPU5RvFKwxzBwnRyPTbp/jbc8asSZcWKG/YaD1gym33EuspFy8Zc+ IPRKjSpZ7ozXbntgK6UNJcEsJ0QW7xrLBzGgS2Zv5oy2f40QrmR2UyCVVyuS4ccmUMa9 KviBFVJdrjv7W4Bp1PsS85fleQzQSskMIwQ/eUW0FdKarZCmQ149k6w75k8cnNNUZH+b DSOg== X-Forwarded-Encrypted: i=1; AJvYcCVpLuBGv3njzcadrdbe65S+ig9IV1z2vh+ydgEwgrsjdavhCxRKPSzb22FSbtkBt+QlbBh/bkeJeA==@kvack.org X-Gm-Message-State: AOJu0Yydo0tbHB5zI4Txu3G38V2fSiaqnAx5HqXzD8L1Kt3XUyECs+Aj Ll7/FXGRx/uRyiptaMpnXXJ/oyQ/lO0HngqAF4y4z6WByeXgvWx0 X-Google-Smtp-Source: AGHT+IFRBsLAhgNlFvg5x+oK3AK4SEjLB3PJ5jaJKsbqQfOnTd9nmvgjt4KuocdHu6PNL2fACdHr5g== X-Received: by 2002:a17:906:6a11:b0:a7a:a212:be4e with SMTP id a640c23a62f3a-a90d4fbc673mr93599166b.7.1726792813288; Thu, 19 Sep 2024 17:40:13 -0700 (PDT) Received: from localhost ([185.92.221.13]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a90612e67f3sm772752566b.185.2024.09.19.17.40.10 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 19 Sep 2024 17:40:11 -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 Subject: [PATCH 4/4] maple_tree: now we are sure mas_end wouldn't exceed mt_pivots[mt] Date: Thu, 19 Sep 2024 23:48:32 +0000 Message-Id: <20240919234832.24237-5-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-Server: rspam07 X-Rspamd-Queue-Id: E284618000A X-Stat-Signature: 5pgcc86hu6bs3fmp7uncsopgkeu5j44u X-Rspam-User: X-HE-Tag: 1726792814-314696 X-HE-Meta: U2FsdGVkX1+KzxcNch5wcTDrFeyrRIbNXAh/OlgIy4x3QLWTcYBaRwne4AjNS/nX1x2QiqqjzW6KMgNOt3FQcqAlJympS6N2GeJnT3nXQXdJjJcUiPwfNOOd9uyoI+0izdRHp3OeDGd2r37MfkVyBabFUWioIj39ru4c6QrM8OQF/PYKFG9eAT/H71L3qEcgaR6zd1Z+LYtLyqG34cZwOwMKCEBvqm9XWuNYtRbu0zWIPoaD77AtGA0uDP+HkfCxcmGxI611Ie7GjpFuD6A1Fkh3ERsNFvDDCQwnFlAL/ryPTuqGzy1nwuvNuHr5I8oSt3DuViWsCp8mP+25V+cLbuRBGJhcVMISXC87w63/1m587slv69ozURebpZmn8QyrjNE0TruKWSeC/sZbpTSZuSz6dT4c8iGtXNtbui4vb1PzZpjXQAz0gY2XciYkXj593g9Qzme/a0JY8+5Z8v5fIGhXUfD67vJZlxxm1dZWEzo87byTiQbSS7dI/0ZWDa0T4ZgHoME08/v//Sql50l66nVqPmeDGF5ddCxBeeCyH0/8I8cPnMpS3X2GNgLL2ZYnCEDDR8ro1HV58xEQdLymox4Fcco3K/neZdD1lfjKfPGlgx9SaCOzDe7DiTCSJWnmn9jUj8La6qhJx4dRy73+kaEyp02GENO3whQs8jJWzksfvJWXcqpoozATvCOijc42vahrPRuQrE4yN1GimyeJL8PeEoIJT62UVfaFrWs1ulZ0DoLvZ2BnHHJXO6Rza2STphSwCBjjsQgQ7IWDIbtDNR6BL1qTBTUNFFrjENCQZzsWfrdtAh/wmdDa67L/KNNeovKOrWfuZF29E7QuizjfhhB8mUqB4kJNN6N+t6Vx1FQ2xIqDmNu2WYJIh40rjnXkdkjh0RzmubxevEC0RZ8UE0fbnWG+L79hqizLNFeTj2Q2dl84yhMZ8K0PHzyzo0nvD87nn9saAQj7A4OXNW2 Pzku30vM 9oY/9Nka5Avkd7ThEBjy9qklgIO49pa+vFtFRbSxQ78GUz+pnWZob4R/yGvz1ZCrU2sB8v6W4Q2Y9oR6BlIlMGkWZcP3X5EnOJlcuE6rjVMyKXvOYaijRE5xwHetMMX0q4tQnD1Irw+m4YBm8R/psjvkIv9nOA/VqpeiAR6cgBzzAXx4tUCmJGERQyD+9kbzSbX5QHJGc4EvgV/9WQMB3I36StKqkD/oJAcv6NTsBzCI7xcooEkY2RGpAF6TzQceKMwAP9YaL4HqCZwwMv09D71UFWE4p/c35Bp2xF6WRWHAhDCYHRzw3UTpg4xU7vquYVqVOs45QXg4Zo64ILL4UTGeLWWGJzTv8xuJYSa0NCGidrRJ2leJIc2UoCtGiQJI9LwhcK+X5NXRgiAU+LN2aLcGCokrCwEAzKWdj8lK3wnaTo380jU5quS9Uh4nU1HAl95fRdUv9Nb2Uyq64fp3P0y09Scst1DMyyf7ZHR9y0PwPyaU= X-Bogosity: Ham, tests=bogofilter, spamicity=0.017338, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Now all the cases of mas_mab_cp() is called with mas_end at most equals mt_pivots[mt]. So we can get piv_end == mas_end. Signed-off-by: Wei Yang --- lib/maple_tree.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/maple_tree.c b/lib/maple_tree.c index bb4183b973d4..ef9aba07adbd 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -1907,11 +1907,11 @@ static inline void mas_mab_cp(struct ma_state *mas, unsigned char mas_start, void __rcu **slots; unsigned long *pivots, *gaps; int i = mas_start, j = mab_start; - unsigned char piv_end; node = mas_mn(mas); mt = mte_node_type(mas->node); pivots = ma_pivots(node, mt); + if (!i) { b_node->pivot[j] = pivots[i++]; if (unlikely(i > mas_end)) @@ -1919,8 +1919,7 @@ static inline void mas_mab_cp(struct ma_state *mas, unsigned char mas_start, j++; } - piv_end = min(mas_end, mt_pivots[mt]); - for (; i < piv_end; i++, j++) { + for (; i < mas_end; i++, j++) { b_node->pivot[j] = pivots[i]; if (unlikely(!b_node->pivot[j])) goto complete;