From patchwork Mon Nov 25 02:41:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yang X-Patchwork-Id: 13884320 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 C334ED3B7CA for ; Mon, 25 Nov 2024 02:42:21 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 926536B0082; Sun, 24 Nov 2024 21:42:20 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 8D5EC6B0083; Sun, 24 Nov 2024 21:42:20 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 781776B0085; Sun, 24 Nov 2024 21:42:20 -0500 (EST) 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 546436B0082 for ; Sun, 24 Nov 2024 21:42:20 -0500 (EST) Received: from smtpin07.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id A9F61ADBD6 for ; Mon, 25 Nov 2024 02:42:19 +0000 (UTC) X-FDA: 82823068272.07.D623C6F Received: from mail-ej1-f41.google.com (mail-ej1-f41.google.com [209.85.218.41]) by imf12.hostedemail.com (Postfix) with ESMTP id C31AF40003 for ; Mon, 25 Nov 2024 02:42:16 +0000 (UTC) Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=UkwZ3Pfc; spf=pass (imf12.hostedemail.com: domain of richard.weiyang@gmail.com designates 209.85.218.41 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=1732502536; 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=D/ULVXTPbAMjIKKXLv5Zad6eBGdYXmEr5PDfbA28UH4=; b=NleizSSnTOkNDBEItsiYgPAGTzbPYYplG3UZ3zZ8dny5J4rr4WPqFspQZFgcvO+V5OGKpd KFah3p2TFK5IPJTKiMnei76KcM3uVI9KmU/JfdKf/8Se3FkJYaPD/VFD/fT6tjILPrrRWc 0m1nMOZU/FiOjsruG8u8f5ffXjoXwc0= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1732502536; a=rsa-sha256; cv=none; b=HahNMq2an1YldKFrSqU57BPvJrdsZ97/TDhNwTFJUFNicIG7a1tVSRY7yhDSmCOia5CEiW 4hdo6qfd5hrFaLt2DaUP8pqJH08zL+cBFTtJdZiQ4WCPYn9LQhduinwLT/FcwuAP0eXIjU awmnmPrSuCeEi6apU2r3dwThBsD8oeQ= ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=UkwZ3Pfc; spf=pass (imf12.hostedemail.com: domain of richard.weiyang@gmail.com designates 209.85.218.41 as permitted sender) smtp.mailfrom=richard.weiyang@gmail.com; dmarc=pass (policy=none) header.from=gmail.com Received: by mail-ej1-f41.google.com with SMTP id a640c23a62f3a-aa549d9dffdso118615166b.2 for ; Sun, 24 Nov 2024 18:42:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1732502536; x=1733107336; darn=kvack.org; h=message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=D/ULVXTPbAMjIKKXLv5Zad6eBGdYXmEr5PDfbA28UH4=; b=UkwZ3PfcaFxVwFDkyQSc4OgXqP+Q6F6ZxXSL8EM0UaU4m5TQLHljH0DoA+ZPX6Bvq0 nT+wjXJ7OSTcNkFkLW6a16/I9gr/6aEBzlvEgNYYRLME4qHBsoiZjpn5gElLdjVp7VxR cf31tGvsQdVPfqe7v+TDHmNcM9tIlRTVanLt8EKHKoqXr3Yjksz8nSWUayWhxhXstF14 2qbIRd/tjEAvTyFuVQR4l0xZ80y0Ec+QLS+VWq1yrUpAO4+FERDQnmacWVxInsHxyKCf jVUYnrpiGPEHq8pzu2I+IDvJYzWgMEWBDHteuzsRiRHTrQ5qV2tm3qJiUahCN2nH0Jk0 xE4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732502536; x=1733107336; h=message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=D/ULVXTPbAMjIKKXLv5Zad6eBGdYXmEr5PDfbA28UH4=; b=su/YPjhx5YCRKedkbuVwzs5BoOL2GWEzmHvNSVbo9lJsjjgvRtjYjuXJ/8hXJXq+dO lrfsFyg8Nzwpq4fxvSQq6W7gezIEKzb4g7Aoies5oT5cx+uDe2ae83EZavWTiDqVdI3P 3hjav0OBQSdRDvC8tloXo4XPCHj2SU0dV0wsX1gWA5MCOunkMcx5lsKdONt8Ch16T/US b8PtVxG4DtaKNQrFr89UQfHe8d+dhrkFJqctT0hpTPDtCNpjihuRydAZKDjw/qhWxmp2 ePMzrVSfYvdIkRtpe1fVbF0ofR9vPD5jmPGi/l+O60+0CnNgApnRgNf0Mq2qsJWn6oHC SAlg== X-Forwarded-Encrypted: i=1; AJvYcCU1oxDyNw0oyGQWAD1zKzkzUR+UTPpPA/EHEa3s5ydY2mXpsRhJ2s8iX6VEDbuoBxOR9unD8/Jd2Q==@kvack.org X-Gm-Message-State: AOJu0YwpIk2NE9APUeloRBWXJXuUBFzaIO9z88zrTqceH5hEc8lwJ9WN 4ns5+FmLDJQ7ZFPomnjW2Ykf1lKz+7xwOtWIf8QPcQz1szM0YBxi X-Gm-Gg: ASbGncvc3shn+2KkHqKUTKnSrDWzAUquNsHgerVBYNE1YXckpRZ2rfmBB5Up9GGsOZY tD+6MeMs3pfeo2yunvddbod5FAmXh4TfF34MgB5REd8gDHAeAejT+zA3pHBnauzSQOhXMRx8zpQ KMwEzED6bxx5CKerRAhJ159KALZJFdOfzLtxNYFacPwRtL/syd09fqe/MZvZ2jo8XnpnwuhBuEr v7uhgpF1k5jQ0ASYAAltF3h1tcs6OKOwQC/LFwMcoyZAB4iXg== X-Google-Smtp-Source: AGHT+IEdWbnAI5M2akQHnVF44581hA1RQv+O9rXbHIzCIsryh/y/9WHLSqDRN4X+jdSY4B6jAAKa5A== X-Received: by 2002:a17:906:2931:b0:aa1:dd58:aebc with SMTP id a640c23a62f3a-aa521fdcdd3mr696776266b.39.1732502536002; Sun, 24 Nov 2024 18:42:16 -0800 (PST) Received: from localhost ([185.92.221.13]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-aa50b52f9ecsm409921466b.124.2024.11.24.18.42.13 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 24 Nov 2024 18:42:14 -0800 (PST) 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" , Sidhartha Kumar , Lorenzo Stoakes Subject: [PATCH] maple_tree: use mas_next_slot() directly Date: Mon, 25 Nov 2024 02:41:56 +0000 Message-Id: <20241125024156.26093-1-richard.weiyang@gmail.com> X-Mailer: git-send-email 2.11.0 X-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: C31AF40003 X-Stat-Signature: cuqno9wct3hxcfn9cfqzuhxcsd853b59 X-HE-Tag: 1732502536-127538 X-HE-Meta: U2FsdGVkX1+pZrKkzkK6Mo9se8sFxSeNxxvOmEsEoFbZPKveSyjBQN0aK1+OQdFxkkwafR2/FfucX+eO28Mq1gxuT6MtbIcMFklvPc6LWM9tUOMFqToWo3w3pDfgLKu1x27VQk+IB4ZvXxtW0IE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wcU/PypGHl/nuoMvJ1KVE04nkzuhcvTiI9C2eZlta/x7nbBrwbd1zGIW3JMpydc1RvAV1CPObd7YGQNVpVttGjQ/WcH5ZQxVfIWBd3vbawnNrXH7YPRKDH09cRNpcTmICJXUS8Mc9Iav78MX9d8p3o0MlLIl+CnAkbn/8mu/06mSRLQhtmrCFoRmPvI1beJfOFOrE3HKKTIuw1cOq5vgfCEprcVgWNbKflp4LaVn3AFRmBbDJLES0htx6ME0OksVRHlEl2JE+9lLxeyZfHKtBbs X-Bogosity: Ham, tests=bogofilter, spamicity=0.000046, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: The loop condition makes sure (mas.last < max), so we can directly use mas_next_slot() here. Since no other use of mas_next_entry(), it is removed. Signed-off-by: Wei Yang CC: Liam R. Howlett CC: Sidhartha Kumar CC: Lorenzo Stoakes Reviewed-by: Liam R. Howlett --- lib/maple_tree.c | 25 +------------------------ 1 file changed, 1 insertion(+), 24 deletions(-) diff --git a/lib/maple_tree.c b/lib/maple_tree.c index b67dae356182..7efb1520f9bd 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -4733,29 +4733,6 @@ static void *mas_next_slot(struct ma_state *mas, unsigned long max, bool empty) return entry; } -/* - * mas_next_entry() - Internal function to get the next entry. - * @mas: The maple state - * @limit: The maximum range start. - * - * Set the @mas->node to the next entry and the range_start to - * the beginning value for the entry. Does not check beyond @limit. - * Sets @mas->index and @mas->last to the range, Does not update @mas->index and - * @mas->last on overflow. - * Restarts on dead nodes. - * - * Return: the next entry or %NULL. - */ -static inline void *mas_next_entry(struct ma_state *mas, unsigned long limit) -{ - if (mas->last >= limit) { - mas->status = ma_overflow; - return NULL; - } - - return mas_next_slot(mas, limit, false); -} - /* * mas_rev_awalk() - Internal function. Reverse allocation walk. Find the * highest gap address of a given size in a given node and descend. @@ -6919,7 +6896,7 @@ void *mt_find(struct maple_tree *mt, unsigned long *index, unsigned long max) goto unlock; while (mas_is_active(&mas) && (mas.last < max)) { - entry = mas_next_entry(&mas, max); + entry = mas_next_slot(&mas, max, false); if (likely(entry && !xa_is_zero(entry))) break; }