Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp753287rdb; Fri, 8 Sep 2023 15:43:59 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE1qqCaVNA5soPGCLDmtsPX4spt3N8yLzR4YLE1Z1PwuyoWM2y08CkBuNnKL/TDDyX7XWYd X-Received: by 2002:a17:902:da91:b0:1bd:f69e:a407 with SMTP id j17-20020a170902da9100b001bdf69ea407mr9979306plx.8.1694213038684; Fri, 08 Sep 2023 15:43:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694213038; cv=none; d=google.com; s=arc-20160816; b=Tzyid5EoVH/SMpXTo397gE5VPPJEtpS1QBLNK+tUJZ8B85y2Wh6W+Cgm4GaB+CILB2 SDwM5zbX3eXcwdkG+LXVgWM+SQo0kjaHST1mYTae0lwfl/XvjWO3NmGfmVd4PjcNtrwZ ojzFtTYDikbgmOJHhXMhd6Lxnjx98NzYgVXc0KbMprJfM4btgWHRiQP9lQf4AV7ch/mU LMisLNG+RwzQuOFDzdqrbBONXO7DBjueOPxaKldHvwehgJs6axP3I9brBYwH02X8bf7N mUW+SVGT4k/TKdkFzXRyZiYJdZ5hDHChJmme+fU3XBe5p2ovM0bImENGSN2cbeX25RGI /9Kw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=blMzM4L7KTCta+RIVTUa9dZqKyvOL2v1f6wRkRwQg2E=; fh=PM0GxARnY2fq++lmnFr5zDtgNQoaxnNKf1FrSBSd8Ck=; b=ogAXh6te2C3AQSoIpylAZQXvtRZiPKqQ9JJeF4WFU7JBV0tYWEMJuNyKwPRGNEkcab WPTOdF/bUwne9UOcxEjHGblfUF0oLeBqMm++s7jkBbCZLvyQL5VHSFtdTg913uI+2iza vq/stUtKmv7Ba+Vr7GSXaRCHzK2Ge9pJC54M8q2dMD7g5nEqdiQxXlrf+BK7I/HJm0Rn Auk9gSIwzSQkmX+1r6M7Adt6DszXe8k8YMPBubeudZPIgH0h6UtP4NrTglof14Ym/N3+ 27187q+mWqf56ql+knxVhF8WbUfDC+Yv9kYPjlrV52lU9iZTudeddmoibnoGbs+CXU0h Dqkg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Y4r72CYf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x184-20020a6386c1000000b005648d20203dsi2030797pgd.233.2023.09.08.15.43.45; Fri, 08 Sep 2023 15:43:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Y4r72CYf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343900AbjIHUgW (ORCPT + 99 others); Fri, 8 Sep 2023 16:36:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45834 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233048AbjIHUgT (ORCPT ); Fri, 8 Sep 2023 16:36:19 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EE9B18E; Fri, 8 Sep 2023 13:36:15 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5FAD2C433C9; Fri, 8 Sep 2023 20:36:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1694205375; bh=mvgQfp1WaBcpfDTbCSVaFFlPEh1S9we854LIGmy5oWI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Y4r72CYfP8k8zha0VpGBOejgR2oZO5edDsBWsrRayIRwLTkKan/Bok+LpSDI/XWhb VwZYpRvFGYHMJKeGSBriUO30SdFeoL/e9fkvpVrR5YJSosGikFTaSK6Y1xocgPdg2R q66JaD+h4tZs+qql4yWrI2R6+L18dtGn6F+fQjNWx6Ko2WGX65fQHv1vetYyDn+mip YhwtStSj0EtCEqjxkN0Bo6nipse8R5mWnImjlpQDw/jYrNFdWyE93nO/sMVqT9Op8/ JXnhXp0iSo1NB/wwLfbkN5yAHL9PQu29JQiZn8lhZTV1lcB2yK66RAzos/j/zJZwOl I78RcKSLfvNkA== From: Frederic Weisbecker To: "Paul E . McKenney" Cc: LKML , Frederic Weisbecker , rcu , Uladzislau Rezki , Neeraj Upadhyay , Boqun Feng , Qiuxu Zhuo , Joel Fernandes Subject: [PATCH 01/10] rcu: Use rcu_segcblist_segempty() instead of open coding it Date: Fri, 8 Sep 2023 22:35:54 +0200 Message-ID: <20230908203603.5865-2-frederic@kernel.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230908203603.5865-1-frederic@kernel.org> References: <20230908203603.5865-1-frederic@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This makes the code more readable. Reviewed-by: Qiuxu Zhuo Reviewed-by: Joel Fernandes (Google) Signed-off-by: Frederic Weisbecker --- kernel/rcu/rcu_segcblist.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kernel/rcu/rcu_segcblist.c b/kernel/rcu/rcu_segcblist.c index f71fac422c8f..1693ea22ef1b 100644 --- a/kernel/rcu/rcu_segcblist.c +++ b/kernel/rcu/rcu_segcblist.c @@ -368,7 +368,7 @@ bool rcu_segcblist_entrain(struct rcu_segcblist *rsclp, smp_mb(); /* Ensure counts are updated before callback is entrained. */ rhp->next = NULL; for (i = RCU_NEXT_TAIL; i > RCU_DONE_TAIL; i--) - if (rsclp->tails[i] != rsclp->tails[i - 1]) + if (!rcu_segcblist_segempty(rsclp, i)) break; rcu_segcblist_inc_seglen(rsclp, i); WRITE_ONCE(*rsclp->tails[i], rhp); @@ -551,7 +551,7 @@ bool rcu_segcblist_accelerate(struct rcu_segcblist *rsclp, unsigned long seq) * as their ->gp_seq[] grace-period completion sequence number. */ for (i = RCU_NEXT_READY_TAIL; i > RCU_DONE_TAIL; i--) - if (rsclp->tails[i] != rsclp->tails[i - 1] && + if (!rcu_segcblist_segempty(rsclp, i) && ULONG_CMP_LT(rsclp->gp_seq[i], seq)) break; -- 2.41.0