From patchwork Fri Sep 13 06:31:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yang X-Patchwork-Id: 13803020 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 452CFEEEC31 for ; Fri, 13 Sep 2024 06:31:37 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9C2BD6B00B5; Fri, 13 Sep 2024 02:31:36 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 972016B00B7; Fri, 13 Sep 2024 02:31:36 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 83A4E6B00BB; Fri, 13 Sep 2024 02:31:36 -0400 (EDT) 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 659536B00B5 for ; Fri, 13 Sep 2024 02:31:36 -0400 (EDT) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id E6AD716062A for ; Fri, 13 Sep 2024 06:31:35 +0000 (UTC) X-FDA: 82558743750.23.62C2C80 Received: from mail-ej1-f49.google.com (mail-ej1-f49.google.com [209.85.218.49]) by imf15.hostedemail.com (Postfix) with ESMTP id 3AF07A0002 for ; Fri, 13 Sep 2024 06:31:33 +0000 (UTC) Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=cIF0xNzX; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf15.hostedemail.com: domain of richard.weiyang@gmail.com designates 209.85.218.49 as permitted sender) smtp.mailfrom=richard.weiyang@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1726209065; a=rsa-sha256; cv=none; b=Ytm/mVOE2zqu7f8jH3V1NTO1pEec9NHzrb2M6ls9j72HqzJDJ4aT6XmF8BgyF+LnCstdsw CTPNR/w2HnxpvF19jwWlBnbs6ZquKGMzLbfuLhc8OdM6sxW1gKeKe1/Nvdgm/a0kGxugJD j/sAGALwIuZILfag2bockbhu6sVtVW0= ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=cIF0xNzX; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf15.hostedemail.com: domain of richard.weiyang@gmail.com designates 209.85.218.49 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=1726209065; 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=vJ8ufV9tlsbGRkA5+eC+CpcTSEf93UhldGdUy9rdI5s=; b=EU8C6YTw/laiTLgCVkLKzIlz2vVLiqYRpuBZrHu35RPfrBU5r67P07fwanY8Ro8abP+hBJ /RrMhxwINC1Ecs3gQvqerVr7W2iFYBMlhpEQPZUmUAsGtrSDuJj1TkYURStRmkavad8ZpS 4zGhBvyOXUNz20MGPHcr2DIz8PDDmKE= Received: by mail-ej1-f49.google.com with SMTP id a640c23a62f3a-a90188ae58eso193719566b.1 for ; Thu, 12 Sep 2024 23:31:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1726209093; x=1726813893; darn=kvack.org; h=message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=vJ8ufV9tlsbGRkA5+eC+CpcTSEf93UhldGdUy9rdI5s=; b=cIF0xNzXCrcPePe7HndCRmwwVTmxzk/Ec53wBeZ0g9VSZ+vAl72ChP/1O7uLl9LLJU X4vphGgf7oxDBu+aUZNPwh0xqK9s0MkpV6DR8cEU4FfXatYBOHXXQBf4QngAaXRfgZvh XUc6l8gzJbfDVyHf9mamcE6lJRr7fsO69R5UcljRxeZzvjfLvgW8LiR4wuKjKyh8maEP ifM+peWHAiYbbr8tgFHzxkbMJE/798DMGSF9heWnCMRBZK9HgHDtS+sET5YJHgG4uwkM RalZmc83Su7pkp/S244mFUeQlVywPlubmMJcRCWkneIqDLDv3LjJ4UfUiryi/LoF9v73 IfoQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726209093; x=1726813893; h=message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=vJ8ufV9tlsbGRkA5+eC+CpcTSEf93UhldGdUy9rdI5s=; b=BnJXZC2VmJOvM+rngxOQSd/A+Twf9qy2GAOEFugU7uYcbabszBr3hLurrlgkF8sCKE WR+aqF+4HwRSDBja/01ZTAFCHP+YoHgdHw4Gw/9dsdQJSRT/nKSb2j+dO5SAcELVXuwE dD1Bq2Xh0utL6B9Xq+JEinZvKaJnXT6gMNCbneWXB+OnwHq5Doc8Xk5SpQQkdEI9bHNi y3A6ivtd15XF8G1zHO+dDetbxLSLG1/1MUki64ZcvCr7uf8j8yfWknI8YUCRgjGAsPbs +gXCjp2awkprlA21pxO+VGZnLIX0Fvl0eCb+Nj+ruDRCAANYkbR9JRpt7N5cl7cDTuHF mIvA== X-Forwarded-Encrypted: i=1; AJvYcCVb0ANz+sj726YV377Y7TfUkRjUH7yNcFMRgmLGDUswVdbGufmnphloyxxOlh5Isrg52HlQM4z+IQ==@kvack.org X-Gm-Message-State: AOJu0Yw04DpDX6osF32AJI5lWTl5iktOMzCsKqR3IXG78zACSl2LF+wl JL3Mj4jfr1wVXbL3YkILFx0ALZpK+We7gk3fleLzMV1Umc2lTIHZ5bD/ng== X-Google-Smtp-Source: AGHT+IGzG7tqQOCfxC0c7W/7TvKeUajVnnM6MuaeNvGqUJ693NZw3XaPPvG8z4mfIKkFfPnQBUoTIA== X-Received: by 2002:a17:907:1c8c:b0:a8d:483f:5199 with SMTP id a640c23a62f3a-a902966a981mr497622666b.58.1726209092277; Thu, 12 Sep 2024 23:31:32 -0700 (PDT) Received: from localhost ([185.92.221.13]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a8d25ce86e0sm839757266b.143.2024.09.12.23.31.31 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 12 Sep 2024 23:31:31 -0700 (PDT) From: Wei Yang To: akpm@linux-foundation.org, Liam.Howlett@oracle.com Cc: maple-tree@lists.infradead.org, linux-mm@kvack.org, Wei Yang , "Liam R . Howlett" Subject: [PATCH] maple_tree: root node could be handled by !p_slot too Date: Fri, 13 Sep 2024 06:31:28 +0000 Message-Id: <20240913063128.27391-1-richard.weiyang@gmail.com> X-Mailer: git-send-email 2.11.0 X-Rspam-User: X-Rspamd-Queue-Id: 3AF07A0002 X-Rspamd-Server: rspam01 X-Stat-Signature: q6pqgra83o7ckwqg9c5395asj1dyz76i X-HE-Tag: 1726209093-702955 X-HE-Meta: U2FsdGVkX18uvA+cBDkbGz3SmuJJRx5lAceIXupS2p/AlwwsYJu0J912hLPIwvNawZR1CPbPZ182Dt2rJmR6B5SVEgBbe/mJLSJH7eWXTmf8wYrsQ9DpDD6t/iIMhwqFOMJFl+isDx05M+al/M92UmzBrb/mVivumwIM88FHJSDStFg+tLX2kXcvhnCTUu+6ltWD3VIoLijNuwo4etjbnK9zIRrj/xrLrRtFjH6oT26KqwBKUka1kxXxJplLT3GxvkWtWa97FjO/MSlg+oYHiGQfV6hycehncxLmqRnKISUa2O/J6pB7eMWA93cz/cXB/MPNKhDOUkNxvmfifxIpXroCMKi5cVOGqKJZBOxWSy/khby/JjcODOtHvTxHHaGFi8q5V/tFKZaC4B+xIQkbgah5GiIXLc/A+ibzXKGVeBW+968iUsEUdHScO+08+QFJdNvFQHHNYptf1f1du/SJkapobv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XGAo= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000063, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: For a root node, mte_parent_slot() return 0, this exactly fits the following !p_slot check. So we can remove the special handling for root node. Signed-off-by: Wei Yang CC: Liam R. Howlett Reviewed-by: Liam R. Howlett --- lib/maple_tree.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lib/maple_tree.c b/lib/maple_tree.c index 85bd651e7770..b5dde94cc7a9 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -2100,9 +2100,7 @@ static inline bool mas_prev_sibling(struct ma_state *mas) { unsigned int p_slot = mte_parent_slot(mas->node); - if (mte_is_root(mas->node)) - return false; - + /* For root node, p_slot is set to 0 by mte_parent_slot(). */ if (!p_slot) return false;