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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0FE59C433FE for ; Mon, 24 Jan 2022 23:39:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=abuo63c9unbIB0KgOA6si3wexVgqwYUCClSGn9/4mcM=; b=NsVMUpA63fWjFugfGZzVkjj2vO meaI1wQmSBB1RkiH1qdqXNoFZOwtDvD1DeCTBU4EevwNRJN108gqMtseGMq822nBvIqoOoub2O0pD q9wIr0BxBpW0OmlLkro0rpOu7A61owOEtnRhXbgvffJW12BIdvbNUp3Zoyqw0TNJcS/xsNtdexUly F3cKFnViZ2rKJ9s9GwtxHAcenRWVH3CQQn5X6Vq7NsvDSdG718cnbRBcvhDUeGS7RqnbtTU3Bskl9 U4MDG3pSeAYowE5xX7um6jXl0VeihZIQGVkj9a3bcpi20s3tARXKzu09RUtOAmymmikicDN1n153M uTl+T7OQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nC8vK-005bUI-Dp; Mon, 24 Jan 2022 23:38:58 +0000 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nC8vI-005bTi-0c for linux-nvme@lists.infradead.org; Mon, 24 Jan 2022 23:38:57 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1643067534; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=abuo63c9unbIB0KgOA6si3wexVgqwYUCClSGn9/4mcM=; b=D7Zk2JIWEYojX8zqmf8UUoeoKw6fpKlRNq5w/kB1xyuwDniO6oTnkI7wEMiABvrNxJDfx4 UPaX2EBcLRnfn4P44WsZnGm+ZhKj0TCc8+GJeSb6OMGAACgAQt78eM/hiJu/0EQItd384R PoXEa5y9Lz9dQXdZc+DFCkHU4cVNUAg= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-513-Yas22mTvPOmM9X3495v9DA-1; Mon, 24 Jan 2022 18:38:51 -0500 X-MC-Unique: Yas22mTvPOmM9X3495v9DA-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 9D6501083F60; Mon, 24 Jan 2022 23:38:49 +0000 (UTC) Received: from T590 (ovpn-8-21.pek2.redhat.com [10.72.8.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 136BC56F83; Mon, 24 Jan 2022 23:38:39 +0000 (UTC) Date: Tue, 25 Jan 2022 07:38:34 +0800 From: Ming Lei To: Christoph Hellwig Cc: Jens Axboe , "Martin K . Petersen" , linux-block@vger.kernel.org, linux-nvme@lists.infradead.org, linux-scsi@vger.kernel.org Subject: Re: [PATCH V2 11/13] block: move blk_exit_queue into disk_release Message-ID: References: <20220122111054.1126146-1-ming.lei@redhat.com> <20220122111054.1126146-12-ming.lei@redhat.com> <20220124132221.GJ27269@lst.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220124132221.GJ27269@lst.de> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220124_153856_151911_B1AC14D8 X-CRM114-Status: GOOD ( 25.08 ) X-BeenThere: linux-nvme@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-nvme" Errors-To: linux-nvme-bounces+linux-nvme=archiver.kernel.org@lists.infradead.org On Mon, Jan 24, 2022 at 02:22:21PM +0100, Christoph Hellwig wrote: > On Sat, Jan 22, 2022 at 07:10:52PM +0800, Ming Lei wrote: > > 3 files changed, 41 insertions(+), 17 deletions(-) > > > > diff --git a/block/blk-mq.c b/block/blk-mq.c > > index d51b0aa2e4e4..72ae9955cf27 100644 > > --- a/block/blk-mq.c > > +++ b/block/blk-mq.c > > @@ -3101,6 +3101,9 @@ void blk_mq_free_rqs(struct blk_mq_tag_set *set, struct blk_mq_tags *tags, > > struct blk_mq_tags *drv_tags; > > struct page *page; > > > > + if (list_empty(&tags->page_list)) > > + return; > > Please split this out and document why it is needed. Now blk_mq_sched_free_rqs() can be called from either blk_cleanup_queue and disk_release(). If sched rq pool is freed in one of them, it can't to be freed from another one. > > > +/* Unconfigure the I/O scheduler and dissociate from the cgroup controller. */ > > +static void blk_exit_queue(struct request_queue *q) > > +{ > > + /* > > + * Since the I/O scheduler exit code may access cgroup information, > > + * perform I/O scheduler exit before disassociating from the block > > + * cgroup controller. > > + */ > > + if (q->elevator) { > > + ioc_clear_queue(q); > > + > > + mutex_lock(&q->sysfs_lock); > > + blk_mq_sched_free_rqs(q); > > + elevator_exit(q); > > + mutex_unlock(&q->sysfs_lock); > > + } > > +} > > Given that this all deals with the I/O scheduler the naming seems > wrong. It almost seems like we'd want to move ioc_clear_queue and > blk_mq_sched_free_rqs into elevator_exit to have somewhat sensible > helpers. Looks good idea. thanks, Ming