From mboxrd@z Thu Jan 1 00:00:00 1970 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 65285C25B4E for ; Tue, 24 Jan 2023 06:57:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233345AbjAXG5Y (ORCPT ); Tue, 24 Jan 2023 01:57:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37746 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231599AbjAXG5X (ORCPT ); Tue, 24 Jan 2023 01:57:23 -0500 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 21D2B36FC7; Mon, 23 Jan 2023 22:57:23 -0800 (PST) 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=30NLUDFY6LwZkFlJss4wE81ByRWLz/1+fz+0qS7Tg/s=; b=fr+cpc3Un7SR+MPks821I9do58 4gvK6XD7UwBOfLrsYQrp3od3butIZSOmtLLOvXIL8Om/vErdYLTCwegnRDH3s7H1cDE0h5YQewKWs L5IW1drnvQxnB5ecRuA8IHCMELafyXHiDEwqi/ONMr2hL6CbbKReaebCVGP76S8zGpoSSXbzPuQDX fYh/KKahuSfQ2SbgzXF9e/Dv/l1+b0ztaXQc3Rs8LnebFukkL9GJNvTcdbRHORaOtIJ3hNhsDDkc5 Pi6Ov3Opx2CQdlCKTwS8T74vgFE4GSQcF58WTS9F04yTCImoCfgCC51MXTugYi8m2lMKrfwyPvU5u zQ+XqFUw==; Received: from [2001:4bb8:19a:27af:ea4c:1aa8:8f64:2866] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1pKDFA-002aQS-T0; Tue, 24 Jan 2023 06:57:21 +0000 From: Christoph Hellwig To: Jens Axboe , Tejun Heo , Josef Bacik Cc: linux-block@vger.kernel.org, cgroups@vger.kernel.org, Andreas Herrmann Subject: [PATCH 01/15] blk-cgroup: don't defer blkg_free to a workqueue Date: Tue, 24 Jan 2023 07:57:01 +0100 Message-Id: <20230124065716.152286-2-hch@lst.de> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230124065716.152286-1-hch@lst.de> References: <20230124065716.152286-1-hch@lst.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Now that blk_put_queue can be called from process context, there is no need for the asynchronous execution. This effectively reverts commit d578c770c85233af592e54537f93f3831bde7e9a. Signed-off-by: Christoph Hellwig Reviewed-by: Andreas Herrmann --- block/blk-cgroup.c | 32 ++++++++++---------------------- block/blk-cgroup.h | 5 +---- 2 files changed, 11 insertions(+), 26 deletions(-) diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c index ce6a2b7d3dfb2b..30d493b43f9272 100644 --- a/block/blk-cgroup.c +++ b/block/blk-cgroup.c @@ -114,12 +114,19 @@ static bool blkcg_policy_enabled(struct request_queue *q, return pol && test_bit(pol->plid, q->blkcg_pols); } -static void blkg_free_workfn(struct work_struct *work) +/** + * blkg_free - free a blkg + * @blkg: blkg to free + * + * Free @blkg which may be partially allocated. + */ +static void blkg_free(struct blkcg_gq *blkg) { - struct blkcg_gq *blkg = container_of(work, struct blkcg_gq, - free_work); int i; + if (!blkg) + return; + for (i = 0; i < BLKCG_MAX_POLS; i++) if (blkg->pd[i]) blkcg_policy[i]->pd_free_fn(blkg->pd[i]); @@ -131,25 +138,6 @@ static void blkg_free_workfn(struct work_struct *work) kfree(blkg); } -/** - * blkg_free - free a blkg - * @blkg: blkg to free - * - * Free @blkg which may be partially allocated. - */ -static void blkg_free(struct blkcg_gq *blkg) -{ - if (!blkg) - return; - - /* - * Both ->pd_free_fn() and request queue's release handler may - * sleep, so free us by scheduling one work func - */ - INIT_WORK(&blkg->free_work, blkg_free_workfn); - schedule_work(&blkg->free_work); -} - static void __blkg_release(struct rcu_head *rcu) { struct blkcg_gq *blkg = container_of(rcu, struct blkcg_gq, rcu_head); diff --git a/block/blk-cgroup.h b/block/blk-cgroup.h index 1e94e404eaa80a..f126fe36001eb3 100644 --- a/block/blk-cgroup.h +++ b/block/blk-cgroup.h @@ -75,10 +75,7 @@ struct blkcg_gq { spinlock_t async_bio_lock; struct bio_list async_bios; - union { - struct work_struct async_bio_work; - struct work_struct free_work; - }; + struct work_struct async_bio_work; atomic_t use_delay; atomic64_t delay_nsec; -- 2.39.0