Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp831163rwb; Thu, 11 Aug 2022 10:37:33 -0700 (PDT) X-Google-Smtp-Source: AA6agR5KDBLghxTpCOUjwzOckU44eoOLYwXqF/rQFyw5ZTXdJqBXaSJIK/L1eAnKPXzAka14xoQ6 X-Received: by 2002:a05:6a00:10d3:b0:4fe:5d:75c8 with SMTP id d19-20020a056a0010d300b004fe005d75c8mr337775pfu.6.1660239452841; Thu, 11 Aug 2022 10:37:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660239452; cv=none; d=google.com; s=arc-20160816; b=zT7pn/h5cAMBwTvVTo6iRtiM766uopzBSfzfzPKg3x+gdub/O/NRFYX2gSlC5Eqklw ctki9sYz8wvNgqVplYwrepkx8DdeijVr75aKePw/1lFUqsls7T+47cPp8rpXQq2SfYxh 5InpOhrIoI95NdlStZMkyNcTJICYWBfudInyEXfSKWnCpEbbJY4nBHGzIpe77HkwZxQq b0OSeCqtOzFszleQqnZJ6ZBushZuUsOnrpZAr1jVVA9Q+lnh3g+XEXrx9M2fbXYmxp7U MQ2qN4/dXzIP1HcuCYvFFTCatJrYYz7gcucoydADI4svbnQbZ1dg2kcH4iP8IQYeLEsD dY6Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:subject:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:cc:to:from:dkim-signature; bh=SgHT/zfKxTbDAmqhpgq66pRNjKFLXPKimkzOnUBsB3Q=; b=eDbxWvKi75rhh4+wz/QACZlZdWc4jmp98+61iFNRZLm0hEaV1H+KTKbzoDroH/hsk7 jY9rqt70YJtY2jh8lZnsqiKWiRDbLuHVsPSEKSUWhuH9QIsxkKKNL7X1nUyFXZTiSuFQ OOp3FKNXVXB0RsJGdoLnr28u+p70JTuNPZGjeUVVG+RjX4hv/z1SxBbO2i3k7s1KO977 FzGKDHkqfNV6qVyw1sLl7dpB0xcwEsTzbvCdmdXavZwxG8N39hyHfZsMkUdRcuPx0r7S Uvj699H7hij8kWXa3v37ibweip/GsiOV5jx6yFyDZ8Aw3kz0Ajs1xkpMUqHyXu0piWb5 IaeA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@deltatee.com header.s=20200525 header.b=CT3gsWB9; 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=deltatee.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g3-20020a170902e38300b00170a75247besi10274604ple.346.2022.08.11.10.37.18; Thu, 11 Aug 2022 10:37:32 -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=@deltatee.com header.s=20200525 header.b=CT3gsWB9; 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=deltatee.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236630AbiHKRTR (ORCPT + 99 others); Thu, 11 Aug 2022 13:19:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53242 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235538AbiHKRSg (ORCPT ); Thu, 11 Aug 2022 13:18:36 -0400 Received: from ale.deltatee.com (ale.deltatee.com [204.191.154.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A9D2699B7D; Thu, 11 Aug 2022 10:14:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=deltatee.com; s=20200525; h=Subject:MIME-Version:References:In-Reply-To: Message-Id:Date:Cc:To:From:content-disposition; bh=SgHT/zfKxTbDAmqhpgq66pRNjKFLXPKimkzOnUBsB3Q=; b=CT3gsWB96MLXcXizgWnaQl7RFN fWcF58gHWIJ13AWjQ2tkOF3/G4DPC3pyG6Ym8twKUUh/32oRa+MWBc8WgkgoMvPUYfmQhN1ZLzHAW npsq3JGtpwRNmMqCcDtMLBzRykbBw7rW5NHlSLzlHO2Vi+tW3YEwM6fKi6CU7ZoTXq2qicCTvbms/ e+su+jq8lmb4FZ4wbf06y1esQfFQMST32BuUl8Klhyr0JhPK76cNO56Bq9BnI5N6ZsOW+845C8nYY vygsLlqFDj1VeZvwbu2GZV8cYOA9IbaB3gV1y+vUHU71PwOusmkV7Pw9frMDwvd17alNaKS7fd+wG FVv5OlQw==; Received: from cgy1-donard.priv.deltatee.com ([172.16.1.31]) by ale.deltatee.com with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1oMBlK-00EAyh-NK; Thu, 11 Aug 2022 11:14:27 -0600 Received: from gunthorp by cgy1-donard.priv.deltatee.com with local (Exim 4.94.2) (envelope-from ) id 1oMBlI-000cRJ-EV; Thu, 11 Aug 2022 11:14:24 -0600 From: Logan Gunthorpe To: linux-kernel@vger.kernel.org, linux-raid@vger.kernel.org, Song Liu Cc: Christoph Hellwig , Guoqing Jiang , Stephen Bates , Martin Oliveira , David Sloan , Logan Gunthorpe Date: Thu, 11 Aug 2022 11:14:17 -0600 Message-Id: <20220811171417.147697-6-logang@deltatee.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220811171417.147697-1-logang@deltatee.com> References: <20220811171417.147697-1-logang@deltatee.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SA-Exim-Connect-IP: 172.16.1.31 X-SA-Exim-Rcpt-To: linux-kernel@vger.kernel.org, linux-raid@vger.kernel.org, song@kernel.org, hch@infradead.org, guoqing.jiang@linux.dev, sbates@raithlin.com, Martin.Oliveira@eideticom.com, David.Sloan@eideticom.com, logang@deltatee.com X-SA-Exim-Mail-From: gunthorp@deltatee.com X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 Subject: [PATCH 5/5] md/raid5: Don't read ->active_stripes if it's not needed X-SA-Exim-Version: 4.2.1 (built Sat, 13 Feb 2021 17:57:42 +0000) X-SA-Exim-Scanned: Yes (on ale.deltatee.com) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The atomic_read() is not needed in many cases so only do the read after the first checks are done. Suggested-by: Christoph Hellwig Signed-off-by: Logan Gunthorpe --- drivers/md/raid5.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index 7e7205bb40f1..0b73eeea1b19 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c @@ -789,15 +789,14 @@ struct stripe_request_ctx { */ static bool is_inactive_blocked(struct r5conf *conf, int hash) { - int active = atomic_read(&conf->active_stripes); - if (list_empty(conf->inactive_list + hash)) return false; if (!test_bit(R5_INACTIVE_BLOCKED, &conf->cache_state)) return true; - return active < (conf->max_nr_stripes * 3 / 4); + return (atomic_read(&conf->active_stripes) < + (conf->max_nr_stripes * 3 / 4)); } struct stripe_head *raid5_get_active_stripe(struct r5conf *conf, -- 2.30.2