From patchwork Wed Nov 27 01:27:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yang X-Patchwork-Id: 13886474 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 9D408D66BA5 for ; Wed, 27 Nov 2024 01:28:34 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 135D36B0085; Tue, 26 Nov 2024 20:28:34 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 0C0136B0088; Tue, 26 Nov 2024 20:28:33 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D1C356B0089; Tue, 26 Nov 2024 20:28:33 -0500 (EST) 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 AFBC46B0085 for ; Tue, 26 Nov 2024 20:28:33 -0500 (EST) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 26534C17EE for ; Wed, 27 Nov 2024 01:28:33 +0000 (UTC) X-FDA: 82830139812.01.AA8114E Received: from mail-ed1-f46.google.com (mail-ed1-f46.google.com [209.85.208.46]) by imf08.hostedemail.com (Postfix) with ESMTP id E2135160006 for ; Wed, 27 Nov 2024 01:28:27 +0000 (UTC) Authentication-Results: imf08.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=im00ST3X; spf=pass (imf08.hostedemail.com: domain of richard.weiyang@gmail.com designates 209.85.208.46 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=1732670907; 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=uJkqhet0Mlq7bouP3wPXP5U6Dlrr4d3VEb6rJvN0xTc=; b=0XKM6UTFa6c+QZLkiRIGzJJoVKx7UHtGlkPOhI5x2qAMh4Nf3D1GGmxhqh6sihgku12Vwd du+dwjg0HAps84Sp9cbcmhctnDvJddk8nZyVEcQlWhvKoFENgAo+1w+FHST9cCJB4XmvxB 4rI2854qPI5Z1dGND1prvmHQ9dK0YrU= ARC-Authentication-Results: i=1; imf08.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=im00ST3X; spf=pass (imf08.hostedemail.com: domain of richard.weiyang@gmail.com designates 209.85.208.46 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=1732670907; a=rsa-sha256; cv=none; b=6Bnv9zzWM5BE1xIwb/cxy+x3xn8RvP+gx8zvbMynH5PtN9r8wtjkTR1h27mwUs+RkqQB5l ckK00FAKjQeiQhXr3uom8PqE0qePY4e1NFlUTQTpigsMK2DNz5onqiXQG/Tntiu+vAUKhq QGasCBLhR1TeRw6fTums/MKVcrae00M= Received: by mail-ed1-f46.google.com with SMTP id 4fb4d7f45d1cf-5d0062e9c80so7876790a12.2 for ; Tue, 26 Nov 2024 17:28:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1732670910; x=1733275710; 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=uJkqhet0Mlq7bouP3wPXP5U6Dlrr4d3VEb6rJvN0xTc=; b=im00ST3XEulsgCP2ZtBPW9RoZ7EDEZ+fq6gJCmODZKp2JlEu+3LEj7PdQX3azlZN1u DdLgE8cuAdz0OIlgMxPRZg8BkAZkxHaw13eCy10+Ho7h416zjHvydxgR9BjNcosqexdk bG3w5F1gWDhXPEUHFoneH326ly6Gnl9rxAk4pqQPRCWehTqwKXGkxj2O2S32MP1LKNEP wVOWizuyK4TwZA+XD6O45rMeTvSK/YvVaJViFifZtfHCPmtAxn3AzzTb6y9uKjQ3J1TX dSXJMZwcEvEfPV7pJSn0XcF53xnToS3M8CxgIH6QDtaMW7vUHfNi0MGbx6qZuRJzNeJG 7cOw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732670910; x=1733275710; 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=uJkqhet0Mlq7bouP3wPXP5U6Dlrr4d3VEb6rJvN0xTc=; b=KaIsb92nUi3Rhc+dMqe483bnl6KkLcQK2yIg4SBeIavr21+uf6PKEV1jmbjwDmCWPv jONCGF56W2yT9LwwzjPvRUl56lYR0nCmdmI62wsa1KY2UZo52x1PUhzPuTWY0aGtoOpR yC2JklJEKcdG03x0x1YAswXembnaCGLavV+tBL5pJ3TANebVsy2LE4W1Rch8I3vTB2wG Lv8R4GUBSC40bw4RO1ISDmEo4WyTWODEjX3UfixYekabrAkBFrzHs7T0+cBhbkLyGpDG nnBv+WIx6ixH0S9Tli3RrR0i9SF0m7biUuIORK5oJFD1B8cJHZYj5a/q1W4is69/yJvy scKA== X-Forwarded-Encrypted: i=1; AJvYcCWx2yVax5tVwGrtD71t+qvUzAZCK28TTWxDLSvwvOWq8z2jMlAVSl250oQgWeSvUcWqEjzIqJJR2g==@kvack.org X-Gm-Message-State: AOJu0YxIw9VZWbepEGp0UucM2nEhCTcz2PaeI8Yl7iOUUPXokHUFzL7u fHF1DO65nvtCElikvuGZzL+MB6PCzbM8ba+6XXqFR07XNsbWD7nj X-Gm-Gg: ASbGncvbDc/YIQZVfgELGYsVdrWT7+lkR1WdaVwYdA5M4W4EqFFRq1+TaHuQQHCDUsB pLN3miAXrru3RCF+ciOqGoehlq2bIzxqr5ikmGsnjVAmWEipSjfyQ5cXuiJyXSl7GyhLfhIyuk7 BSc+vFklCas5qZ9UpgwE0VxHP1cXJzyQAHu1/TccD5P1J6WOXA9r+kqKHk/Ums4ChmorTtU6IFd zUBOoxFteFbra0+EAqoSBEGvwqE+bru8f5Iayfm9yN+0CqvFQ== X-Google-Smtp-Source: AGHT+IGCDgNdAkXiwwZr/isH9AIHOfJu1Ag94VrBy18uPUsvMK4UXxF/aUgCdoFgErCRouDYtkdlNg== X-Received: by 2002:a17:906:1db1:b0:aa5:479b:3d25 with SMTP id a640c23a62f3a-aa581062a7emr62038666b.51.1732670909729; Tue, 26 Nov 2024 17:28:29 -0800 (PST) Received: from localhost ([185.92.221.13]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-aa54a4c06a0sm370685466b.58.2024.11.26.17.28.26 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 26 Nov 2024 17:28:28 -0800 (PST) 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/7] maple_tree: not necessary to check ahead if !content Date: Wed, 27 Nov 2024 01:27:47 +0000 Message-Id: <20241127012753.3393-2-richard.weiyang@gmail.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20241127012753.3393-1-richard.weiyang@gmail.com> References: <20241127012753.3393-1-richard.weiyang@gmail.com> X-Rspamd-Queue-Id: E2135160006 X-Rspamd-Server: rspam12 X-Stat-Signature: 1y514oxx76gc6pkoc78dn8ehcympu78o X-Rspam-User: X-HE-Tag: 1732670907-134933 X-HE-Meta: U2FsdGVkX1/xmc2CTpSKf2rrwqZRv63l9aq4ajkb7xnwd7d/Pf551vJuDR98Vsdt2223xJtciH112R94nu89N973wP5JpP4QTkv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cbyfXCQmpI+UBj3eU3mxsK9ZYBku9LjZLDhkWVCkcRlutlqsBEhT/OpcjdLEz0uJBI27mBroUHLf34IUl65XiwycPufGnGmEb7gO8bRQRTHrx+PmAomOiApDsS+y9r4Al4afGiXSf8alKE/MVsp7gonPW4Df4ZDoDIpZ0S42D6pFoI5gPJSeXQ7ZUT2VoG9P8ra7iJ4EKmuGEgu+QOy0COkt6kcuwz2nyaoAfJWApKuEFmzmiSgzdsXtYGLMl2vMMgBFrSQprnndfXuEL+AvRbaDqdJKkWRvi8rCVJmW7Qa8FL+diLz0J5/MRu/Nn65JwoQkS/gY3xfwpLRx4Gk3oX4jM83lob8XizNlkT+I/LZXftqnQkiSsXONQ= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000026, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Just like mas_wr_extend_null(), only when content is not NULL, we may have a NULL slot ahead. So we can wrap it in an else. Signed-off-by: Wei Yang CC: Liam R. Howlett CC: Sidhartha Kumar CC: Lorenzo Stoakes --- lib/maple_tree.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/lib/maple_tree.c b/lib/maple_tree.c index 7efb1520f9bd..98692704d773 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -3568,18 +3568,20 @@ static inline void mas_extend_spanning_null(struct ma_wr_state *l_wr_mas, unsigned char l_slot; l_slot = l_mas->offset; - if (!l_wr_mas->content) + if (!l_wr_mas->content) { + /* If this one is null, the next and prev are not */ l_mas->index = l_wr_mas->r_min; + } else { + if ((l_mas->index == l_wr_mas->r_min) && + (l_slot && + !mas_slot_locked(l_mas, l_wr_mas->slots, l_slot - 1))) { + if (l_slot > 1) + l_mas->index = l_wr_mas->pivots[l_slot - 2] + 1; + else + l_mas->index = l_mas->min; - if ((l_mas->index == l_wr_mas->r_min) && - (l_slot && - !mas_slot_locked(l_mas, l_wr_mas->slots, l_slot - 1))) { - if (l_slot > 1) - l_mas->index = l_wr_mas->pivots[l_slot - 2] + 1; - else - l_mas->index = l_mas->min; - - l_mas->offset = l_slot - 1; + l_mas->offset = l_slot - 1; + } } if (!r_wr_mas->content) { From patchwork Wed Nov 27 01:27:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yang X-Patchwork-Id: 13886475 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 620FDD66BA5 for ; Wed, 27 Nov 2024 01:28:37 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DE0AA6B0089; Tue, 26 Nov 2024 20:28:36 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id D6B8F6B008C; Tue, 26 Nov 2024 20:28:36 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B6ED96B0092; Tue, 26 Nov 2024 20:28:36 -0500 (EST) 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 959E66B0089 for ; Tue, 26 Nov 2024 20:28:36 -0500 (EST) Received: from smtpin05.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 147801616B2 for ; Wed, 27 Nov 2024 01:28:36 +0000 (UTC) X-FDA: 82830140106.05.B1E848B Received: from mail-wr1-f47.google.com (mail-wr1-f47.google.com [209.85.221.47]) by imf12.hostedemail.com (Postfix) with ESMTP id C4C4240015 for ; Wed, 27 Nov 2024 01:28:31 +0000 (UTC) Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b="l/IoSkzZ"; spf=pass (imf12.hostedemail.com: domain of richard.weiyang@gmail.com designates 209.85.221.47 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=1732670908; 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=cTjCN0HxFnKdxfML0LSXNamo6sJegygcfTLnMer1j14=; b=VPsb/riDGzmX5rd3PmWW/XgQtaJ/HtviPB561VF5vnc1P/FUxFbb/y5O+xIFnTZxjxA9NE bm6AfKfhDfi2ZCujg2UpHoLmSlqFvRJIwKaRkTjZoreBTPOGyTDwr6ROQXSr8VdS/uuxes DR2Guh+azgMegbPltadBxJCh5aBG41I= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1732670908; a=rsa-sha256; cv=none; b=NJjIuTtQ57RsJWHrE5k++3qbbbWiDlZuTXLrfMCJAKHIzLfWzTOSzqdFIDVbJ5dDG0HIRe P1Lqs5s0wzEiDWjuBYr3SJCFZQ+MoLlrDxRk3TogENXZEm79T7+XjPA24wjs6JZjmpqGKK us14dmsgdwoOeORDqXP40wGuPDxCNCE= ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b="l/IoSkzZ"; spf=pass (imf12.hostedemail.com: domain of richard.weiyang@gmail.com designates 209.85.221.47 as permitted sender) smtp.mailfrom=richard.weiyang@gmail.com; dmarc=pass (policy=none) header.from=gmail.com Received: by mail-wr1-f47.google.com with SMTP id ffacd0b85a97d-38231f84dccso4312567f8f.1 for ; Tue, 26 Nov 2024 17:28:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1732670912; x=1733275712; 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=cTjCN0HxFnKdxfML0LSXNamo6sJegygcfTLnMer1j14=; b=l/IoSkzZUuoA4fqC7qtymIVmPYGF67QH8n26psC0SN5zfVcIHUlqyFlPRZMy3NAC7m qCBL1WF/z5Fd+qe9WEmjR6SOwt89uJ840aVTt3KVAVl8arXRBCYvxbgLHydbMQqAVs3+ ppiVegjgbNSUEBZtMkchdqTAYZTTSQJo6x31N4SqN/wieqz35Ti6h6fUIIrQK9a7FAH8 i3ejE/ycHFj0+tI494SfNX2bzgMXnraCoO8v8xjhy674tfSaMX/6SRJ2r6iT+xts2zpA qa9agzGYW3ARd+OFvM1nD0JaVVTPU2URPVvNger6+Mygoykf90W6zduZ/m72i1jMyqIz xAEw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732670912; x=1733275712; 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=cTjCN0HxFnKdxfML0LSXNamo6sJegygcfTLnMer1j14=; b=FIl/mez+OTvjGObumo5+qUWoFm+7o7ISa5+ptfAZqNCgim6gIWGyP2/9Wi1vcpG/d+ k5xiJ8//BOfNf5dw1n0dHKZJILYYQADzCj83IT6mIJRG+TrFpJkQy7Gvu4XnC3Q6fOOd Vy6KawN8AzZb5aXxVQ0B60WRPd9jKOC23PGdsDMWeurc6gheHqMp2W9PkO7/J4rDewOE dKPMrF1G4AIvsfYZrbt8wjobGtnvoOpzYn6Cgtr+IIFAbK7DkTdsWEtHV8J/9H/bGHMP 0lILA6dsoLo5sOIMNHuXSGyRhPIOK7J2BIRFkiF2n9HNoxn+0+7DL2weYPSbEdiA5Pez 2pxQ== X-Forwarded-Encrypted: i=1; AJvYcCUUs/2Iw0hrZQb6CWyVsPaywUn1LFRm3or5JdtFWt8cZpESjIMg0riIcxtiN7eMyCTq61Ka+e0BfQ==@kvack.org X-Gm-Message-State: AOJu0YywWeDD4keXH1se2ukXLJetGk4ePoiEZtAgVSjDNF5YOJUinBCk g6aed9ZQOFJC06scv0gHd46f2oLciNXSWc0Fw2p9cdIxRLO7zCHH X-Gm-Gg: ASbGncu5K+Px8FLXLwuvahP+WYiv2XCPhaoixtxIABFTyieFNghz8JtUUH2ldSNRTa3 SiOynzcnqUNEKht0cZavVyLhDC80ZPI2t/YIbOIvl8EivLYxKoAgyh7wtLy5XIta+bPvwd7wPra 4lHuuDpQPI3ddoaUfb0Dxm/xAzmqGTipWS4J5ZQdcn741FVCn44zZPFSwN9IiexOA6bUxkY85p0 7UDJk7W1v0715GGtSHLn9XVTvA7OxxSfI3DlLz7nW5GeDmjHg== X-Google-Smtp-Source: AGHT+IHeIlv6DIn7C3nJzI4w7AVDqBcGxbvBAXJZKnCiXNHUm7UatNfs+UkxA+pdXpRKbOr/kGmRsA== X-Received: by 2002:a5d:5f43:0:b0:374:c847:852 with SMTP id ffacd0b85a97d-385c6ec0d52mr663373f8f.29.1732670912523; Tue, 26 Nov 2024 17:28:32 -0800 (PST) Received: from localhost ([185.92.221.13]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5d01d3a2345sm5590189a12.2.2024.11.26.17.28.30 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 26 Nov 2024 17:28:31 -0800 (PST) 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 2/7] maple_tree: validate we won't split on NULL Date: Wed, 27 Nov 2024 01:27:48 +0000 Message-Id: <20241127012753.3393-3-richard.weiyang@gmail.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20241127012753.3393-1-richard.weiyang@gmail.com> References: <20241127012753.3393-1-richard.weiyang@gmail.com> X-Rspamd-Queue-Id: C4C4240015 X-Rspam-User: X-Rspamd-Server: rspam07 X-Stat-Signature: joete5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yCmCwQ0Zb4s7TOsDJYKpwguhCk+MKFVDp2oYMDVtGZGvXzFp0x3IuJ5z6DZupyfBqYjhrBdd47G95EgrMS39ggMfbk2HI6ednNUZJIsOVWQsL2rlukAVkBa4nM0hhAL+8mFtwH+4W2Tkp+km+1BJfhJi740pDij707Bmxpke76zYw+cm6zhOuE/7Iw58xNPDcAsDdwvCGhAJwiX/S0aI6DzGsewFoAph9Tv7ZPLpYJ4FnCW2Mqm9VVZ4x+iq2pfyAHfik0sG2gORXShBXfBbAdqWvRGVFoSLXaO4bepp6C4IVr+frNS2UVyskdPrtbbgU6YV9UTfI4DkDfi+9/s/X8BqLbLWYylJw64GYLzXsm6ep725/3X/q3nemoFTFZEsysvCPeyD7c6Xo3W7nf+4ujHrfo+011r80OAKvI7Gw/TrBeqBWEEOPA0fnIFa0J/2eKZ540BLCVgPz6IArjVdMpU+e6 X-Bogosity: Ham, tests=bogofilter, spamicity=0.004853, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: If this is not the right most node, we don't expect its last slot to be NULL. Let's validate this. Signed-off-by: Wei Yang CC: Liam R. Howlett CC: Sidhartha Kumar CC: Lorenzo Stoakes --- lib/maple_tree.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/maple_tree.c b/lib/maple_tree.c index 98692704d773..2a00441130ee 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -7522,6 +7522,12 @@ static void mt_validate_nulls(struct maple_tree *mt) MT_BUG_ON(mt, !last && !entry); last = entry; if (offset == mas_data_end(&mas)) { + if ((mas.max != ULONG_MAX) && !entry) { + pr_err("Last slot %p end with NULL\n", + mas_mn(&mas)); + MT_BUG_ON(mas.tree, 1); + } + mas_next_node(&mas, mas_mn(&mas), ULONG_MAX); if (mas_is_overflow(&mas)) return; From patchwork Wed Nov 27 01:27:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yang X-Patchwork-Id: 13886476 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 28F2CD66BA3 for ; Wed, 27 Nov 2024 01:28:39 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A863D6B0092; Tue, 26 Nov 2024 20:28:38 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id A0FF96B0093; Tue, 26 Nov 2024 20:28:38 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 862DD6B0095; Tue, 26 Nov 2024 20:28:38 -0500 (EST) 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 570BC6B0092 for ; Tue, 26 Nov 2024 20:28:38 -0500 (EST) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 0A9A9A0EE3 for ; Wed, 27 Nov 2024 01:28:38 +0000 (UTC) X-FDA: 82830140148.21.0063346 Received: from mail-ed1-f42.google.com (mail-ed1-f42.google.com [209.85.208.42]) by imf04.hostedemail.com (Postfix) with ESMTP id DF0D140018 for ; Wed, 27 Nov 2024 01:28:29 +0000 (UTC) Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=Ir7bNhPc; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf04.hostedemail.com: domain of richard.weiyang@gmail.com designates 209.85.208.42 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=1732670914; 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=6WlYYag5bl5na17CqFt7RfhdHPEuMZJxwTX6PzBzjEQ=; b=nIw42PQ1hvGxy/v1k/5jTjSsBGQUZvKNEHcO7OxtI2NkGZzR5pa6ZCBg1q7JzRiaP2J5CL TVJRvKbYx1t0tv2jMu2f12ia1ZZJI3p9MluL2lak29wWombtkCtyeUD1hQbCWUf/pPvowY NPeHyzyClbhdQXjNkKH0QNt0sMgANjk= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1732670914; a=rsa-sha256; cv=none; b=Mu5LrD6/jOWlC7zPs7UZDRRuWVoJYUZnEXOTMKjFYVBdXbf+BFSt7JjTXAsgyf93o8pJG+ MYUahm9E3MNjAjA/8w844eBiVrefuKDcC+4U4Hp/4v31BPiYfwZGyPUIEQiauENPrefiuJ 1HFLulxVGsd72761yfxoxjY96/KHMmo= ARC-Authentication-Results: i=1; imf04.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=Ir7bNhPc; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf04.hostedemail.com: domain of richard.weiyang@gmail.com designates 209.85.208.42 as permitted sender) smtp.mailfrom=richard.weiyang@gmail.com Received: by mail-ed1-f42.google.com with SMTP id 4fb4d7f45d1cf-5cefa22e9d5so7349490a12.3 for ; Tue, 26 Nov 2024 17:28:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1732670915; x=1733275715; 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=6WlYYag5bl5na17CqFt7RfhdHPEuMZJxwTX6PzBzjEQ=; b=Ir7bNhPcMyce8dNCfEynxg1kh+97H2jKP2mXRGiT4ZXYKobaPnfcOCyIMdnD8566dA DJts7OBhEJxhHCDp/E/5vRk33tej6IAq+QS5Y7IP9zotWIMewXZIr9rDlaqOZbXPf0Ey 4comc0Ui+4xHH+s/zFcxGKw1bJqyBpZTj/WvEx0hAWhW9kVqyI92IrUYwIipi4HS7Ytc hNYOAIbJAxWXc2+zb3IbDY8086Xe0VFoWOelx9mAPGcyZBzxisBrzwOyhKyWNNBreQQb /KTRBsWYlV6zT9pUPaKCETuWc2uQAy9RiQk0A6295MoGl0BChaVZmA+k+W05d11tcJOm YVEw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732670915; x=1733275715; 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=6WlYYag5bl5na17CqFt7RfhdHPEuMZJxwTX6PzBzjEQ=; b=fSAS2EBhlR3euCDg3rCa0g5Fzw9PtpU/znnUBdSfEkVB6i2LpVYk+qDT0+epJDGofd sXJ0mkh972P9KsztdXbxxnArcK90ok+g+wY8vTPsBGhUNp1Kcz0yRyUmC+3Oi4RXwOZC CFVLFvsD458oZ1vJ4ZhnCgB/xuljEitiv8m3ahFPJl5dYhDoDh7cexFldq2r0S+Dj3xt 9UQcDZWmHEgfj5Jn+HedJSG4FG9W7yX9msFkoYh6rPZ3g4ChfKUI3dHiEozetkrKuasv D8gJRjAkT687P2JWbUEzfkGVAfxYXxvD/dyOIhqMKOM0P5xjK/6EKbLgoBAP5dxPJlj3 DRXw== X-Forwarded-Encrypted: i=1; AJvYcCWL3ILb2dnKbgVAg3FfyIkuuvkLL4TW1WIOBOK5q1V8AgI/ChudlVUr8HEz9dyk3iidl5TZK/VGfA==@kvack.org X-Gm-Message-State: AOJu0YyGwNf+EWiDAho9UnXVaBSRA93+N1yaUu6WaMwGUGPjK1rFLw57 Ek2h26WJMTfUAYBchTKdpVaOA/c6OAI5ui1gKgXliCHlkgjmouIwf6rNjwGY X-Gm-Gg: ASbGncuXETWidkGchz8c+dv5gaalFCfoTuSzGhkywXhk4N5LoEU/PcU+MgCtFYrceR1 Mrguq3LuAf6/2OFRzvs0FxM5cCsbjzhkSZ9+lq116q1KtQfd/PMiIJ+7RCYd1fCPdKlsPe/KsL+ ItPD+T5Oi8KA1k+KceXdWp0XSwcyOLxTCinZCqojKzf8CVh7T9ivkc4oLsiNuYsN1BJYBDaingz 7HOhM6hQNw6A4GiBMHkFZ90g11Brh3uyXsO1bkHwicIUEGMVg== X-Google-Smtp-Source: AGHT+IEdp13lrIxwaL3Rejy77vl7pBalJo7v/ja9qVsMrbE7C0fS5nKipAIW+vFMRRhOQILzUBwdVg== X-Received: by 2002:a05:6402:43cd:b0:5d0:7207:319f with SMTP id 4fb4d7f45d1cf-5d080bce68dmr954547a12.19.1732670914520; Tue, 26 Nov 2024 17:28:34 -0800 (PST) Received: from localhost ([185.92.221.13]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5d01d41ae1fsm5570957a12.79.2024.11.26.17.28.32 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 26 Nov 2024 17:28:34 -0800 (PST) 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 3/7] maple_tree: check mid_split only may have Date: Wed, 27 Nov 2024 01:27:49 +0000 Message-Id: <20241127012753.3393-4-richard.weiyang@gmail.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20241127012753.3393-1-richard.weiyang@gmail.com> References: <20241127012753.3393-1-richard.weiyang@gmail.com> X-Stat-Signature: qeqa95p5dx1rgh83zwgwxhxfoeg7zmkx X-Rspamd-Queue-Id: DF0D140018 X-Rspam-User: X-Rspamd-Server: rspam01 X-HE-Tag: 1732670909-61264 X-HE-Meta: U2FsdGVkX1+PNIwVpO5EY8fmZGAvTCE/GMQtdMgRtZ/trae/08mqeYWQughxPXI2Le2t8LFYXA3q5dNuQloD47ti5cBheYR344tkP0HGyDoXH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H5ATRgw2wZJEPEQUa5qbK86OxWdSFXb0TLbKf1v/yVTDh2CHQEj7lk9lOEhuKus1ovw8UVfv/AURMCm+qJaxjcFaYYw4QQhdHG80G0KefNVgU7/j+EwahyAwtOyEE8mKTWrRYfYmKGBsUvx58/u6KftwW0IrWLX49mcIoO0bpewrvdfrt5E9Uxc2LIlYNK1dUZQ1SSmka2qR/Trm6Kp3ZL7Dtah3HyJ2atUyCmNiAhuYsJVNzdvcoObcXer+9x4eBr/NkeJPexHAYm+Fz064CneHPO0c8/1CqMuyjp0jWn3KZklx+EDPuSGRdssjICzZRzd2 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000008, 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 only may set mid_split in the else clause, let's move the check in it. Signed-off-by: Wei Yang CC: Liam R. Howlett CC: Sidhartha Kumar CC: Lorenzo Stoakes --- lib/maple_tree.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/maple_tree.c b/lib/maple_tree.c index 2a00441130ee..f5606b4d0dba 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -2381,10 +2381,11 @@ static inline unsigned char mas_mab_to_node(struct ma_state *mas, } else { split = mab_calc_split(mas, b_node, mid_split); *right = mas_new_ma_node(mas, b_node); + + if (*mid_split) + *middle = mas_new_ma_node(mas, b_node); } - if (*mid_split) - *middle = mas_new_ma_node(mas, b_node); return split; From patchwork Wed Nov 27 01:27:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yang X-Patchwork-Id: 13886477 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 2E891D66BA3 for ; Wed, 27 Nov 2024 01:28:42 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id AAC536B0093; Tue, 26 Nov 2024 20:28:41 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id A366B6B0095; Tue, 26 Nov 2024 20:28:41 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 888096B0098; Tue, 26 Nov 2024 20:28:41 -0500 (EST) 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 60B2F6B0093 for ; Tue, 26 Nov 2024 20:28:41 -0500 (EST) Received: from smtpin30.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 12E0D16171A for ; Wed, 27 Nov 2024 01:28:41 +0000 (UTC) X-FDA: 82830140274.30.2BE10A3 Received: from mail-ej1-f50.google.com (mail-ej1-f50.google.com [209.85.218.50]) by imf12.hostedemail.com (Postfix) with ESMTP id 0981F40010 for ; Wed, 27 Nov 2024 01:28:36 +0000 (UTC) Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=WXfoTe6a; spf=pass (imf12.hostedemail.com: domain of richard.weiyang@gmail.com designates 209.85.218.50 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=1732670914; a=rsa-sha256; cv=none; b=ooQgqrb4ysP5d2JKWwsDjVlkDvdVEMLd/5v33WkDVjWMELJRT8Cbazgzy1reViPuam7cHx p+iJHK1V/LUC+Dvas+jvS/mZn1mRElF/MpBJDmAtR8QIchiZZC/ne5M1UnBXeXpmQPJD1c mqu11GvR/EYRek+mvxCG4TdB4z6/x1E= ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=WXfoTe6a; spf=pass (imf12.hostedemail.com: domain of richard.weiyang@gmail.com designates 209.85.218.50 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=1732670914; 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=IBNmmh4B4M0TQ+/dAhcgCtTY7fB/1UIx9y0TOFR25/k=; b=gx7R13mtBejxZuc3v5EAgovzp0hx9lQ9IKKnqSkFKrrIdb7fhj39H3iqtZXfLNcGxCZCLP 4o+dosgWIiIgxAt1Pof8P5dGAc2l4QwiVKYbujkfFpcEV6w1/o2G7THsDMk2j2rZG0JKvD eJY17tLVXFBmJpJ0kHXR9YdkUJMkuOE= Received: by mail-ej1-f50.google.com with SMTP id a640c23a62f3a-aa520699becso687483966b.1 for ; Tue, 26 Nov 2024 17:28:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1732670918; x=1733275718; 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=IBNmmh4B4M0TQ+/dAhcgCtTY7fB/1UIx9y0TOFR25/k=; b=WXfoTe6a5V6TrXlx3iqOryVKnf8rZcbAKg5Q/Kt5Qs3NLs/Sgt2i+w8N0ctJGeZ72b Kqnnb16wZO1sJFFjnd2p6LerV/q/JbVDPrGJlMxNoknNnFtjZlxhaS6h8KFSBq55dhFN Xxf7NtvBQrce/2WvCRbd/s03sb7FIpitHjepDZJXHNRIWbN7qlDA8MHPfChmjomQYAUf jPn7dX1R03XdjCysI8coLQZ9avqm342LfqvK+8AVKkRROEGrrmEin4g9mPTO1RmrlaNJ vbCV95IgPhFov9sOs8myZ18SWzzxMEGAyCcmIc96pPrFMj1M9525RofgvlPtIK2NpVLn bHOg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732670918; x=1733275718; 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=IBNmmh4B4M0TQ+/dAhcgCtTY7fB/1UIx9y0TOFR25/k=; b=EgleRyWURWifqKmaStqoJViBCg2sRZyiPpDnd0yNbq1ulHfWozwacHSDuFIeXT3YJ+ mw/O6Fk0FXZ0tELqUbx/3G57sRmz50Bybw+RcpwT1CCEJdn2mDsTFeLVelIy4Yq8XXYv KGgZ5epsQXT6nqp+xQgZr2KNRZhUeze5xomy53tbK6wCtCfymxaatSZE4+v0t8NFCad9 F18AXTcFmOrn9EpoWRg5+aKhYX1CJOqBCvIh3Jm68Z39sUB+G9Z4TFLhmaGScc06X4pG iRkp1iMK+o4nLpt291BJaIqYqbwcY+mryAmHWJ2E5kGgYTLsgysvs7N1itdS4PQe6Mhj NIlQ== X-Forwarded-Encrypted: i=1; AJvYcCUw3ihCf3Jpk8X28t0oIMMcdPWgksuIVg7y8AT1mWaVokkJ/Ty7ujJZXF9ynAxKspLZvdE6J4+OZA==@kvack.org X-Gm-Message-State: AOJu0Ywv3UkKscSO5Ae8+8MTvi0+cflTtBumH9nvKFaxMFovg6jBfW+B AgnO8bO9RlJ6PgpN5xTznOIaHT3VxRubM0mefwrafg1bRIRr7Udf X-Gm-Gg: ASbGncutx8l0T/MgihcF7vEy8Sg7NLV8noiL/1rJ76HcSg0uSJUVlNzkh5sMo4uFD6W BWYnQ7d0CstOnU/Y9uqCqdYLWdml8LB+hYCEUejuv/SQcXz+AijZfkaX2dirb7Gmj/xqmrRYidO aS15i55KsCzb8AkUsM8s0qe7bCbHYvN8Snj2MbttGD1M32VGDe/VBpTYAa57cY3nM8n7ItrhRNl oTjp4TGjqGPneA3y41+Ra4cln+g1BT3DHLM51NwAtcyVMBtMA== X-Google-Smtp-Source: AGHT+IHTuJZn8AR6pQBytzVE8FdAHzby8W6a6IeAit27qZQcFvDnSoDUm94nILXUSw7zLA5Z1hfpyQ== X-Received: by 2002:a17:906:3199:b0:aa5:226a:658f with SMTP id a640c23a62f3a-aa580ecf6bfmr69350866b.2.1732670917698; Tue, 26 Nov 2024 17:28:37 -0800 (PST) Received: from localhost ([185.92.221.13]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-aa50c305f56sm652882766b.181.2024.11.26.17.28.34 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 26 Nov 2024 17:28:36 -0800 (PST) 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 4/7] maple_tree: the return value of mast_spanning_rebalance() is not used Date: Wed, 27 Nov 2024 01:27:50 +0000 Message-Id: <20241127012753.3393-5-richard.weiyang@gmail.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20241127012753.3393-1-richard.weiyang@gmail.com> References: <20241127012753.3393-1-richard.weiyang@gmail.com> X-Rspamd-Queue-Id: 0981F40010 X-Stat-Signature: h6jyn5jcpapwgsmy7co5o75uaowd91m6 X-Rspam-User: X-Rspamd-Server: rspam09 X-HE-Tag: 1732670916-488495 X-HE-Meta: U2FsdGVkX18mHcggD/HEvEwy8Sd6+lzgSFdvCMBzDc62oBt1b80c898rA4+W1Eibbb8JZ7H4S/oThnEd458u6Kcei5lwTTolJfbUTELCJGvLyDB410AhjN/2RiKX1+fXN+1tIWGiaarGrAMSF7W8No8kxbcw+2GsJaQosj4KvG07XQdGt/A2Pj9MbP9sKmEnpWaR+65qqw6wU4ld6D6tijQawK5l7K1crnziCkiXPLzADgyGGhyeSy8o1btVvbKJ3HB1EpKIUd960/Dii0rGaM89VHJm9Fv5t8GmeA5rli2Kk51nK3rfKNJ1aJUrjd8LuFpMIHdw+UbUJEYe0tB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O2UP59bc3h5vAIyTWvwuTIPG0LK8nmFULJxXHUrPRW9VInve/eRSq93l3IZYtmLc0mGn1GXi82antSF3EbGD/RihD2a9Cereq+DOO+NYY7m+UqLL3Uo4Kc4V73ouRP3r8wI78Aw17yo/5yKLpioDaEWriygWc9RB8lP1hywQDg== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000007, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: The return value is not used, change it to a void function. Signed-off-by: Wei Yang CC: Liam R. Howlett CC: Sidhartha Kumar CC: Lorenzo Stoakes --- lib/maple_tree.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/maple_tree.c b/lib/maple_tree.c index f5606b4d0dba..6cabee1371ec 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -2265,7 +2265,7 @@ static inline void mast_rebalance_prev(struct maple_subtree_state *mast) * @mast: The maple_subtree_state. */ static inline -bool mast_spanning_rebalance(struct maple_subtree_state *mast) +void mast_spanning_rebalance(struct maple_subtree_state *mast) { struct ma_state r_tmp = *mast->orig_r; struct ma_state l_tmp = *mast->orig_l; @@ -2284,7 +2284,7 @@ bool mast_spanning_rebalance(struct maple_subtree_state *mast) mast_rebalance_next(mast); *mast->orig_l = l_tmp; - return true; + return; } else if (mast->orig_l->offset != 0) { mast->orig_l->offset--; do { @@ -2295,13 +2295,13 @@ bool mast_spanning_rebalance(struct maple_subtree_state *mast) mast_rebalance_prev(mast); *mast->orig_r = r_tmp; - return true; + return; } } while (!mte_is_root(mast->orig_r->node)); *mast->orig_r = r_tmp; *mast->orig_l = l_tmp; - return false; + return; } /* From patchwork Wed Nov 27 01:27:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yang X-Patchwork-Id: 13886478 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 CCE5AD66BA5 for ; Wed, 27 Nov 2024 01:28:44 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 974D76B0098; Tue, 26 Nov 2024 20:28:43 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 8FD276B0099; Tue, 26 Nov 2024 20:28:43 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 79C8C6B009A; Tue, 26 Nov 2024 20:28:43 -0500 (EST) 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 56AA16B0098 for ; Tue, 26 Nov 2024 20:28:43 -0500 (EST) Received: from smtpin25.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id F1BC5121057 for ; Wed, 27 Nov 2024 01:28:42 +0000 (UTC) X-FDA: 82830140316.25.14F7C9A Received: from mail-lf1-f52.google.com (mail-lf1-f52.google.com [209.85.167.52]) by imf10.hostedemail.com (Postfix) with ESMTP id D5604C0008 for ; Wed, 27 Nov 2024 01:28:38 +0000 (UTC) Authentication-Results: imf10.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=DFyP4mWA; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf10.hostedemail.com: domain of richard.weiyang@gmail.com designates 209.85.167.52 as permitted sender) smtp.mailfrom=richard.weiyang@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1732670916; a=rsa-sha256; cv=none; b=3J55lewkAOxTj+3XToKxHUK1adWMH669h43y+nq3t8NEsUKLFzJN8LrCa+UWLuf9jM0V37 rLAaRbRZgC7Yq7Ywq9Ij+Xa8d9tIQ/BSGfM5hIUAGDuiK8jJDjh2yzLYa6KDlySBrto/nW nC7bGOq/y/YyYvtq1awMCDuvmZuJiFs= ARC-Authentication-Results: i=1; imf10.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=DFyP4mWA; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf10.hostedemail.com: domain of richard.weiyang@gmail.com designates 209.85.167.52 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=1732670916; 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=Hz4DrOwQDkGBV/dSxAev4vnHdQKJDrgkgo1ywQp4wX0=; b=mtD5kBeS21uZqLPjgWJB/cUnVlKzQJqCIK0dpQVJKI9khrOwu8SCnp3KgQiC5muQ/yRcVK /dmAHutFLbG9+nQiOycECtQeRxkvhdtOcuKu0T1Hy1dM+j59TlcLhrP4LeCBclYS5MQXEI dxN0OKMS5LlIeSJfecBQ2hausLmdLFA= Received: by mail-lf1-f52.google.com with SMTP id 2adb3069b0e04-53de92be287so2660930e87.1 for ; Tue, 26 Nov 2024 17:28:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1732670919; x=1733275719; 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=Hz4DrOwQDkGBV/dSxAev4vnHdQKJDrgkgo1ywQp4wX0=; b=DFyP4mWAKLMvMt+MmSVPOXsGB64Nuy786JSEVDPsM+tGjTlUPjd/CAv7TK+zcgj32y WMSkK5nBZckQk6wlJBUfImL24qNuJ3r4R7ZNcGh9Q64v9Hhsr5wD3/dAYkRXCMwetzzi 9NergP12iC8jWwY2Opj+h/RI2xKq0zG7LnpuChrR9hxEmm3EMSgteCFodprg2ky/utxh d2d3bCc6SmArvz9HIAZ4kqjHUciwTgYsEjk/wV+9zyhJ0oCfaLGsNi7dInjw1Z8czlw/ oX9Gm76zxs4DBaX+r+r5hiSlL4rtRwUTnAN0jKDU13JEs7RQ31PADudmK3RugwYBLuiz v7JA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732670919; x=1733275719; 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=Hz4DrOwQDkGBV/dSxAev4vnHdQKJDrgkgo1ywQp4wX0=; b=foW1mtd9TqBkMme6eOWoRXSKNCxwVWSpGQSqrHvlBCnNUxldPdIwV9bPA7SejtYrCb NXPVti9wxRAZmUeOqCJXevUR0lIfV1x++CRNfibiVGL0ll2adscg2cr9mi1FE3fpvMAm tBQil6Xn9sdr2kccroVBvbjsFKP3S+/grRIbUMIjTdwMr526Xzr6KhSBHvogQVdMaHRH DNnsONv9UVY/SITxKgLO4pfMZFa8YueG6/eS5Sg+rvYTiB76ibaqvHKiGkgq71B3xLVo D1EU/5oZvNEuBvrJSLnL0TLoAxoYz6eXjPW7/ZjhImrhsl8gQQ6adecjJ2i2NMIlKAjI YPgQ== X-Forwarded-Encrypted: i=1; AJvYcCXr8Z8zn9MT/0iKt4ONt2yopUIhO0MAcDRKO5RNWrU9mmuMQW9rtedpblCbHKtfmwh/QeX/Ouw2IA==@kvack.org X-Gm-Message-State: AOJu0YxwOXX/FTy0GPXPk8VZxunNB/7UVpT6fAl4sbLSx74HgQ6RHCMT 9Cj6j389XSzruxQkW4bnj5siWQzrtC8udmHl/Agsb8wXtp/q34Cj X-Gm-Gg: ASbGncvb3AYG44frO90OO0zy359TApy4+8pbaPHlXfpVorEzPByYvg1fNPtVSg03T2s 0Av+A3csryk1BhN5YnhCjvDKbj5ZcctBURksUY9tQAbrcbo3TBFDVR7c2im34DoNG3jWHSnv+pC Icn9QoPY3VBrjOv9yZhAhb04exOMdxAwhIKhqxQJEkvVXmGkCYrgBJMmQu7EwlvPDmzfHykc3F/ KH0EDJG3H/iF5bBF3+Y7LevLooDsriVPTA/AASOsR2XGJF7Gw== X-Google-Smtp-Source: AGHT+IElDusi/O8aVfxQT+OVSzd03XGkwPKZAD+8a6m2G9b2LfT/1dikfax94cLwrKfBnpAb9xDLlw== X-Received: by 2002:a05:6512:3a8d:b0:53d:e83e:a23d with SMTP id 2adb3069b0e04-53df00d952dmr849075e87.27.1732670918957; Tue, 26 Nov 2024 17:28:38 -0800 (PST) Received: from localhost ([185.92.221.13]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-aa52e45391dsm537747766b.60.2024.11.26.17.28.38 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 26 Nov 2024 17:28:38 -0800 (PST) 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 5/7] maple_tree: the type of left subtree is already saved in bnode->type Date: Wed, 27 Nov 2024 01:27:51 +0000 Message-Id: <20241127012753.3393-6-richard.weiyang@gmail.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20241127012753.3393-1-richard.weiyang@gmail.com> References: <20241127012753.3393-1-richard.weiyang@gmail.com> X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: D5604C0008 X-Stat-Signature: p3u7wrnenpem8idpfa75bjq88wj5k6tc X-Rspam-User: X-HE-Tag: 1732670918-760355 X-HE-Meta: U2FsdGVkX1+eoD6yyROdXpyXSjeQ8NJWVr2W9uZXnw/hs58SDWPgo29iqEhCIgQOK2QMqyMzYxka9XftRvVpiG50D/7y5Cli/SpCGgB/Dlgo4IvF3b7kKG7UihHtnDgytZDcl1eFwb25yfbJPNwQybrQydvjWLAK3MXIgU7meVohLVEmrVSPnxHNQg0CoSuCvliwtpXxVFFjae/gia2uW3D//jqbTYhRW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0BCVQogKk+Ib9RjUt4m7Wsf9GmwwCY6kfdkpxKaM2YK8Hl7UPDPxVRJkttBnC3+RnO2Aow4jfiPSFZBQ3ZIfCA4lTslG3WGn4XJfIILpB51GNe+9lu8/hsIPom3lu1yxHJSHfSVNJnpidSkgxS9sgyWfj+9Bn5z4KvekUVYelCpOI0Mtf35jm19siiECxIGIh8k/UwpFqmOZB15MOxMdywQOi2oKsX8PGcJgEY8ZBerEL678N X-Bogosity: Ham, tests=bogofilter, spamicity=0.000001, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: mast_sufficient()/mast_overflow() are only used in mas_spanning_rebalance(). Before doing the check, mast_ascend() has retrieved the left subtree type and stored in bnode->type. So we can use the type in bnode->type directly to get minimum slot count. 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 6cabee1371ec..56e9857ce681 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -2729,7 +2729,7 @@ static inline void mast_combine_cp_right(struct maple_subtree_state *mast) */ static inline bool mast_sufficient(struct maple_subtree_state *mast) { - if (mast->bn->b_end > mt_min_slot_count(mast->orig_l->node)) + if (mast->bn->b_end > mt_min_slots[mast->bn->type]) return true; return false; @@ -2742,7 +2742,7 @@ static inline bool mast_sufficient(struct maple_subtree_state *mast) */ static inline bool mast_overflow(struct maple_subtree_state *mast) { - if (mast->bn->b_end >= mt_slot_count(mast->orig_l->node)) + if (mast->bn->b_end >= mt_slots[mast->bn->type]) return true; return false; From patchwork Wed Nov 27 01:27:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yang X-Patchwork-Id: 13886479 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 E647DD66BA3 for ; Wed, 27 Nov 2024 01:28:47 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C5E4A6B009A; Tue, 26 Nov 2024 20:28:46 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id BE2E26B009B; Tue, 26 Nov 2024 20:28:46 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A35236B009C; Tue, 26 Nov 2024 20:28:46 -0500 (EST) 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 780966B009A for ; Tue, 26 Nov 2024 20:28:46 -0500 (EST) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 35BA9A0EE3 for ; Wed, 27 Nov 2024 01:28:46 +0000 (UTC) X-FDA: 82830140526.15.FAAAAAD Received: from mail-ej1-f41.google.com (mail-ej1-f41.google.com [209.85.218.41]) by imf06.hostedemail.com (Postfix) with ESMTP id 12741180008 for ; Wed, 27 Nov 2024 01:28:39 +0000 (UTC) Authentication-Results: imf06.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=KT0+aZeI; 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; 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=1732670918; 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=by+9CkJ703rfzNoHr7wn+H+Sz8l5WyDKOh1JoZA2o6g=; b=XO4jmsvkAJeX0ABzBIFux2Jg10/4Sd7hJ2F/kOMjcHd1mJFEdrrcTcOIhkhkENbcAKemX1 8CgRQOePSZOCTA/vnu8NlhFt/ovT7EJAd9Q71ZVVpmX9Lp3xDadC4JvpbiuPnJPxFtDLkm /bAuu0WJa5tbkun+Cl+T5/0WQybTKrY= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1732670918; a=rsa-sha256; cv=none; b=IzucL7XlytqbI/VVHPNcoogLSUlNx+mS+F+L/oPTsMR2tDi8zIXN+2ZcBxppGNvujER4np 6ADptrMcH+vBDN6gWf78OhZkm8xYdZpSYlBWmbT24+OFEgH0/VeQ8j1I6/Bq6CUZ7R/4kr cpEMS6+OdKlzGakbiuT7zaFGxLI9/Ww= ARC-Authentication-Results: i=1; imf06.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=KT0+aZeI; 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; dmarc=pass (policy=none) header.from=gmail.com Received: by mail-ej1-f41.google.com with SMTP id a640c23a62f3a-aa5325af6a0so548486666b.2 for ; Tue, 26 Nov 2024 17:28:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1732670922; x=1733275722; 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=by+9CkJ703rfzNoHr7wn+H+Sz8l5WyDKOh1JoZA2o6g=; b=KT0+aZeI/2txAon9fl6/eK5CT+03mToRx/lSmPkAM4a3mDoDmsTBINvuQu0LYPdwmz VzrXaE+XhraI9Q92DEADYWLXER+i2KfAyChak1a2CL6GSE224elS5Ql9HyRhte603Uox OueVqxhG18t0frc6o/5lIOGgSWYsXb9UxrJS/NQxVZgfBgy0rK5pCA4Hq3gGW/TpSlrL CYAKp5Uyre6DmCiV4COF59KfHgPm5VOdH/t/JWrA/d+Bu7PqKWOFSlm4cUoHh8mHXYCq KLMccl0xGBjfcZBjc5sa4akldgV8k62inR73ILVjpuQ8ZZBcUCI4U1Z4bMjQvfaprEva OOZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732670922; x=1733275722; 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=by+9CkJ703rfzNoHr7wn+H+Sz8l5WyDKOh1JoZA2o6g=; b=DvTi7xgbrPB0BCiNJ2VDk6zpiZDNBWNIMF+XgqjPUAxbP13Z94dPM01e8HoCZMZVw8 9j7rW9hIamobOGro6DCANDhYfhzqcc4Gfc87bGf+aHJrN/g28xHYbRLebOwbyl/sC7/H IpP8PwBf+Pj8Wy49EPbtg4QrlkQEwbyQC3VxrvBiJlDb8LzG1ozw5qv5BUato+Ntn+mc 2T4ul5UV/fWKhqsn9rBNbfmNSUljRt6lT7L06tGPSXu9AtdArzmk9WOyESFHPcYvDZrm 2HYizwNVLkIJ9xg4C240nGWF9hLteWSTpwCE2QQ7kXRo38Ts+SibzGzAb4kDrJ6xd+KB Tk4w== X-Forwarded-Encrypted: i=1; AJvYcCWqB4295IZGp4e82TbCXj+i22GeGroNfKQLeTI/TPfEMstCE1MKJi09DvhwWYkVQ77ifho/kH0b6Q==@kvack.org X-Gm-Message-State: AOJu0YwUmKOn0gQ8lA2IV/XGx+XPdp6aReUStoXmRACkTRQTobwzCxhg vHI0JBg6XllMg32kqMgyBif/z12oBU8dmcG73UNOxtPSiHT75hMc X-Gm-Gg: ASbGncsX6f+Cu1fJGERDl49s7aVVbUhimE/ddfZKbdfMdwGC/ztpI16tob0ICikpNjD MgeLxfvEMmvZVSZzR4KC4KNde8GxaPGfnr+Ob1VLgJP5RqAsDLxrhRDWADJ6A+KVkrNOpcheQMx JQEC94Mvtzg980fon+Jn8Zj/hEsyf23T99hrwpIY6JVKG3sC5FdjxwuFwf5CT6As066JDJEk1u2 RMQ/xD9tX6FquC4+7VJ+lTmzw4+FZpcxc/89GQA+u/GcvwAjA== X-Google-Smtp-Source: AGHT+IE/7GRuE5VUZ6rocYF3rbZboxODh/IiUnp4SLWb4G6dHviCoZxRuJWTgJ3S46jDcfI949DnzA== X-Received: by 2002:a17:906:3152:b0:aa5:3663:64bf with SMTP id a640c23a62f3a-aa580edf9cdmr63669466b.12.1732670922160; Tue, 26 Nov 2024 17:28:42 -0800 (PST) Received: from localhost ([185.92.221.13]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-aa54bedfdb0sm358896066b.113.2024.11.26.17.28.39 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 26 Nov 2024 17:28:40 -0800 (PST) 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 6/7] maple_tree: always need to update max of new left node Date: Wed, 27 Nov 2024 01:27:52 +0000 Message-Id: <20241127012753.3393-7-richard.weiyang@gmail.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20241127012753.3393-1-richard.weiyang@gmail.com> References: <20241127012753.3393-1-richard.weiyang@gmail.com> X-Rspamd-Queue-Id: 12741180008 X-Rspam-User: X-Rspamd-Server: rspam07 X-Stat-Signature: ooodfbjjgz5wo63iew7166ed4i53cqs4 X-HE-Tag: 1732670919-858549 X-HE-Meta: U2FsdGVkX1/wTpkdhxmgXAEocOjTY58rNKjP/ndtg/IVzyXHULbWgtcl0sRoOi767jvJMeGbWwxvjgUu42caNAjbtMsXzmcqO864m3GgfvrF2AV3uOYZd+5dr5K4TCGi1nw9NaPdi5GXDxSL8EPC+DJKx2JcTM/LwlysBvwhKUdtrLLo7Hk5sZjqG/z9//tZDf2PCdVDWW05OoNkh4wee2wgUFn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CewhLj952/Cndu9Gn4h0Zlve99Fo5ilpOUC0l1wAaVtiK9Cim8nlaur9sKxQ7+/k8IRCh8O0FU2ek/aFMAzOYsWqFgVBBJJpCXigHmXZgyhp6tSwqL9Yttw6GxO2DcF8wWZeWUccdNW44FzNVvaxNxAKVDVzc2SmYD+om+5WaG88F/QcpZJuODGxHs6FqhM7HIbNjUKH/NqFrr X-Bogosity: Ham, tests=bogofilter, spamicity=0.000006, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: If (split == mast->bn->b_end), this means we would put all data from bnode to new left. And the original data source of bnode is orig_l + orig_r, whose range is [orig_l->min, orig_r->max] So we can always update max of new left node. Signed-off-by: Wei Yang CC: Liam R. Howlett CC: Sidhartha Kumar CC: Lorenzo Stoakes --- lib/maple_tree.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/lib/maple_tree.c b/lib/maple_tree.c index 56e9857ce681..4ba9ae68c0a9 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -2664,19 +2664,12 @@ static inline void mast_cp_to_nodes(struct maple_subtree_state *mast, struct maple_enode *left, struct maple_enode *middle, struct maple_enode *right, unsigned char split, unsigned char mid_split) { - bool new_lmax = true; - mas_node_or_none(mast->l, left); mas_node_or_none(mast->m, middle); mas_node_or_none(mast->r, right); mast->l->min = mast->orig_l->min; - if (split == mast->bn->b_end) { - mast->l->max = mast->orig_r->max; - new_lmax = false; - } - - mab_mas_cp(mast->bn, 0, split, mast->l, new_lmax); + mab_mas_cp(mast->bn, 0, split, mast->l, true); if (middle) { mab_mas_cp(mast->bn, 1 + split, mid_split, mast->m, true); From patchwork Wed Nov 27 01:27:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yang X-Patchwork-Id: 13886480 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 2DB41D66BA3 for ; Wed, 27 Nov 2024 01:28:51 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 335956B009B; Tue, 26 Nov 2024 20:28:48 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 26EC66B009C; Tue, 26 Nov 2024 20:28:48 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0BF976B009D; Tue, 26 Nov 2024 20:28:48 -0500 (EST) 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 D8AC96B009B for ; Tue, 26 Nov 2024 20:28:47 -0500 (EST) Received: from smtpin25.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 960B5AEE58 for ; Wed, 27 Nov 2024 01:28:47 +0000 (UTC) X-FDA: 82830140484.25.2605B65 Received: from mail-wm1-f45.google.com (mail-wm1-f45.google.com [209.85.128.45]) by imf15.hostedemail.com (Postfix) with ESMTP id 859E1A0012 for ; Wed, 27 Nov 2024 01:28:40 +0000 (UTC) Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=DLv0VkYg; spf=pass (imf15.hostedemail.com: domain of richard.weiyang@gmail.com designates 209.85.128.45 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=1732670920; 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=yGoWvxrLajb7hyVvYTveK2TYJgb5VqgBn1tgaQwG1Hc=; b=Ih6ZYCPFOdfeultJOKDvN8NS91UaqBJB3Nr7JtF2ODVsZp6jKeCt/eR1n9Gzz/vSyesfD0 z71Ki8RRMroWwzRERIVa7O+s7DRfTq7xXlqWIfQ7BD4DI292S4GkxuPJzm/zzcDCUVivq+ 0/SSmOlepOXVdImOIjDTV6iJ4O0jj/8= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1732670920; a=rsa-sha256; cv=none; b=ueDFS9bt/NmQdjHry4rssm9CBgGE442oTy13tKnhuGUpJ+UHCL67qhNjjlxrWI2gMmZuJ9 Bs2i4gxk1Ob9j5mbaPJbt5MKWMyQLRS7D4eMMujWi8I4SPzIph+bZbRxq/VDIlTLHUSjli E79TnS958I2siagdULerSjSz8HI+vuw= ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=DLv0VkYg; spf=pass (imf15.hostedemail.com: domain of richard.weiyang@gmail.com designates 209.85.128.45 as permitted sender) smtp.mailfrom=richard.weiyang@gmail.com; dmarc=pass (policy=none) header.from=gmail.com Received: by mail-wm1-f45.google.com with SMTP id 5b1f17b1804b1-4349e4e252dso26155765e9.0 for ; Tue, 26 Nov 2024 17:28:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1732670924; x=1733275724; 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=yGoWvxrLajb7hyVvYTveK2TYJgb5VqgBn1tgaQwG1Hc=; b=DLv0VkYgqwJA2xOUOiXgolFE6c4SEJ/ieCCbC8xvzxMc2uIaiOOvvaC5LniyNKe8nB BqXwAWhNIpmbQX4Mc8IpnLqFFgu6Gygrab2Bycta87JCNZA/WuIyIZLsWUfm24V8qaMc nmTvjsH/f1A7CFjSu3Qb5J4mjMWop/onBUORTAS/sGGmQMbm80zhRg1eNyUtPlJHrVEG XshmeE9J71Q7P51YhoK5MTvC8URA4Z2StYd6k990djU5NnO83u8NIom1gpoorK5ZCn2U 56VlMWw/6HHiHZdKZ0DPPbCuNGgG1FN/ptJ4vmM2BT/l+9LEkWDWQAdimTwjjPcdkNsa yegg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732670924; x=1733275724; 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=yGoWvxrLajb7hyVvYTveK2TYJgb5VqgBn1tgaQwG1Hc=; b=mRW+fTkger9Lb2HJGdW2EXLKmZzPyK+BaGQECL9fEl4xhJyxjnkf8vzHLtKnBmfrAW fsrPEb1E/uUOq9eIlro1NwFO4D6V/lxebGQMxxAXAVh/vWOAf9BrckG1vVuEdacsZuyS 2J9iRgAcN/kWbhf/2F4MFnCw36tblW+yI/Pk/V7z7IFFYa2a3W5LU1dP0b1WtVAYFFsk hMVG8gnb0bUPUBjA3Y/7lK+7YPjONeEaS4aSv1ngMRMkZ6dGbb5K0eZRMy5arNqcwAc2 oHxVnRqMoMu7+9GmwXP/ko+8e1rPt/OI8BZAeiL5rKaqWo6Aa/uidMw115mJzsd+XsSP bObA== X-Forwarded-Encrypted: i=1; AJvYcCXU9IHH/lqm0QA0y19qhGYR2xeLXB5XopeyddghXV/HdSn1yVc1s2yzm3HKF0E6NL5R99MQhQAL9A==@kvack.org X-Gm-Message-State: AOJu0Yz8dGlur+nPJ8xKP/Xb4MQdUuxHkS90H0imkjiSHU+WKEQZAIJn IfX2QpiDkH3MRXXcnabhAao7Z2dWUWYV++baxFZTyUXU9QiWygNC X-Gm-Gg: ASbGncu+Xesk/wxdnKhWMSUfjvuGGGq+oLpR/0MqkDIJrlqW6PY0OSMQ/kvOp5286Jf f4vIqCqproh/gp8NApu+Rl+7oPgyvg45ckQ9CHgfZFyTN0naFwOjKij4kterOTXcz4ZsgOfY22L FAuz5LR6JE7JZA+MAsA95vYGUaSIhVH6ZQ/ZPdHEYy+uLLkuXvHq+VB81o4EHrH3y19n/ZgfkhG P0efcmf3KM4tFpp1giBXDYvG6SpynWcKv7HB9k2A5PiQRr3dA== X-Google-Smtp-Source: AGHT+IEp2736qY44S2GpxqdrL7wZmgfRt2Bp++Tius0R4wmX/MudKoH8gekrNitGvw/POr3KgRWO7w== X-Received: by 2002:a5d:5850:0:b0:382:4493:ff8f with SMTP id ffacd0b85a97d-385c6eddb44mr638021f8f.43.1732670924341; Tue, 26 Nov 2024 17:28:44 -0800 (PST) Received: from localhost ([185.92.221.13]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-aa50b52ffe3sm660431766b.126.2024.11.26.17.28.42 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 26 Nov 2024 17:28:43 -0800 (PST) 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 7/7] maple_tree: only ascend left subtree to get the old node for replacement Date: Wed, 27 Nov 2024 01:27:53 +0000 Message-Id: <20241127012753.3393-8-richard.weiyang@gmail.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20241127012753.3393-1-richard.weiyang@gmail.com> References: <20241127012753.3393-1-richard.weiyang@gmail.com> X-Rspamd-Queue-Id: 859E1A0012 X-Rspam-User: X-Rspamd-Server: rspam07 X-Stat-Signature: 7w4396d33b6gmptaa37e35eu8j9w1szr X-HE-Tag: 1732670920-547623 X-HE-Meta: U2FsdGVkX18eP39CxqE99wI7fjylU42dLffWuBlebDpKoBdwqVi3CKouF1mhXVp9jMqRtI+CJ3XWfNYlALp7HWBCc7bXXwOuR+I5P3/nyF83ZKazCqFw5GWWM/HZr3Y9NuZ8XC8glwHfzNbPFwIe18edRr4yuRyXa+Hk4FmKYc7+gRFvt6UCRT+FZXzF1CvCNmQcSs9xWH13Fl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2OFBC3ZOoPOJi/1bCugXzSz+CKFy25GHS2YodZ/kWK7abkU9vjdDhtK1FCJtm78h/FAsCqsUmTC+XIkSDwwwxXKQPu0YrNx5ADME+VydhtizMByuJNxk6vhMj8ngj/j6uM5nd93nHFzuUeEtgOeOO2wov6ZSZTjKUdSQFrjGoL6jugBT9N032sZa4ZrTsyVSQWCXSSGDonzsfi1+BRhGfgiA2aYiL1mxq6L3 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000018, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: When we come to a new_root, we should go up the tree to get the old root for replacement. Instead of ascend both left/right subtree, we only ascend one of it is enough. Let's use the left subtree as it dose now. 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 4ba9ae68c0a9..2c05919be168 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -2920,7 +2920,7 @@ static void mas_spanning_rebalance(struct ma_state *mas, new_root: mas_mn(mast->l)->parent = ma_parent_ptr(mas_tree_parent(mas)); while (!mte_is_root(mast->orig_l->node)) - mast_ascend(mast); + mas_ascend(mast->orig_l); } else { mas_mn(&l_mas)->parent = mas_mn(mast->orig_l)->parent; }