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: 17994 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp777192wru; Wed, 9 Nov 2022 23:27:07 -0800 (PST) X-Google-Smtp-Source: AMsMyM6BCeTlr7tCunMXexj8IgswHH6pMYJyZPFdPTqtk8tKQRnhg6iAgjfoE3ZezHChBSyDTgD6 X-Received: by 2002:a65:5bcb:0:b0:46f:5979:8889 with SMTP id o11-20020a655bcb000000b0046f59798889mr1994565pgr.119.1668065226953; Wed, 09 Nov 2022 23:27:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668065226; cv=none; d=google.com; s=arc-20160816; b=jUEVKbTqSdxSUXxYEvVSVipHiK6K9b5Ooveh+Hf2zfRhMB/+lLBfYQd2sdW3bRERQv Dc5AJ9BL6WgJkWwSZvb9YKvl2I6CU2HF7PqLgDQ11X4UPH+M08dqB6v+1RHP0pNTp7ZW s/xoUgcgcvIO0dZLC6lhAWmn/yZjnpTL9LxGLPKvuI0Upv2m91FwlHBYI5cwbOfYIkGZ v2maedXpd3Z5OB09k09SaFJlaAmcaEAOgzLih1m4F+t2NAjGsb/v5ekbaDGppRc8FL55 4NZuLWBGTKTTxRsxPaB8/nuQrzvEQXavJacnxvXEqy957lmjkicf3EL/YDkBOHXYHCbH KlVQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from :dkim-signature; bh=MLIL8AWyiTyOVTowKuWveBdp9wuFqtjsOK/tusdXEg0=; b=MuuC42923f6Wha7TMvfUjU+XaEUK3HU5IAEr29nJD3UsMUUd6iaE14u+EJrKimVmHL AjfYYpMpjTPa9GBh/rKy1wrGQplfCyG5q5qUI1791hCPqyq53lTjT1Fh1cLVF+uPm/K2 3QC4uCmZQn+nod4wOgPTZDdkcoVeTMnDru4ziC1LKNdZMYM5gC75ks4SVo2JKQVP+6X/ bHQcZ6O4222CspWIQGzOG9hu5iTpNHIHXE8KlZL8U4HxL3w05Ugb8bKQdOqniUnpkrwB MaxzKcfC1LyxAd+Fj29gB527lTC4Ls6nRC2SrWyAQCWdWKnArTNt9zUPimflx4lff2Rw S12Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=n82CKx2o; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u21-20020a056a00125500b0056b8bbfe687si21712492pfi.171.2022.11.09.23.26.51; Wed, 09 Nov 2022 23:27:06 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=n82CKx2o; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232397AbiKJHZP (ORCPT + 99 others); Thu, 10 Nov 2022 02:25:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43678 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229793AbiKJHZM (ORCPT ); Thu, 10 Nov 2022 02:25:12 -0500 Received: from mail-ej1-x632.google.com (mail-ej1-x632.google.com [IPv6:2a00:1450:4864:20::632]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A336313DF5 for ; Wed, 9 Nov 2022 23:25:11 -0800 (PST) Received: by mail-ej1-x632.google.com with SMTP id f5so2769651ejc.5 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=Biri7yV2oVQ/tz9SoA9qIy5LY2we6oNAq/UEBEoaNc2C74YZFTWSpSFcJiaCb9nkws 6D1T8vdi0wK0InaBMfLp5W+nTQP0fIU6SDb8/ZHOeOa55B/Muy/7smRW0bETxGvFnx4x NXgCKB/Gnd/W7oVVEQAPllF8UWBGtByx8BRk5phqZWkjqd/2X+dzLOe74F9rrT5OAG1r k3eOOvEK6uIqOGMfF/dG5JKRcIo/xzcXJzhKWcaNTEtkehjC7bPyu+lK6NDV4LblaDVY TvawyPfyzaEng3G1SFnp8yyVkzFSuWNRh4KLNjk1RDJi0+hWYfi6N9JHIJnRHmcLcdIz YKCw== X-Gm-Message-State: ACrzQf2bHXRxZkKXffDLGICXpm58MXA6PvoOKkk2595+XgRWPAcP838R 00pvM3x+ZU5oXkmhCqMrJSs= 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 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749093163557984392?= X-GMAIL-MSGID: =?utf-8?q?1749093163557984392?= 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: