[8/9] maple_tree: Remove the redundant check of mas->offset in mas_empty_area/area_rev()
Message ID | 20230425110511.11680-9-zhangpeng.00@bytedance.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp3327081vqo; Tue, 25 Apr 2023 04:14:10 -0700 (PDT) X-Google-Smtp-Source: AKy350acckYMnym1zVeygoDdtvnciujROrv6FGJ3KRZiF04qCwwaslALP8SKV9vbo3Uuv9xjHKkM X-Received: by 2002:a05:6a20:c901:b0:cc:a5d4:c334 with SMTP id gx1-20020a056a20c90100b000cca5d4c334mr18943022pzb.10.1682421250018; Tue, 25 Apr 2023 04:14:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682421250; cv=none; d=google.com; s=arc-20160816; b=exR4lc+alGKKDj/cKTqD6QguqctKeZMuCb1WAa4LAVdXg19pY5gd9wY0t5rfPe+VOl 3CG/AkMUYi5m97Sa6AtkaUvg1Uzi9PsEPXLjuEBqtYtJRSAOgo3kwlosKFUbivnGz+fM 1QTVAjpwv1usp0w5bBS8NkPna1+DXJO13gRbq4iG9vaq/1qA8ZiRiKyyDsjeMsO6Yc/V 3DKXd9o7n1+PtghN76Dc5CfEy0PreDd+/0Z4BzEeFcTvFAglrkHX/GYAk14FwjSIuRDH 9ro6F5tWy7uGE7Zkl2zF6v1fdGYmFVPr6Mrk+zxUsjfetE8m7rEQdmSKQwSETOmXmkqR +hKA== 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=/5HiaDQy1gV5OijIvJDqywUjC7+FvWItMLIDy/cp2lo=; b=As2fjTMz497wW0E0gSWPC6r/9pzw5yMaVnWpAAM2u2EUp3P1oCPtgDxcLQZOIbTLue +GL4XP4g8MXZAFWQE0tCv3U+iskgDl/fhzeS0t9fS361hjHwZGjqh6GwgHj22EDzM392 ggZFDg7dxl9KFHqqzR7IHAnZInHg1GfqQh3QIkibNt+6M0vWe3teVbsgJfGCvZfV+HcY Eb3lq0qr6fyEblMw4y2yQaBFdYtEbULKTpNFVZo8HI765Mb7FbCZJQI3ox3KKf+d11dT Om/tA7htjKkYmBCCvHNlv4rZNjHx/ecnN3ARiKl3zpBpQNwyQDT/yAPeHhz2wMnGiZl3 vr2Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bytedance.com header.s=google header.b=Jmn8+k2S; 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 f23-20020aa79697000000b0063b8a054e06si13417028pfk.259.2023.04.25.04.13.55; Tue, 25 Apr 2023 04:14:09 -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=Jmn8+k2S; 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 S233809AbjDYLGC (ORCPT <rfc822;zxc52fgh@gmail.com> + 99 others); Tue, 25 Apr 2023 07:06:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53586 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233788AbjDYLF5 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 25 Apr 2023 07:05:57 -0400 Received: from mail-pf1-x435.google.com (mail-pf1-x435.google.com [IPv6:2607:f8b0:4864:20::435]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4FFD87ABF for <linux-kernel@vger.kernel.org>; Tue, 25 Apr 2023 04:05:51 -0700 (PDT) Received: by mail-pf1-x435.google.com with SMTP id d2e1a72fcca58-63b4dfead1bso4700984b3a.3 for <linux-kernel@vger.kernel.org>; Tue, 25 Apr 2023 04:05:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1682420751; x=1685012751; 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=/5HiaDQy1gV5OijIvJDqywUjC7+FvWItMLIDy/cp2lo=; b=Jmn8+k2SfFfgMhLQds+Cr0nlYahkoptl1RwDbzAx8AZV4daLWkUna/d9KpjCx2Rfy9 rmCt9o71sj3yTlbe6K2B/hk/W22x/AoY5gUneeoO2WZBUgG67nocT5AJKOv91QCs4JN+ DZCnL7fxyHriXlCninrD3Zk7URi4nUfnyi5EmbP/3Gha1H6bcYRPYa70gVOJDs6+9d0S qnpA6xJhk/rQJkofq1EEOa8tqw8D0zjeLVXFud06M0NuAFQZVoamUgVTSmw9Qqf/CECK aW9WKvh1ndvQxmuIyREMN2Zd+vYx5GuyPdQSabCRBc2itdPqh0hvHYca5F8MEElf7xn+ 3LeQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682420751; x=1685012751; 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=/5HiaDQy1gV5OijIvJDqywUjC7+FvWItMLIDy/cp2lo=; b=JImxG/15/ZMWVbuUB4mDZm9pAsS8pR01sCQWrZ4vZvEW50TRZH9Is8AjlWZmqdLl1v 0yHE+OUc2/2/oHOfI5VV29iExnbugnmCtn/IcUY65dv/VRJwhCZ+W5uGZkSTGdPKG7AC N/dEUMeiIGHob3hPdSnxk7lxrVaiBwxTJXaB6uzpzLukWFNzTH9CDdgAgjyY+m8enkjY bwBeT+OlDZkucKUj2Wak0RyOe7QJ7mq9+YdRdQogfKWyosj3NlEmspYBpigr0ti4Eb2h TjHuzbSSUPNbWJ4uUO6PpPg+20SwEX2PnbOEQpUyY1XhznAopZB/dOCAfkfo9TQMNK9m qvBg== X-Gm-Message-State: AAQBX9eRenNvFqdlSv9aZwAPCxpPk9xCj4yv2wJmESS9W+SrUE3z5Evy rxUqf+B7os9FHefnMZKvOnxJ4Gu00uDaZlyYkes= X-Received: by 2002:a05:6a00:2d20:b0:634:7ba3:d142 with SMTP id fa32-20020a056a002d2000b006347ba3d142mr24767709pfb.10.1682420750817; Tue, 25 Apr 2023 04:05:50 -0700 (PDT) Received: from GL4FX4PXWL.bytedance.net ([139.177.225.236]) by smtp.gmail.com with ESMTPSA id u3-20020a056a00158300b0063f3aac78b9sm4422169pfk.79.2023.04.25.04.05.48 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 25 Apr 2023 04:05:50 -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: [PATCH 8/9] maple_tree: Remove the redundant check of mas->offset in mas_empty_area/area_rev() Date: Tue, 25 Apr 2023 19:05:10 +0800 Message-Id: <20230425110511.11680-9-zhangpeng.00@bytedance.com> X-Mailer: git-send-email 2.37.0 (Apple Git-136) In-Reply-To: <20230425110511.11680-1-zhangpeng.00@bytedance.com> References: <20230425110511.11680-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?1764146544528414820?= X-GMAIL-MSGID: =?utf-8?q?1764146544528414820?= |
Series |
fix, rework and clean up for maple tree
|
|
Commit Message
Peng Zhang
April 25, 2023, 11:05 a.m. UTC
In mas_empty_area(), after mas_awalk() returns, if EBUSY is not set,
then mas->offset must be valid, no need to check. Same in
mas_empty_area_rev(), so delete it.
Signed-off-by: Peng Zhang <zhangpeng.00@bytedance.com>
---
lib/maple_tree.c | 7 -------
1 file changed, 7 deletions(-)
Comments
* Peng Zhang <zhangpeng.00@bytedance.com> [230425 07:05]: The subject doesn't need this much detail. If mas->offset means something to people reading through the git logs, they will already be looking into the change. > In mas_empty_area(), after mas_awalk() returns, if EBUSY is not set, > then mas->offset must be valid, no need to check. Same in > mas_empty_area_rev(), so delete it. There is a lot of code in this message as well. > > Signed-off-by: Peng Zhang <zhangpeng.00@bytedance.com> > --- > lib/maple_tree.c | 7 ------- > 1 file changed, 7 deletions(-) > > diff --git a/lib/maple_tree.c b/lib/maple_tree.c > index 8bfa837b7b752..964214de2ed18 100644 > --- a/lib/maple_tree.c > +++ b/lib/maple_tree.c > @@ -5305,13 +5305,9 @@ int mas_empty_area(struct ma_state *mas, unsigned long min, > return xa_err(mas->node); > > offset = mas->offset; > - if (unlikely(offset == MAPLE_NODE_SLOTS)) > - return -EBUSY; > - > mt = mte_node_type(mas->node); > pivots = ma_pivots(mas_mn(mas), mt); > mas->index = max(mas->index, mas_safe_min(mas, pivots, offset)); > - > mas->last = mas->index + size - 1; > return 0; > } > @@ -5365,9 +5361,6 @@ int mas_empty_area_rev(struct ma_state *mas, unsigned long min, > if (mas_is_err(mas)) > return xa_err(mas->node); > > - if (unlikely(mas->offset == MAPLE_NODE_SLOTS)) > - return -EBUSY; > - > /* Trim the upper limit to the max. */ > if (max < mas->last) > mas->last = max; > -- > 2.20.1 >
diff --git a/lib/maple_tree.c b/lib/maple_tree.c index 8bfa837b7b752..964214de2ed18 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -5305,13 +5305,9 @@ int mas_empty_area(struct ma_state *mas, unsigned long min, return xa_err(mas->node); offset = mas->offset; - if (unlikely(offset == MAPLE_NODE_SLOTS)) - return -EBUSY; - mt = mte_node_type(mas->node); pivots = ma_pivots(mas_mn(mas), mt); mas->index = max(mas->index, mas_safe_min(mas, pivots, offset)); - mas->last = mas->index + size - 1; return 0; } @@ -5365,9 +5361,6 @@ int mas_empty_area_rev(struct ma_state *mas, unsigned long min, if (mas_is_err(mas)) return xa_err(mas->node); - if (unlikely(mas->offset == MAPLE_NODE_SLOTS)) - return -EBUSY; - /* Trim the upper limit to the max. */ if (max < mas->last) mas->last = max;