From mboxrd@z Thu Jan 1 00:00:00 1970 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 33357C4332F for ; Thu, 17 Nov 2022 03:45:57 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 21CF86B0074; Wed, 16 Nov 2022 22:45:56 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 1CC4F6B0075; Wed, 16 Nov 2022 22:45:56 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 095A48E0001; Wed, 16 Nov 2022 22:45:56 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id ED7B86B0074 for ; Wed, 16 Nov 2022 22:45:55 -0500 (EST) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id C37A5A0A27 for ; Thu, 17 Nov 2022 03:45:55 +0000 (UTC) X-FDA: 80141545470.12.9EC762F Received: from mail-ed1-f43.google.com (mail-ed1-f43.google.com [209.85.208.43]) by imf03.hostedemail.com (Postfix) with ESMTP id 52CD42000C for ; Thu, 17 Nov 2022 03:45:55 +0000 (UTC) Received: by mail-ed1-f43.google.com with SMTP id s5so735605edc.12 for ; Wed, 16 Nov 2022 19:45:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=user-agent:in-reply-to:content-disposition:mime-version:references :reply-to:message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=0BpPHy8dIR7jqC5rl0a6Tr8UGHuG0L95Xmvj3K3gkXo=; b=EE+QSXJEBqMDGtVkHlILhdYgt/UK/oYBT69ZSCMuvaToqEF8VFPjmrGPILWM+yaXMu NNFJidNHnfzJmC6hfyib5TY2eXbqP67ByeWKamcFhGC7zlYLZdJg/jyZ+uGQ+7dYFUG2 CwLH1mWHf3E9QENJgOEO/1kXZBC1nIf7vBk0xCSMXqNMhaw2nZpQ9AnaGyq4LW8Gj6R0 Fv/XD0LWsoMOENJvWX3/u2Un+fSpKmLxDowexCxFFqhaaZuK4q+3l4wskBjt1v7ZMoVS nCcf1EuVae6se0LwzZaBEvefaAgiJDmeWXw6Gxe5FbVj8iNbzX9vpbqQxkBLtqVKuLVT NzLw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=user-agent:in-reply-to:content-disposition:mime-version:references :reply-to:message-id:subject:cc:to:from:date:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=0BpPHy8dIR7jqC5rl0a6Tr8UGHuG0L95Xmvj3K3gkXo=; b=GHI/HI9LdjZaN7BJdMd2VywgzpS0xTx4DT9dbMx7qfPqw8iQMYLFU02HTlL8avBwtd PYVlt45ZOskTkvNuB4xgCgdHbbJzHlQPry2TENVPo8Jnfu0XKuh7AuyCfLgPaWRykLqe gsYF9RETF4loMW8g04IUegyVVgFpBFBfGA8kz94Z0t33I8NTDDN7nf5C9vYQiGpU+Onw cy9zj8Va6SF8fItfTsdzrWKniCRgfv7cbPPnWGhRvaV1Po/elM8qrSBZF9NAvsmErOZu xDjgRb8UwxmBQvo/2iVgLauWDnkJiUbpTuZZzrkOBtzfqkr7nTupWUVTkRlhM2QmOaGJ p3QQ== X-Gm-Message-State: ANoB5pkCSB1JRgEzW8g5OOPM/E/AQsAtmAxCT6xL17/g2FnjKSUlJ9Ey cIwQMggpP/Xf52iQYYFNbYU= X-Google-Smtp-Source: AA0mqf7OdTW6qYKwHcDr178+TMVd6R20KJSkUnR/LbApiENBVa4qp0GmsnjGZD7wa1szz2zABI5pDg== X-Received: by 2002:a05:6402:1f89:b0:458:caec:8f1e with SMTP id c9-20020a0564021f8900b00458caec8f1emr556391edc.280.1668656753937; Wed, 16 Nov 2022 19:45:53 -0800 (PST) Received: from localhost ([185.92.221.13]) by smtp.gmail.com with ESMTPSA id be22-20020a0564021a3600b00461a6997c5dsm8256487edb.83.2022.11.16.19.45.53 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 16 Nov 2022 19:45:53 -0800 (PST) Date: Thu, 17 Nov 2022 03:45:52 +0000 From: Wei Yang To: Liam Howlett Cc: Wei Yang , "linux-mm@kvack.org" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH] maple_tree: not necessary to filter MAPLE_PARENT_ROOT since it is not a root Message-ID: <20221117034552.he33qqvubfenq5co@master> Reply-To: Wei Yang References: <20221113005618.29679-1-richard.weiyang@gmail.com> <20221115142914.x6d2q3qz4xurikrq@revolver> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221115142914.x6d2q3qz4xurikrq@revolver> User-Agent: NeoMutt/20170113 (1.7.2) ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1668656755; a=rsa-sha256; cv=none; b=NjSa0AHXpZWK6YDbvC1L7QQbKPCJGuRLXIt2qTaq3oPOy0wHwAev7dTeZC1mY5x/7UMuSh v/rCDT/Y1hppdRm+HdUUueomSqV7G08/6V0qGZ5jH7sXehZoK1PdgmZrFnpzUIpRNMiR49 WpJXdwdUVJ5mYCm4PXrpnTPeYe/Jif4= ARC-Authentication-Results: i=1; imf03.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=EE+QSXJE; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf03.hostedemail.com: domain of richard.weiyang@gmail.com designates 209.85.208.43 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=1668656755; h=from:from:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=0BpPHy8dIR7jqC5rl0a6Tr8UGHuG0L95Xmvj3K3gkXo=; b=0buJJdrBtCDB1mxPIXf5pAda8ZJPGanoPmVXVV42GuUMNuxdk++RHKlItBllU5xMDzTtuX qcERdKGjj++uiMzYiAMzMkNk4X3HMJ+5L7U8VNl071RrAuNE4Sf9i1dfKuopjTvKvsP0UO eNR5R0sBIJ/Z6xuf32I8ylUyML6OZCY= X-Rspam-User: Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=EE+QSXJE; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf03.hostedemail.com: domain of richard.weiyang@gmail.com designates 209.85.208.43 as permitted sender) smtp.mailfrom=richard.weiyang@gmail.com X-Rspamd-Server: rspam02 X-Stat-Signature: jw6u6hetnfw565cbjhu4e56xuzcr3irb X-Rspamd-Queue-Id: 52CD42000C X-HE-Tag: 1668656755-296075 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Tue, Nov 15, 2022 at 02:31:15PM +0000, Liam Howlett wrote: >* Wei Yang [221112 19:56]: >> Root node is return at the beginning, so we are sure bit 0 is not set. >> >> Signed-off-by: Wei Yang >> CC: Liam R. Howlett >> --- >> lib/maple_tree.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/lib/maple_tree.c b/lib/maple_tree.c >> index 9aad98c24f3e..f8c4755e7c75 100644 >> --- a/lib/maple_tree.c >> +++ b/lib/maple_tree.c >> @@ -436,7 +436,7 @@ enum maple_type mte_parent_enum(struct maple_enode *p_enode, >> return 0; /* Validated in the caller. */ >> >> p_type &= MAPLE_NODE_MASK; >> - p_type = p_type & ~(MAPLE_PARENT_ROOT | mte_parent_slot_mask(p_type)); >> + p_type = p_type & ~mte_parent_slot_mask(p_type); > >I think there is a larger cleanup that can be done here. It looks like >mte_parent_enum() is called from one location and that location is a >wrapper. > >The check for the root bit should also probably trigger a WARN_ON() and >still return 0. I don't think the callers are doing enough to validate >it - although they should never reach this function with a root node. >And, in fact, I am not doing enough in the test code since I didn't >guard this correctly in the verification of the parent slot before >calling this function. > >Thanks for pointing this out. I will send out a patch to clean this up >shortly. > Yep, look forward your cleanup. While I have a question here. We get 4 types in maple_type, here we just return two of them. This means the other two is not possible to be parent node, right? >> >> switch (p_type) { >> case MAPLE_PARENT_RANGE64: /* or MAPLE_PARENT_ARANGE64 */ >> -- >> 2.33.1 >> -- Wei Yang Help you, Help me