From patchwork Thu Nov 10 07:24:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yang X-Patchwork-Id: 13038377 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 21D67C4332F for ; Thu, 10 Nov 2022 07:25:12 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 455386B0071; Thu, 10 Nov 2022 02:25:12 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 4045A6B0072; Thu, 10 Nov 2022 02:25:12 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2CCA58E0001; Thu, 10 Nov 2022 02:25:12 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 1FBAA6B0071 for ; Thu, 10 Nov 2022 02:25:12 -0500 (EST) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id D7B031210EA for ; Thu, 10 Nov 2022 07:25:11 +0000 (UTC) X-FDA: 80116696422.08.3A9BD59 Received: from mail-ej1-f50.google.com (mail-ej1-f50.google.com [209.85.218.50]) by imf08.hostedemail.com (Postfix) with ESMTP id 85A93160009 for ; Thu, 10 Nov 2022 07:25:11 +0000 (UTC) Received: by mail-ej1-f50.google.com with SMTP id ud5so2785060ejc.4 for ; Wed, 09 Nov 2022 23:25:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=MLIL8AWyiTyOVTowKuWveBdp9wuFqtjsOK/tusdXEg0=; b=n82CKx2oKYstCeHq7b45Jmr9QQxnDG+iq5wWJniMgAw80ww+xmBuBKNOd5ieCew3Mp 7fYQPRQAP4iLplsr50ZY0nwiXVOISgNlzGhne3cys2BqNtkr/oFxrZTj0CguA+sJxoY/ NlMA5PH9GkZWSpPnqcj72ZWnANh42gNQoMtcoX7OBTET/keZfzi3kAMDAekHmDXksYNo AIlUgwLhJkD0Zw+jCWrj4RlTfnUX5tW3GdnY1vuxJXOV8J9pfEzU7mEwWImWzW4jeJR0 Tl+dW9sc9s/V0wA3IDFhjXihBai9XqnjcjWM3JIUdRiscUMB25ftkFJoccbX8bfqwFpA 7tTg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=MLIL8AWyiTyOVTowKuWveBdp9wuFqtjsOK/tusdXEg0=; b=RGp9KOYCtWy6B31la0UA2SlzLBxDy6ioCdGfHThip3tD8vNk0karzdu7AUoGhnmL42 sAEthX58w1eVaKyrYTXMPwfkLxMhl9lbbFpGmsEg7Vl0ykGLri+KX0L2kirbXfWC6JIC /VKSHb7d1/8C2RaCXpX9GnqSAaUolFfF2HFZh0lCV7y7I3edPpiDlX0+ud99vVDMhrH5 nGr401pTrlfvuWVE2j6lFPjHSbL4xPu07zP4uLTsO6G7OEjBrvlW7/u3b/qcfnz7zB7i 8pIYEz8KEFJc3b/r/v8vyHRPzlVS6KgzhFe9bI/WByswKSIO8P2xvngQ7ox5eVLMMlLV vC6A== X-Gm-Message-State: ACrzQf0G/6Fw8x4T7MwUjqPlEoUNMMdnCRqOhRj+qYwZ1gxlkKs17gt3 N5Cpl6hJ3CEmKvaghbt+Ir0= X-Google-Smtp-Source: AMsMyM7n4yP3Bw53HMpXTM9vWrjegmze60e5skOOzJZ7DwsPiTBEf/ABWnqq9Dm+Tw0HdT61T2aAwQ== X-Received: by 2002:a17:906:fad5:b0:7a0:7333:8f1e with SMTP id lu21-20020a170906fad500b007a073338f1emr2211344ejb.493.1668065110116; Wed, 09 Nov 2022 23:25:10 -0800 (PST) Received: from localhost ([185.92.221.13]) by smtp.gmail.com with ESMTPSA id ca26-20020a170906a3da00b0078b03d57fa7sm6731958ejb.34.2022.11.09.23.25.08 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 09 Nov 2022 23:25:08 -0800 (PST) From: Wei Yang To: Liam.Howlett@oracle.com Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Wei Yang , "Liam R . Howlett" Subject: [PATCH RFC] maple_tree: should get pivots boundary by type Date: Thu, 10 Nov 2022 07:24:59 +0000 Message-Id: <20221110072459.23656-1-richard.weiyang@gmail.com> X-Mailer: git-send-email 2.11.0 ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1668065111; a=rsa-sha256; cv=none; b=F91RNia0OOtEM88GpNsBrVEU8hg+dlwYNy0QVP7Whp3J/rgdYFs4vatyiZqndsQ2z2L6vA 443g7WU8PSkebFZSFTvft7w/rZaVyaowDHneLl2oKSnoDppvarS0J0+bfE27BJOtLh5Edd 6TyRifr5L63SOP51y9Yv8ZFth8Wjf5w= ARC-Authentication-Results: i=1; imf08.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=n82CKx2o; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf08.hostedemail.com: domain of richard.weiyang@gmail.com designates 209.85.218.50 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=1668065111; 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:references:dkim-signature; bh=MLIL8AWyiTyOVTowKuWveBdp9wuFqtjsOK/tusdXEg0=; b=UH171RSeGkDT4vyVgYt/rH3HItpQb6OD82KvyaQhGq9sKIEoJSHHHVRE7Phi5MESbSYVIe nq/m5JttGDC/sWhZbILV33bxRaorBDqE+HSIyRvMdnYUsP2Ajk0VQEWIjE4+D9IfD6PL0r Y6vCvHR8H37DhLVWdIHWZF0UbWPz+tc= X-Rspam-User: X-Stat-Signature: knnicgngdj9ck4q7cko7r8wrec16k9fa X-Rspamd-Queue-Id: 85A93160009 Authentication-Results: imf08.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=n82CKx2o; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf08.hostedemail.com: domain of richard.weiyang@gmail.com designates 209.85.218.50 as permitted sender) smtp.mailfrom=richard.weiyang@gmail.com X-Rspamd-Server: rspam03 X-HE-Tag: 1668065111-812771 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: If my understanding is correct, we should get pivots boundary by type. Signed-off-by: Wei Yang CC: Liam R. Howlett Reviewed-by: Liam R. Howlett --- * kernel build looks good --- 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 73e2e6434e2f..2123d1930a9b 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -669,12 +669,13 @@ static inline unsigned long mte_pivot(const struct maple_enode *mn, unsigned char piv) { struct maple_node *node = mte_to_node(mn); + enum maple_type type = mte_node_type(mn); - if (piv >= mt_pivots[piv]) { + if (piv >= mt_pivots[type]) { WARN_ON(1); return 0; } - switch (mte_node_type(mn)) { + switch (type) { case maple_arange_64: return node->ma64.pivot[piv]; case maple_range_64: