From patchwork Wed Apr 20 04:27:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 12819741 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 38478C433FE for ; Wed, 20 Apr 2022 04:28:12 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id BF3CE6B008C; Wed, 20 Apr 2022 00:28:11 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B82056B0092; Wed, 20 Apr 2022 00:28:11 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9F4D46B0093; Wed, 20 Apr 2022 00:28:11 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay.hostedemail.com [64.99.140.27]) by kanga.kvack.org (Postfix) with ESMTP id 8192E6B008C for ; Wed, 20 Apr 2022 00:28:11 -0400 (EDT) Received: from smtpin07.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 5511520A69 for ; Wed, 20 Apr 2022 04:28:11 +0000 (UTC) X-FDA: 79375975182.07.C3A6974 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf31.hostedemail.com (Postfix) with ESMTP id 7DBF020018 for ; Wed, 20 Apr 2022 04:28:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=uBBj2AcJgfyLk5vl6yMy/ZDB6vllaI3H675K6PqOsyQ=; b=1xpyMniEM6uPddNapXYQH3lsrf uQ8FHVFU6epKCrJesM60funTdloGK4Lj38f/1YUlrZYg1jcRYwOcfVvnVra47GgmXLwc2yJk2ngzo 7fJbpKKhqynluq/Slayaraw9Iwdze8UspPcSpx/gp8bI8fxHd5F8lv8cjRkEhk3LOfYjm6nx5PVuv LSHK8XBCCW/amMP33ATMlPAmcUbCCSvbjTf1/GEd44sgb7cEIB30+xzYXKMXnx0t4EL5LheapE++M hbdBeIY3+sWmqLofRleMX/lXHREVYIG3BUXceGwIrzaCOXUAiECsotMux/PsxSxLm4yH3OxIBv5IT TaoAFc3w==; Received: from 089144220023.atnat0029.highway.webapn.at ([89.144.220.23] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1nh1wl-007Fcr-4z; Wed, 20 Apr 2022 04:28:07 +0000 From: Christoph Hellwig To: Jens Axboe Cc: Paolo Valente , Tejun Heo , James Smart , Dick Kennedy , linux-block@vger.kernel.org, cgroups@vger.kernel.org, linux-nvme@lists.infradead.org, linux-mm@kvack.org Subject: [PATCH 13/15] blk-cgroup: cleanup blk_cgroup_congested Date: Wed, 20 Apr 2022 06:27:21 +0200 Message-Id: <20220420042723.1010598-14-hch@lst.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220420042723.1010598-1-hch@lst.de> References: <20220420042723.1010598-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html X-Rspam-User: X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 7DBF020018 X-Stat-Signature: gr94jek3p1hjipsfg595tonirzjhabyc Authentication-Results: imf31.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=1xpyMniE; dmarc=none; spf=none (imf31.hostedemail.com: domain of BATV+4b42fcde86a6810335df+6814+infradead.org+hch@bombadil.srs.infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=BATV+4b42fcde86a6810335df+6814+infradead.org+hch@bombadil.srs.infradead.org X-HE-Tag: 1650428889-716063 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: Use blkcg_css instead of open coding it, and switch to a slightly more natural for loop. Signed-off-by: Christoph Hellwig --- block/blk-cgroup.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c index 8da00ddc1766e..5684a8ce1f755 100644 --- a/block/blk-cgroup.c +++ b/block/blk-cgroup.c @@ -2038,15 +2038,11 @@ bool blk_cgroup_congested(void) bool ret = false; rcu_read_lock(); - css = kthread_blkcg(); - if (!css) - css = task_css(current, io_cgrp_id); - while (css) { + for (css = blkcg_css(); css; css = css->parent) { if (atomic_read(&css->cgroup->congestion_count)) { ret = true; break; } - css = css->parent; } rcu_read_unlock(); return ret;