Message ID | 20230707101057.29326-2-zhangpeng.00@bytedance.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f45:0:b0:3ea:f831:8777 with SMTP id v5csp3167889vqx; Fri, 7 Jul 2023 03:38:41 -0700 (PDT) X-Google-Smtp-Source: APBJJlHGZOVyuzCjwBbaGXQOFDKcpmsBMiJNg5Um7Nj/8ilPBWimcOpOo3YwSBnOH54rc/inYkxF X-Received: by 2002:a05:6870:73c8:b0:1ad:4c06:15c with SMTP id a8-20020a05687073c800b001ad4c06015cmr5642966oan.18.1688726321132; Fri, 07 Jul 2023 03:38:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688726321; cv=none; d=google.com; s=arc-20160816; b=mtQOvXad6U24EG/Na1tIaNAWWTdjgOs7Er3mahuye9cC7E16574HdXr1M6ZYl1+5pY L5ng+z6i8eKfKxzViC7vpuVOcpzc/ZFweaCxAWQu0qZT/eAPVhirxEVXecXTDrj5I4VU b2qMdJIm+Y+rqKtnVRwws6ixSYC3ITI8CvsgmOQLHxkjmF5yZutFQTOEo4oK6T6LZICZ zWu8bMT80XJXXftISo2P5c+ZUdH79hNmoQ7uUH8K8nkA3ZjjL2QNB3QCiGrpZJRKiEv3 Ralzx6ItRupckmoH8C0CuMCB102s3TElDcYrDJdMX/oNAUSWabM5nIuf2dIeuco0OVCM xEEw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=obQkYhgKS4HY8GCkScMSh7+VaHIuzmq4BqEaENwQoNQ=; fh=U74fmUEemPw7sqchHJfHUOA5IBfFk+e2fZn/jtR8IqU=; b=g3DEpCwv5eKW2EevZKHP6e6nGMoK1GEVT4ZYw0jomvp7g4aZX7NHK0VzGFBEzOaeEZ 0BajQpuhPRG7c77qCLt718zy1z91GcaIcW5yin+lvjwYvvQNyp7oMWM3na4t8TwplFiV JBMhO3l3M7iPam6j2Y3URJUSlzNYiRiTVXP0intxhpC7dhq6S5buuHj15EDTzbz/Wgzw bhc9Zy2t+Wmp/Bx8WkgA9gpg5sHWNXHA7ppL8Fo9RokfK2oFsTSXfDrArJSnPzdGoFcv /HgsE/huK1nTDCc5SL67/be2vTzc1G6tooqHV37HbDXW6zK0EvMEBgWfZ1C3K13s1uVa 3Rhw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bytedance.com header.s=google header.b=ahfJjKcj; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=bytedance.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z23-20020a631917000000b005578c6a7645si3509039pgl.69.2023.07.07.03.38.02; Fri, 07 Jul 2023 03:38:41 -0700 (PDT) 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=@bytedance.com header.s=google header.b=ahfJjKcj; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=bytedance.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233053AbjGGKLy (ORCPT <rfc822;hadasmailinglist@gmail.com> + 99 others); Fri, 7 Jul 2023 06:11:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39584 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232201AbjGGKLl (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 7 Jul 2023 06:11:41 -0400 Received: from mail-pf1-x42f.google.com (mail-pf1-x42f.google.com [IPv6:2607:f8b0:4864:20::42f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7611CAF for <linux-kernel@vger.kernel.org>; Fri, 7 Jul 2023 03:11:15 -0700 (PDT) Received: by mail-pf1-x42f.google.com with SMTP id d2e1a72fcca58-666eb03457cso1060254b3a.1 for <linux-kernel@vger.kernel.org>; Fri, 07 Jul 2023 03:11:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1688724675; x=1691316675; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=obQkYhgKS4HY8GCkScMSh7+VaHIuzmq4BqEaENwQoNQ=; b=ahfJjKcjkN3t/H/Kibyt7ZUmq5o9Qf9MqO0YUCMAE1gwMas3raqn7C91lMkIMWWa+T IJpR/S9MoSPTB0GA9vEeaHbA3kmXN2W7SWysLZhJs6HexLH13doyrOLey8REwDAcdRPN fP8HOY0sup0QDoYEw9uvVF3G2q+51TJo0nXFR7bTMRyT5OacgzLxQE9frW/AKpX+AWNR /D2sk7Q+gPL7mw1O1vqKgXJGKmWY5ytglXmVVnGG1IqqW4I012Ywz9z/LyJ6/oJGZlRb r8NHFBGoZggHXSbLeAun3FT8PlbYYDJt1ZBk1/8+08pOsZ9cvnyjpIIiC2BX2Ly1YlQ6 H0SA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688724675; x=1691316675; h=content-transfer-encoding:mime-version: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=obQkYhgKS4HY8GCkScMSh7+VaHIuzmq4BqEaENwQoNQ=; b=PqpNxHZ7zdGwT3NKZFMpIxBkIzXRi2tVuMGPcFAZU/hvIoefnd7LkBLu3vFUTQISUE oHZlZDJbdWs4J6P4J02Qc/fTC7pWvA9rbaXw5ZHES5RCbydShiEZ6chnJgfO9CcWZSQ6 GtJ7yd5jchl9IJKBs4HFKiZzf8AudlZLxpdbEjVGIpreqeL49OSYrjYdmJyWoU17hWhg uJpd29wX7cDqtwofZ4G6qQUAF8nIFjrHyfKjtklG+XavaNbiUTKEpxxooVFfTgYpEjEi 4AP2TsAV3lSerD47dxhnXuoAZ6EZjBQUS3HlhUwpTMZ0DyISMnAozGECJw02X+6b3Ssz k7wQ== X-Gm-Message-State: ABy/qLY0/uzKgeO2kqjSbS8m/OxA1CWVaXI+uF12A97DKmrElwjTYH53 qac5qfp06m/5I194/CLBNbZ/UQ== X-Received: by 2002:a05:6a00:1593:b0:65e:ec60:b019 with SMTP id u19-20020a056a00159300b0065eec60b019mr4460571pfk.25.1688724674907; Fri, 07 Jul 2023 03:11:14 -0700 (PDT) Received: from GL4FX4PXWL.bytedance.net ([203.208.167.147]) by smtp.gmail.com with ESMTPSA id x11-20020a056a00270b00b0068288aaf23esm2602549pfv.100.2023.07.07.03.11.12 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 07 Jul 2023 03:11:14 -0700 (PDT) From: Peng Zhang <zhangpeng.00@bytedance.com> To: Liam.Howlett@oracle.com Cc: akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, maple-tree@lists.infradead.org, Peng Zhang <zhangpeng.00@bytedance.com> Subject: [RESEND PATCH 1/8] maple_tree: set the node limit when creating a new root node Date: Fri, 7 Jul 2023 18:10:50 +0800 Message-Id: <20230707101057.29326-2-zhangpeng.00@bytedance.com> X-Mailer: git-send-email 2.37.0 (Apple Git-136) In-Reply-To: <20230707101057.29326-1-zhangpeng.00@bytedance.com> References: <20230707101057.29326-1-zhangpeng.00@bytedance.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1770757890789249807?= X-GMAIL-MSGID: =?utf-8?q?1770757890789249807?= |
Series |
Improve the validation for maple tree and some cleanup
|
|
Commit Message
Peng Zhang
July 7, 2023, 10:10 a.m. UTC
Set the node limit of the root node so that the last pivot of all nodes
is the node limit (if the node is not full).
Signed-off-by: Peng Zhang <zhangpeng.00@bytedance.com>
---
lib/maple_tree.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
Comments
* Peng Zhang <zhangpeng.00@bytedance.com> [230707 06:11]: > Set the node limit of the root node so that the last pivot of all nodes > is the node limit (if the node is not full). > > Signed-off-by: Peng Zhang <zhangpeng.00@bytedance.com> This has been on my list of things to do for a while, thanks. Reviewed-by: Liam R. Howlett <Liam.Howlett@oracle.com> > --- > lib/maple_tree.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/lib/maple_tree.c b/lib/maple_tree.c > index d3072858c280..f55e59bd9122 100644 > --- a/lib/maple_tree.c > +++ b/lib/maple_tree.c > @@ -3692,7 +3692,8 @@ static inline int mas_root_expand(struct ma_state *mas, void *entry) > mas->offset = slot; > pivots[slot] = mas->last; > if (mas->last != ULONG_MAX) > - slot++; > + pivots[++slot] = ULONG_MAX; > + > mas->depth = 1; > mas_set_height(mas); > ma_set_meta(node, maple_leaf_64, 0, slot); > -- > 2.20.1 > >
* Liam R. Howlett <Liam.Howlett@Oracle.com> [230707 11:18]: > * Peng Zhang <zhangpeng.00@bytedance.com> [230707 06:11]: > > Set the node limit of the root node so that the last pivot of all nodes > > is the node limit (if the node is not full). This patch also fixes a bug in mas_rev_awalk(). Effectively, always setting a maximum makes mas_logical_pivot() behave as mas_safe_pivot(). Without this fix, it is possible that very small tasks would fail to find the correct gap. Although this has not been observed with real tasks, it has been reported to happen in m68k nommu running the maple tree tests. Link: https://lore.kernel.org/linux-mm/CAMuHMdV4T53fOw7VPoBgPR7fP6RYqf=CBhD_y_vOg53zZX_DnA@mail.gmail.com/ Cc: <stable@vger.kernel.org> Cc: Geert Uytterhoeven <geert@linux-m68k.org> > > > > Signed-off-by: Peng Zhang <zhangpeng.00@bytedance.com> > > This has been on my list of things to do for a while, thanks. > > Reviewed-by: Liam R. Howlett <Liam.Howlett@oracle.com> > > > --- > > lib/maple_tree.c | 3 ++- > > 1 file changed, 2 insertions(+), 1 deletion(-) > > > > diff --git a/lib/maple_tree.c b/lib/maple_tree.c > > index d3072858c280..f55e59bd9122 100644 > > --- a/lib/maple_tree.c > > +++ b/lib/maple_tree.c > > @@ -3692,7 +3692,8 @@ static inline int mas_root_expand(struct ma_state *mas, void *entry) > > mas->offset = slot; > > pivots[slot] = mas->last; > > if (mas->last != ULONG_MAX) > > - slot++; > > + pivots[++slot] = ULONG_MAX; > > + > > mas->depth = 1; > > mas_set_height(mas); > > ma_set_meta(node, maple_leaf_64, 0, slot); > > -- > > 2.20.1 > > > >
... actually add Geert to the cc list. * Liam R. Howlett <Liam.Howlett@Oracle.com> [230710 11:06]: > * Liam R. Howlett <Liam.Howlett@Oracle.com> [230707 11:18]: > > * Peng Zhang <zhangpeng.00@bytedance.com> [230707 06:11]: > > > Set the node limit of the root node so that the last pivot of all nodes > > > is the node limit (if the node is not full). > > This patch also fixes a bug in mas_rev_awalk(). Effectively, always > setting a maximum makes mas_logical_pivot() behave as mas_safe_pivot(). > Without this fix, it is possible that very small tasks would fail to > find the correct gap. Although this has not been observed with real > tasks, it has been reported to happen in m68k nommu running the maple > tree tests. > > Link: https://lore.kernel.org/linux-mm/CAMuHMdV4T53fOw7VPoBgPR7fP6RYqf=CBhD_y_vOg53zZX_DnA@mail.gmail.com/ > Cc: <stable@vger.kernel.org> > Cc: Geert Uytterhoeven <geert@linux-m68k.org> > > > > > > > Signed-off-by: Peng Zhang <zhangpeng.00@bytedance.com> > > > > This has been on my list of things to do for a while, thanks. > > > > Reviewed-by: Liam R. Howlett <Liam.Howlett@oracle.com> > > > > > --- > > > lib/maple_tree.c | 3 ++- > > > 1 file changed, 2 insertions(+), 1 deletion(-) > > > > > > diff --git a/lib/maple_tree.c b/lib/maple_tree.c > > > index d3072858c280..f55e59bd9122 100644 > > > --- a/lib/maple_tree.c > > > +++ b/lib/maple_tree.c > > > @@ -3692,7 +3692,8 @@ static inline int mas_root_expand(struct ma_state *mas, void *entry) > > > mas->offset = slot; > > > pivots[slot] = mas->last; > > > if (mas->last != ULONG_MAX) > > > - slot++; > > > + pivots[++slot] = ULONG_MAX; > > > + > > > mas->depth = 1; > > > mas_set_height(mas); > > > ma_set_meta(node, maple_leaf_64, 0, slot); > > > -- > > > 2.20.1 > > > > > > > > -- > maple-tree mailing list > maple-tree@lists.infradead.org > https://lists.infradead.org/mailman/listinfo/maple-tree
diff --git a/lib/maple_tree.c b/lib/maple_tree.c index d3072858c280..f55e59bd9122 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -3692,7 +3692,8 @@ static inline int mas_root_expand(struct ma_state *mas, void *entry) mas->offset = slot; pivots[slot] = mas->last; if (mas->last != ULONG_MAX) - slot++; + pivots[++slot] = ULONG_MAX; + mas->depth = 1; mas_set_height(mas); ma_set_meta(node, maple_leaf_64, 0, slot);