Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp1189223ybt; Sat, 27 Jun 2020 00:36:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyHe3mXwsTRemrd4VIO85lyr/PPifDaCbuXyK/dAWz5bUOvHikc0w/bqQp8XpwfIL8gZr11 X-Received: by 2002:a05:6402:17ee:: with SMTP id t14mr3988545edy.359.1593243388320; Sat, 27 Jun 2020 00:36:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593243388; cv=none; d=google.com; s=arc-20160816; b=AiYG8kXyJvEz3KYPaKzelY3zF8Dlu4durXzsgBlzeBm281ZVg2wg5suNySmHe2mNxZ V2+Fazc3W1oyRNLbJm6ule0K4tk26DXOTosw9mN99pFXzROSsqCozOzt4cruBTdakxsQ O4TLcX5OTZgZXz6YqHfGaDnDbIuwOVwEQyUWY11qaxbfuQujhEq4ClnUG1RBigMcxJvz EARk4yEqd10AEctKIZ9BQKfaS+ocIi4oF/Cs3cdgm9voa0S9hQzh8JjTZktaSdwnFq6y XcYWzDgrw6D6voeRQyIE2gmD60UAzdb4yduHZJ9xXKyeF+iBBBH+MTi+ByEEiXOgethq jphw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=TotXMoDr4SMB2qAUQWeT1iUDwtwRZjQn0sDaTbNw3KE=; b=KUjRhSHOcjXjcizzIp3az4zlrL3m8UqUKvcurVk1ytglUvwqUlWMN43m0r6pJ/hijQ VimOcICDRt3gx6JC2oRhAGdOIu+QO9hY4LhxFujlTWhuD24W2IC9huKxfszRZOxSDSx8 54uKPTZ+0Eh0Ou2AzpoEYSCs699/ma14rnxXk53DMo3nwtCbd/1KQxMw4zuW9HV1Kr4C idapoj+f8HukEzvci+Ffqi8UyBSXCfrlwTTl3l3H21deb+uPKBQueAaDki8cJdX3TqMB tU8IsUFqwwuhj81Y5u/AL14nhAqs9HW8DwJSgIUq04vMf3GmKGZGPeKj0e9kzspeIt1H xPBQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=casper.20170209 header.b=lBBFTQqt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n24si6103118ejx.544.2020.06.27.00.36.06; Sat, 27 Jun 2020 00:36:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=casper.20170209 header.b=lBBFTQqt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726576AbgF0HdP (ORCPT + 99 others); Sat, 27 Jun 2020 03:33:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59420 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726547AbgF0HdN (ORCPT ); Sat, 27 Jun 2020 03:33:13 -0400 Received: from casper.infradead.org (unknown [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CE510C03E979; Sat, 27 Jun 2020 00:33:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; 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=TotXMoDr4SMB2qAUQWeT1iUDwtwRZjQn0sDaTbNw3KE=; b=lBBFTQqtqPDmKcz4C2xD/zM/hu Lrzy51/shbHq+GN4MpENNU+6yV67bBHqSSioPVy0RchQm5VxOyJgLQP6umNIPnNZ2sR945Vfxjpd/ /hue1Aei3ALd+WQ2tq3K3FcM4HyMRuyCPeIuUQ7cwJigY8EEgTF8r0aD2/qwQt91Vywh+ZIu0toG+ +PkK+1vEPRG9l1s0mKPgGsfxyDttV9haep1R+Uwaj/JQWy5QRXi8xPwioRwTEP/ScYyGwmFxbkJ/c hXdX1GFMy79Vf4ofCFXTs3Pd+ijSmZ0PHxDPNtultydJoEPMMuE9W7sagWDR6VRHNNYHh5ENAddnC YrPOgNRg==; Received: from [2001:4bb8:184:76e3:595:ba65:ae56:65a6] (helo=localhost) by casper.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1jp5KO-0006oz-Bj; Sat, 27 Jun 2020 07:32:46 +0000 From: Christoph Hellwig To: Jens Axboe , Tejun Heo Cc: Dennis Zhou , Li Zefan , Johannes Weiner , dm-devel@redhat.com, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, cgroups@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 12/14] blk-cgroup: move rcu locking from blkcg_bio_issue_check to blk_throtl_bio Date: Sat, 27 Jun 2020 09:31:57 +0200 Message-Id: <20200627073159.2447325-13-hch@lst.de> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200627073159.2447325-1-hch@lst.de> References: <20200627073159.2447325-1-hch@lst.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SRS-Rewrite: SMTP reverse-path rewritten from by casper.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The only thing in blkcg_bio_issue_check that needs to be under rcu_read_lock is blk_throtl_bio, so move the locking there. Signed-off-by: Christoph Hellwig --- block/blk-throttle.c | 3 ++- include/linux/blk-cgroup.h | 2 -- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/block/blk-throttle.c b/block/blk-throttle.c index 209fdd8939fba6..ac008345050010 100644 --- a/block/blk-throttle.c +++ b/block/blk-throttle.c @@ -2168,7 +2168,7 @@ bool blk_throtl_bio(struct request_queue *q, struct blkcg_gq *blkg, bool throttled = false; struct throtl_data *td = tg->td; - WARN_ON_ONCE(!rcu_read_lock_held()); + rcu_read_lock(); /* see throtl_charge_bio() */ if (bio_flagged(bio, BIO_THROTTLED)) @@ -2273,6 +2273,7 @@ bool blk_throtl_bio(struct request_queue *q, struct blkcg_gq *blkg, if (throttled || !td->track_bio_latency) bio->bi_issue.value |= BIO_ISSUE_THROTL_SKIP_LATENCY; #endif + rcu_read_unlock(); return throttled; } diff --git a/include/linux/blk-cgroup.h b/include/linux/blk-cgroup.h index 8e86b598316c10..8ab043c911f233 100644 --- a/include/linux/blk-cgroup.h +++ b/include/linux/blk-cgroup.h @@ -546,7 +546,6 @@ static inline bool blkcg_bio_issue_check(struct request_queue *q, struct blkcg_gq *blkg = bio->bi_blkg; bool throtl = false; - rcu_read_lock(); throtl = blk_throtl_bio(q, blkg, bio); if (!throtl) { struct blkg_iostat_set *bis; @@ -582,7 +581,6 @@ static inline bool blkcg_bio_issue_check(struct request_queue *q, blkcg_bio_issue_init(bio); - rcu_read_unlock(); return !throtl; } -- 2.26.2