From patchwork Tue Oct 15 23:39:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yang X-Patchwork-Id: 13837426 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 D3A23D20686 for ; Tue, 15 Oct 2024 23:39:33 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 71A6C6B0089; Tue, 15 Oct 2024 19:39:33 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 6C9946B0088; Tue, 15 Oct 2024 19:39:33 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 56A156B0089; Tue, 15 Oct 2024 19:39:33 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 3211A6B0083 for ; Tue, 15 Oct 2024 19:39:33 -0400 (EDT) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id DC774C19E8 for ; Tue, 15 Oct 2024 23:39:22 +0000 (UTC) X-FDA: 82677455574.23.43A3E41 Received: from mail-ed1-f42.google.com (mail-ed1-f42.google.com [209.85.208.42]) by imf07.hostedemail.com (Postfix) with ESMTP id DAECC40016 for ; Tue, 15 Oct 2024 23:39:19 +0000 (UTC) Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=TDtRnBOi; spf=pass (imf07.hostedemail.com: domain of richard.weiyang@gmail.com designates 209.85.208.42 as permitted sender) smtp.mailfrom=richard.weiyang@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1729035497; a=rsa-sha256; cv=none; b=ShPQ1xy5PhDtWMj/1sLTVaV93cTpkz3tg4ZSHAbKPTagob3HTPzmspuCKWf3OzL2UhA5ob 8rlirPbKcZLj2dvqzDXNabYtgWQxmPsYxPNEXzO+go3z3SJy+VQFHHVN3gD+M84J46V4cK FL9kbEiGUmEdeHXad0y1hMKPKGYMflU= ARC-Authentication-Results: i=1; imf07.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=TDtRnBOi; spf=pass (imf07.hostedemail.com: domain of richard.weiyang@gmail.com designates 209.85.208.42 as permitted sender) smtp.mailfrom=richard.weiyang@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1729035497; 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:in-reply-to: references:references:dkim-signature; bh=rK9sCH7BMRprmC0SVhuiTVMlbu8841RZhYJRE0a4wvw=; b=uM48RCpIx4TXrnQLkZCafF1/EZVRxeRJgZaeItEfDY0I/Ib7W24yEB9/PUYFWogXabU2X6 5NjEtEN91xY2/IqXsTHHggBYjNL9Ho7FDkDNRJh1kn/3xDANSY+EcVmmkVoWW9IGDWu8lA hD6HT1SD/Q2YbBCV1Zxfzu3Mnc+8KH8= Received: by mail-ed1-f42.google.com with SMTP id 4fb4d7f45d1cf-5c96b2a11e7so4380104a12.3 for ; Tue, 15 Oct 2024 16:39:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1729035570; x=1729640370; darn=kvack.org; h=references:in-reply-to:message-id:date:subject:cc:to:from:from:to :cc:subject:date:message-id:reply-to; bh=rK9sCH7BMRprmC0SVhuiTVMlbu8841RZhYJRE0a4wvw=; b=TDtRnBOiraIuAH1JsJT/icILH1JaksD384qjrQkriMBkGCWk7FC/eB0RsV/RAW8yBF Jm1O59Cs3nFhsivRlvgP9Yvcec60igbj0Vl+tMqNwpDC07euY3aAMMdFkaiB93WtqH8i X9kH976G1A2Kt0yGTjhmxxQaNR0eROV3ctnmyK6mGc4w2UX/Kjzt9m+806L3y7/Czvmo 7FMrdCo5nNdZexwpEBB+vlKZF8we1KkTFSipmRrjAgAthnT/p6VrsJN7MUu7CMcpT1LY kFBiaG1OZdLxuQ+1Swx3K7KcpKXE55bA99uJ3oIofCj1FetuBKki/bWaBD6soF8GNrq2 /oBQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729035570; x=1729640370; h=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=rK9sCH7BMRprmC0SVhuiTVMlbu8841RZhYJRE0a4wvw=; b=Gcpk55oLoekGkNz4g99QaKAliKqCb4xqkmMDxafINCvjISl/aWkTRw8Aq1iNsT7TYx 04k0FMRpLjA9BGKPxPp29Nqja3FV9JmVKNqfF9LAlBmDbbwrpxH8SGb0tgwfEb34grNb TLctrqQv7IuCDCU/CElIIb7Hc+Njk4JK0cn/KS/LsouUXI+klB2DsL8nara0H9Sm+v98 HdpWrTi4vuoNAOpLdMCQP0B/J9/fm4p5+HLYK70oQXZxSg4OzQhDcL9KfUxNDaApNEdY FMQ+ZEzFeQ9NN472RKFLxvovC5fjW0PNVt9UYNPU9hCOXU3dFsfyuDIY0abzmx11a/kT tpUQ== X-Forwarded-Encrypted: i=1; AJvYcCXYQz9IthoxWOdtW9gBgTHVtL9Q2v4ORHyy+Muoui2bDyRQ2AMVOw3WoJwrX1KnepsSzjllHxqpLw==@kvack.org X-Gm-Message-State: AOJu0Ywyrot4T24HqU3Hi5xpKmVjgumB8yyxQRW4bEwMC9lEhItxejP7 KgDYo6n17MKIR8shNa+I9K3+hv1/VJNSwBCNGnlWeZq/FypfQ9Jc X-Google-Smtp-Source: AGHT+IGlt4pzcCQ5BPOK2aWaUqY7XOWOEoXqMYZS6Tz//cacV3vQo3ji1MXU6BwC/VyW8OYOLuUVQA== X-Received: by 2002:a17:907:1b1f:b0:a99:e1a1:473f with SMTP id a640c23a62f3a-a99e3ea59ddmr1351429666b.57.1729035569428; Tue, 15 Oct 2024 16:39:29 -0700 (PDT) Received: from localhost ([185.92.221.13]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a9a298232f4sm116923466b.117.2024.10.15.16.39.27 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 15 Oct 2024 16:39:28 -0700 (PDT) From: Wei Yang To: Liam.Howlett@oracle.com, akpm@linux-foundation.org Cc: maple-tree@lists.infradead.org, linux-mm@kvack.org, Wei Yang , "Liam R . Howlett" , Sidhartha Kumar , Lorenzo Stoakes Subject: [PATCH 1/2] maple_tree: not necessary to check index/last again Date: Tue, 15 Oct 2024 23:39:08 +0000 Message-Id: <20241015233909.23592-2-richard.weiyang@gmail.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20241015233909.23592-1-richard.weiyang@gmail.com> References: <20241015233909.23592-1-richard.weiyang@gmail.com> X-Stat-Signature: 1rb5grpojwinqdeikexcuknu6o8i39e9 X-Rspamd-Queue-Id: DAECC40016 X-Rspam-User: X-Rspamd-Server: rspam10 X-HE-Tag: 1729035559-307899 X-HE-Meta: U2FsdGVkX19vMlNZ9qrNvk2jyE1u+vomGvd57UD4r2NnIE7EgyoNtehza1A7nRN12Eka4Vj2b/pQ5sreyKGuCLOEuGnQ9KJ1NNbdUhlP1rm1mKOrFxRkU1N7lBbyjvSgqZIHAVJGqABduEiTUjhiGo8NSjFuhHMabq2QwFi13Gdz1hh6naAJutloMhP+8ZOY+hHJEx+aToV4rJ0ZxBbhzxctfRxgIFIVicIHtiAiyaKtcXb25T2ZEGlQg/cfDu7ZylgSaHimZPdgPAw6squFJgU0SfbcshQk/KNHYhy5U+slh8KvROPKBAz5BmKzsCBixcFcwke3kRIfojEdh3TQ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VnvtvmLrQorQsbgH7FbcAAWQ1y445wQuu44lPfqvLUXd3S/k 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: List-Subscribe: List-Unsubscribe: Before calling mas_new_root(), the range has been checked. Signed-off-by: Wei Yang CC: Liam R. Howlett CC: Sidhartha Kumar CC: Lorenzo Stoakes --- 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 0aa9fa8fa7de..3a12866a4a89 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -3594,7 +3594,7 @@ static inline void mas_new_root(struct ma_state *mas, void *entry) void __rcu **slots; unsigned long *pivots; - if (!entry && !mas->index && mas->last == ULONG_MAX) { + if (!entry) { mas->depth = 0; mas_set_height(mas); rcu_assign_pointer(mas->tree->ma_root, entry);