From patchwork Sat Aug 31 00:10:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yang X-Patchwork-Id: 13785723 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 97315CA101A for ; Sat, 31 Aug 2024 00:11:27 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 67B9A8D0011; Fri, 30 Aug 2024 20:11:26 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 58FBB8D0002; Fri, 30 Aug 2024 20:11:26 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 393AB8D0011; Fri, 30 Aug 2024 20:11:26 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 0A7F38D0002 for ; Fri, 30 Aug 2024 20:11:26 -0400 (EDT) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 92D3EC0717 for ; Sat, 31 Aug 2024 00:11:25 +0000 (UTC) X-FDA: 82510611330.26.7E110DF Received: from mail-ej1-f53.google.com (mail-ej1-f53.google.com [209.85.218.53]) by imf04.hostedemail.com (Postfix) with ESMTP id C3AEA40020 for ; Sat, 31 Aug 2024 00:11:23 +0000 (UTC) Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=BGFV9Lci; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf04.hostedemail.com: domain of richard.weiyang@gmail.com designates 209.85.218.53 as permitted sender) smtp.mailfrom=richard.weiyang@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1725063062; a=rsa-sha256; cv=none; b=miHYEpsGc8Vcy9knn+l9FU+xu0B88ffktbuP6UtOiU1sxAvnDo2V2raCWufSBAAduks529 6fkqvU8F3ABZ6bWUxhoeodMeRCdCrJm9VVJPAw8jHLBC4qkkYACgMRMtDSYfKga29xNlLD jpXXhXLuqHLELRSonG5TkOG/u/OJG8Q= ARC-Authentication-Results: i=1; imf04.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=BGFV9Lci; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf04.hostedemail.com: domain of richard.weiyang@gmail.com designates 209.85.218.53 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=1725063062; 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=BNiQtbDNNf8A/Mj7fgmircx+5iCql02mBDuIFqsXGyE=; b=csbCoBEREXJMqwaPFw5GydVXEvZLfX7KubHdfGuTr5iUdlZn0H12OuZ7m4ciqXq+NYBKjU vi8xDLIM9kQIzcmQgVkl7a1n0A1WMYLC3T/KxMEVdstADlkgKJISeNqDtD7O5o31EQkGBk wWau6FGlQHBljnlKDVmV3MN3YDPEOUQ= Received: by mail-ej1-f53.google.com with SMTP id a640c23a62f3a-a8683dc3b17so143170266b.3 for ; Fri, 30 Aug 2024 17:11:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1725063082; x=1725667882; 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=BNiQtbDNNf8A/Mj7fgmircx+5iCql02mBDuIFqsXGyE=; b=BGFV9Lci6D1Mtvy5D+YpRHeClaUAXbSlKKJHNFwsMRvFT6JTWXqbSRIkWnwlVF2D1Q oEYIghjCOTRfLGaIp/wqFDydYgj56/m6oG45Iit7Rh1gVlsTMChxgKFce/x9HoAy+gF5 c5yQfaT4kekemIxTWe7jXaiOSoz3EVgpQQ9cproQOmnSJyJVDDMBTjI93/bqFyItE597 kgkgUrxPIAvr0BXmiQXkUHFYy4+eu9glIXNwhBAVjTlDOajHMr+ElqwG3S+OawYnT8sE PsmeGmQ6Uioh8zYADkF9BhlCqa/sL9Bx8sN9anuzJKkoB0LdKx3EJwLTNYxdZ+qQIPdg WtVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725063082; x=1725667882; 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=BNiQtbDNNf8A/Mj7fgmircx+5iCql02mBDuIFqsXGyE=; b=WXv+ifTBcLc77S1rBGBbokfsKk/Kzsw2+d9sb2LZbhTDCkO7KhImTCap3qjdit4QrW qBTamqwjxAEQZLFL/JJklYeqmyru0TIuRCCAsMbAFx+F1x49x1jANhowJUDp20irsyPY vz1wCZfzhwXS96FJcKVXimJ35wP4/6lsuGyksMZIGtF5zm1Kxqs3EAUtJDKdkQ0sCORn 2BrsIU7d9rl7NpLBBIibGKW1PCT7uVkfu9k7M7qLJaFsDrjIJDK9RWx+infbura822IG izMQbrue+pmNgzhsCWJke+HlrEE//JIqCTEjsyz3rrbYjjmmDb8zJ45i1Gyei7TkDeJu srGw== X-Forwarded-Encrypted: i=1; AJvYcCUIC+gBi3Q0amsKJcZbWrh3g89VWBOV1lGfXoMM6yBTBaFonOgr39POP6NzprIyQLR6rO2mAEzFyw==@kvack.org X-Gm-Message-State: AOJu0YwOIjuIkwV3+4yEHsgHBvKxg2bPmgi/uJ8T7gI24yjF0Z+TlIfv Xmc91+mpfgdrBJYEJ74C5Z3Nopz0/Hx/VB9MSUQsnauMvJ0hUXrc X-Google-Smtp-Source: AGHT+IHwczwFkM5glz7zfQTjlY059zjrO3HhzqBkp3Z9Zf1UeJ/QXdmz/uSDZyXRZEKxERVGU1ZBEA== X-Received: by 2002:a05:6402:1e88:b0:5bf:17f:4b7f with SMTP id 4fb4d7f45d1cf-5c21ed54d13mr7658987a12.22.1725063082110; Fri, 30 Aug 2024 17:11:22 -0700 (PDT) Received: from localhost ([185.92.221.13]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5c226cd18a3sm2398376a12.66.2024.08.30.17.11.20 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 30 Aug 2024 17:11:21 -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 Subject: [PATCH 3/3] maple_tree: local variable 'count' is not necessary Date: Sat, 31 Aug 2024 00:10:53 +0000 Message-Id: <20240831001053.4751-3-richard.weiyang@gmail.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20240831001053.4751-1-richard.weiyang@gmail.com> References: <20240831001053.4751-1-richard.weiyang@gmail.com> X-Rspam-User: X-Rspamd-Queue-Id: C3AEA40020 X-Rspamd-Server: rspam01 X-Stat-Signature: 9rx9fi9m7jbcamwtaaze5p9eoqqkrxdn X-HE-Tag: 1725063083-123184 X-HE-Meta: U2FsdGVkX1+/H8bMr4EcusqUrPKwyPnWsnhbG3C3JV3qMPIbiNqU8fbopVzB1X2bi08a0S20LLWgGY7ikIM9O1vPRC2Tae32sfRadI4lnNrgcOG+rUk9Jm3nwXDEb1EmFtruLpFasHDvwRJc6PJjkEJckj3WVCfBEV+CwQLgfvoBUi/Xgdl7mLqifrUOjLShTH4rsgQNgrP41gGgBGCUQnbRVtGyl2RGrJgFVFxrsccqOhPt1ITu0zYGak0FRGhpbfJdsuNMWXQZ6wpt38xSJJp0vk/aktfJ8DzKi3vdGAMDXiygdWvtYcVOqlz5NV6sq407htX400p3aDeXR0PkU4Jdy9Z9/VBUtiHEUOy0ysnZRMQyL4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/ZbzrP6IsWEPaB4JQSmLJPCPNj2MfVVJ6wM4nQKOQD5b5uc0= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000012, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: 'count' is never changed after assignment and it looks a little more direct to use mas->end to locate the offset. Also ma_data_end() returns slot index instead of count. Signed-off-by: Wei Yang --- lib/maple_tree.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/maple_tree.c b/lib/maple_tree.c index 17533c246749..dda8e292c25b 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -2168,7 +2168,7 @@ static inline void mas_node_or_none(struct ma_state *mas, static inline void mas_wr_node_walk(struct ma_wr_state *wr_mas) { struct ma_state *mas = wr_mas->mas; - unsigned char count, offset; + unsigned char offset; if (unlikely(ma_is_dense(wr_mas->type))) { wr_mas->r_max = wr_mas->r_min = mas->index; @@ -2178,11 +2178,11 @@ static inline void mas_wr_node_walk(struct ma_wr_state *wr_mas) wr_mas->node = mas_mn(wr_mas->mas); wr_mas->pivots = ma_pivots(wr_mas->node, wr_mas->type); - count = mas->end = ma_data_end(wr_mas->node, wr_mas->type, + mas->end = ma_data_end(wr_mas->node, wr_mas->type, wr_mas->pivots, mas->max); offset = mas->offset; - while (offset < count && mas->index > wr_mas->pivots[offset]) + while (offset < mas->end && mas->index > wr_mas->pivots[offset]) offset++; wr_mas->r_max = mas_safe_pivot(mas, wr_mas->pivots, offset, wr_mas->type);