From patchwork Sat Nov 12 23:43:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yang X-Patchwork-Id: 19273 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp1475448wru; Sat, 12 Nov 2022 16:02:34 -0800 (PST) X-Google-Smtp-Source: AA0mqf6VNbgP/utgANGzWn8HMa54z2/cRKEd5ZQtrKiUU1jqdxBR7T2sNyDQzAaeN+Sz2PPAZg7z X-Received: by 2002:a63:4d43:0:b0:470:537b:c39a with SMTP id n3-20020a634d43000000b00470537bc39amr6841897pgl.614.1668297754164; Sat, 12 Nov 2022 16:02:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668297754; cv=none; d=google.com; s=arc-20160816; b=XpudGq1VIHGa0Q6eLOjTTj7KntHxgmo+vtRuuCdLU/jtzG6X5a9FjqoA/B/osa4OwS fo7nK5G8NVoCzx0T9CgdIVz9YVjjswSxL/fUE9p0L9LGSm7wc4Ay7uQUEOvFBuwl1RQk SNp2P6B12RlYsRaQsEkGJPyDiDZdAPKQypa7j7LgY3cW9ano7EX7FRsUUJanaj3D3Sl4 DX1d1CWOVDtHbSdSCDT73AQknqetkAxcFCZZOOFgaiPJhwVngaCciRSDTNIij09iD1pj xbDOTtRDkfuHnca0riyZV/jvXg4OWIwsTwAMU8+mqYx3EW2YZ1/UlP63nooxr+RwQh3l 6VGQ== 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=0JAPLUeDBIzUEBdWCKMJoUrcE6eDnC6Knva73vPL0M0=; b=GtpOC/yRc/qzvjP+4d91azDC1HATY4RcWVQE8j9i9tiFWZeaiNBvfRCWVpmYEVuEHe ezNvMY2lKYEG4AQ1m6bE4GXaacJIjfnXjMHh/3go6FShwQU8aR4KsQ3s4+51hmPA8Hlp 6/ui3FipEShfZip4hCclk04gIBipvxPikIeQRYAyisArqVg07ROnfv9c8GimwzDDeiCk LALvc7+9GOxG1w5Cjl8VqByNPYlfSwR2nsTc7RkKhmIUiTfDTtSpehTRmBRWTynxP2qA SQCwlFZemYzl+X0PekVAUPSwQ1EgTurnUqNCuePr/lntQ+zOygocYTvMKvvWTRFL6EEr tvfw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=CdUBDpjV; 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 13-20020a63050d000000b0046e9bac6d84si6231537pgf.453.2022.11.12.16.02.06; Sat, 12 Nov 2022 16:02:34 -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=CdUBDpjV; 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 S235067AbiKLXnQ (ORCPT + 99 others); Sat, 12 Nov 2022 18:43:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52806 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231252AbiKLXnO (ORCPT ); Sat, 12 Nov 2022 18:43:14 -0500 Received: from mail-ej1-x62c.google.com (mail-ej1-x62c.google.com [IPv6:2a00:1450:4864:20::62c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 60BCD13DF4 for ; Sat, 12 Nov 2022 15:43:13 -0800 (PST) Received: by mail-ej1-x62c.google.com with SMTP id y14so20329154ejd.9 for ; Sat, 12 Nov 2022 15:43:13 -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=0JAPLUeDBIzUEBdWCKMJoUrcE6eDnC6Knva73vPL0M0=; b=CdUBDpjVZZCyKr2IzySbhtUr4+SVpUXmoCvWs6zI2fv5XgzhKsOOQQO1QGgaHAQqdP 2+W/9a8Qwf9/y0ePQJTa3ieAbhztj/K2RlaeEmQNeuvVf946CyAap+aqz9h072e7wQGc vkJ65e5iCKLDm4uTNglOk4NyOIynN9NEqGltRqC0cUySA1gxq4FRy9ZjSrupxv82vIwA gE5uI/ip72wzha473gItUwY5EMQG3+dpirobZkU1AY+v5mjcTJ5cmFkCZt/zsrkTae9u HT8Ez5ssAbTrm1gmIunktBoCP4V4lgpWc6N58LDfJyyZjR0oEAtiZfpfTaTg+ldvOgH+ ofXQ== 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=0JAPLUeDBIzUEBdWCKMJoUrcE6eDnC6Knva73vPL0M0=; b=OtD5xhKZLMp8ZBAnHv7YP9ctGldTQcj/goJrV5plqYjYmSk4KHCZLlGwGC2af8OAH7 lOhYkuq3CgvBFARb5EbGiFEKtwxkGzUqGcMT5o5fo5boM7fQi8Nk5/MhIdAg3bE7sVbF 818sVYLfmqZgRsWZO6/7UFj1JwlO8bkuN3Ets6uJx9ocT56VJcVMVY1A47rAPeKscmIA CkGsiXyna4D95F2RYv1muNgwDgmqaxBQiPgRzUARmgyGxqDKZRGrfYHZ8BwotYRUwPEG IqUmNstG9mt47PEOncaseex+s8A6E2sMDpUKz5Ami+4Bl1c/oaSRIC1TPvup825f3ztM EMPA== X-Gm-Message-State: ANoB5pngCpC20pw5CW+VG8Tyl8WZFBd0AT7Ukux8MoT7QkeLYWoW8nRG Ejkewcji0otRwGKqrg/SvsB2Si0XHhl0Xg== X-Received: by 2002:a17:906:a1c8:b0:78d:585e:d183 with SMTP id bx8-20020a170906a1c800b0078d585ed183mr6267530ejb.768.1668296591873; Sat, 12 Nov 2022 15:43:11 -0800 (PST) Received: from localhost ([185.92.221.13]) by smtp.gmail.com with ESMTPSA id b19-20020aa7df93000000b004587f9d3ce8sm2800189edy.56.2022.11.12.15.43.10 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 12 Nov 2022 15:43:10 -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] maple_tree: should get pivots boundary by type Date: Sat, 12 Nov 2022 23:43:08 +0000 Message-Id: <20221112234308.23823-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?1749336986225153039?= X-GMAIL-MSGID: =?utf-8?q?1749336986225153039?= We should get pivots boundary by type. Fixes: 54a611b60590 (Maple Tree: add new data structure) 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: