linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] blk: do rq_qos_exit in blk_cleanup_queue
@ 2022-02-16 11:32 Wang Jianchao (Kuaishou)
  2022-02-16 18:25 ` Bart Van Assche
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Wang Jianchao (Kuaishou) @ 2022-02-16 11:32 UTC (permalink / raw)
  To: Jens Axboe; +Cc: hch, Bart Van Assche, linux-block, linux-kernel

From: Wang Jianchao <wangjianchao@kuaishou.com>

When __alloc_disk_node() failed, there will not not del_gendisk()
any more, then resource in rqos policies is leaked. Add rq_qos_exit()
into blk_cleanup_queue(). rqos is removed from the list, so needn't
to worry .exit is called twice.

Fixes: commit 8e141f9eb803 ("block: drain file system I/O on del_gendisk")
Suggested-by: Bart Van Assche <bart.vanassche@wdc.com>
Signed-off-by: Wang Jianchao <wangjianchao@kuaishou.com>
---
 block/blk-core.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/block/blk-core.c b/block/blk-core.c
index d93e3bb9a769..108c7207d048 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -50,6 +50,7 @@
 #include "blk-mq-sched.h"
 #include "blk-pm.h"
 #include "blk-throttle.h"
+#include "blk-rq-qos.h"
 
 struct dentry *blk_debugfs_root;
 
@@ -322,6 +323,8 @@ void blk_cleanup_queue(struct request_queue *q)
 
 	blk_queue_flag_set(QUEUE_FLAG_DEAD, q);
 
+	rq_qos_exit(q);
+
 	blk_sync_queue(q);
 	if (queue_is_mq(q)) {
 		blk_mq_cancel_work_sync(q);
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH] blk: do rq_qos_exit in blk_cleanup_queue
  2022-02-16 11:32 [PATCH] blk: do rq_qos_exit in blk_cleanup_queue Wang Jianchao (Kuaishou)
@ 2022-02-16 18:25 ` Bart Van Assche
  2022-02-17  2:40 ` Jens Axboe
  2022-02-17  7:48 ` Christoph Hellwig
  2 siblings, 0 replies; 8+ messages in thread
From: Bart Van Assche @ 2022-02-16 18:25 UTC (permalink / raw)
  To: Wang Jianchao (Kuaishou), Jens Axboe; +Cc: hch, linux-block, linux-kernel

On 2/16/22 03:32, Wang Jianchao (Kuaishou) wrote:
> From: Wang Jianchao <wangjianchao@kuaishou.com>
> 
> When __alloc_disk_node() failed, there will not not del_gendisk()

Please use the present tense for patch descriptions (failed -> fails).

Anyway:

Reviewed-by: Bart Van Assche <bvanassche@acm.org>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] blk: do rq_qos_exit in blk_cleanup_queue
  2022-02-16 11:32 [PATCH] blk: do rq_qos_exit in blk_cleanup_queue Wang Jianchao (Kuaishou)
  2022-02-16 18:25 ` Bart Van Assche
@ 2022-02-17  2:40 ` Jens Axboe
  2022-02-17  7:48 ` Christoph Hellwig
  2 siblings, 0 replies; 8+ messages in thread
From: Jens Axboe @ 2022-02-17  2:40 UTC (permalink / raw)
  To: Wang Jianchao (Kuaishou); +Cc: linux-block, hch, linux-kernel, Bart Van Assche

On Wed, 16 Feb 2022 19:32:12 +0800, Wang Jianchao (Kuaishou) wrote:
> From: Wang Jianchao <wangjianchao@kuaishou.com>
> 
> When __alloc_disk_node() failed, there will not not del_gendisk()
> any more, then resource in rqos policies is leaked. Add rq_qos_exit()
> into blk_cleanup_queue(). rqos is removed from the list, so needn't
> to worry .exit is called twice.
> 
> [...]

Applied, thanks!

[1/1] blk: do rq_qos_exit in blk_cleanup_queue
      commit: 20d41d9e993735b996175d087148d9de1fc94ac0

Best regards,
-- 
Jens Axboe



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] blk: do rq_qos_exit in blk_cleanup_queue
  2022-02-16 11:32 [PATCH] blk: do rq_qos_exit in blk_cleanup_queue Wang Jianchao (Kuaishou)
  2022-02-16 18:25 ` Bart Van Assche
  2022-02-17  2:40 ` Jens Axboe
@ 2022-02-17  7:48 ` Christoph Hellwig
  2022-02-17 13:34   ` Jens Axboe
  2 siblings, 1 reply; 8+ messages in thread
From: Christoph Hellwig @ 2022-02-17  7:48 UTC (permalink / raw)
  To: Wang Jianchao (Kuaishou)
  Cc: Jens Axboe, hch, Bart Van Assche, linux-block, linux-kernel

On Wed, Feb 16, 2022 at 07:32:12PM +0800, Wang Jianchao (Kuaishou) wrote:
> From: Wang Jianchao <wangjianchao@kuaishou.com>
> 
> When __alloc_disk_node() failed, there will not not del_gendisk()
> any more, then resource in rqos policies is leaked. Add rq_qos_exit()
> into blk_cleanup_queue(). rqos is removed from the list, so needn't
> to worry .exit is called twice.
> 
> Fixes: commit 8e141f9eb803 ("block: drain file system I/O on del_gendisk")
> Suggested-by: Bart Van Assche <bart.vanassche@wdc.com>
> Signed-off-by: Wang Jianchao <wangjianchao@kuaishou.com>

Ming had a pending patch to move it into disk_release instead, which
I think is the right place.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] blk: do rq_qos_exit in blk_cleanup_queue
  2022-02-17  7:48 ` Christoph Hellwig
@ 2022-02-17 13:34   ` Jens Axboe
  2022-02-17 14:03     ` Christoph Hellwig
  0 siblings, 1 reply; 8+ messages in thread
From: Jens Axboe @ 2022-02-17 13:34 UTC (permalink / raw)
  To: Christoph Hellwig, Wang Jianchao (Kuaishou)
  Cc: Bart Van Assche, linux-block, linux-kernel

On 2/17/22 12:48 AM, Christoph Hellwig wrote:
> On Wed, Feb 16, 2022 at 07:32:12PM +0800, Wang Jianchao (Kuaishou) wrote:
>> From: Wang Jianchao <wangjianchao@kuaishou.com>
>>
>> When __alloc_disk_node() failed, there will not not del_gendisk()
>> any more, then resource in rqos policies is leaked. Add rq_qos_exit()
>> into blk_cleanup_queue(). rqos is removed from the list, so needn't
>> to worry .exit is called twice.
>>
>> Fixes: commit 8e141f9eb803 ("block: drain file system I/O on del_gendisk")
>> Suggested-by: Bart Van Assche <bart.vanassche@wdc.com>
>> Signed-off-by: Wang Jianchao <wangjianchao@kuaishou.com>
> 
> Ming had a pending patch to move it into disk_release instead, which
> I think is the right place.

I missed that patch and can't seem to find it, do you have a link?

-- 
Jens Axboe


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] blk: do rq_qos_exit in blk_cleanup_queue
  2022-02-17 13:34   ` Jens Axboe
@ 2022-02-17 14:03     ` Christoph Hellwig
  2022-02-17 14:55       ` Jens Axboe
  0 siblings, 1 reply; 8+ messages in thread
From: Christoph Hellwig @ 2022-02-17 14:03 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Christoph Hellwig, Wang Jianchao (Kuaishou),
	Bart Van Assche, linux-block, linux-kernel

On Thu, Feb 17, 2022 at 06:34:02AM -0700, Jens Axboe wrote:
> On 2/17/22 12:48 AM, Christoph Hellwig wrote:
> > On Wed, Feb 16, 2022 at 07:32:12PM +0800, Wang Jianchao (Kuaishou) wrote:
> >> From: Wang Jianchao <wangjianchao@kuaishou.com>
> >>
> >> When __alloc_disk_node() failed, there will not not del_gendisk()
> >> any more, then resource in rqos policies is leaked. Add rq_qos_exit()
> >> into blk_cleanup_queue(). rqos is removed from the list, so needn't
> >> to worry .exit is called twice.
> >>
> >> Fixes: commit 8e141f9eb803 ("block: drain file system I/O on del_gendisk")
> >> Suggested-by: Bart Van Assche <bart.vanassche@wdc.com>
> >> Signed-off-by: Wang Jianchao <wangjianchao@kuaishou.com>
> > 
> > Ming had a pending patch to move it into disk_release instead, which
> > I think is the right place.
> 
> I missed that patch and can't seem to find it, do you have a link?

[PATCH V2 12/13] block: move rq_qos_exit() into disk_release()

from Jan 22.  Although it would need a rebase so it can be applied
without the preceding patches.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] blk: do rq_qos_exit in blk_cleanup_queue
  2022-02-17 14:03     ` Christoph Hellwig
@ 2022-02-17 14:55       ` Jens Axboe
  2022-02-17 15:48         ` Christoph Hellwig
  0 siblings, 1 reply; 8+ messages in thread
From: Jens Axboe @ 2022-02-17 14:55 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Wang Jianchao (Kuaishou), Bart Van Assche, linux-block, linux-kernel

On 2/17/22 7:03 AM, Christoph Hellwig wrote:
> On Thu, Feb 17, 2022 at 06:34:02AM -0700, Jens Axboe wrote:
>> On 2/17/22 12:48 AM, Christoph Hellwig wrote:
>>> On Wed, Feb 16, 2022 at 07:32:12PM +0800, Wang Jianchao (Kuaishou) wrote:
>>>> From: Wang Jianchao <wangjianchao@kuaishou.com>
>>>>
>>>> When __alloc_disk_node() failed, there will not not del_gendisk()
>>>> any more, then resource in rqos policies is leaked. Add rq_qos_exit()
>>>> into blk_cleanup_queue(). rqos is removed from the list, so needn't
>>>> to worry .exit is called twice.
>>>>
>>>> Fixes: commit 8e141f9eb803 ("block: drain file system I/O on del_gendisk")
>>>> Suggested-by: Bart Van Assche <bart.vanassche@wdc.com>
>>>> Signed-off-by: Wang Jianchao <wangjianchao@kuaishou.com>
>>>
>>> Ming had a pending patch to move it into disk_release instead, which
>>> I think is the right place.
>>
>> I missed that patch and can't seem to find it, do you have a link?
> 
> [PATCH V2 12/13] block: move rq_qos_exit() into disk_release()
> 
> from Jan 22.  Although it would need a rebase so it can be applied
> without the preceding patches.

Can someone respin that for 5.17 then?

-- 
Jens Axboe


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] blk: do rq_qos_exit in blk_cleanup_queue
  2022-02-17 14:55       ` Jens Axboe
@ 2022-02-17 15:48         ` Christoph Hellwig
  0 siblings, 0 replies; 8+ messages in thread
From: Christoph Hellwig @ 2022-02-17 15:48 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Christoph Hellwig, Wang Jianchao (Kuaishou),
	Bart Van Assche, linux-block, linux-kernel

On Thu, Feb 17, 2022 at 07:55:16AM -0700, Jens Axboe wrote:
> > from Jan 22.  Although it would need a rebase so it can be applied
> > without the preceding patches.
> 
> Can someone respin that for 5.17 then?

I looked at it and it I don't think we can do that without a lot of
the prep patches.

That being said I think this version of the patch also is buggy, we
want the policies shut down in del_gendisk with the queue frozen for
normal operation.

I guess until we can move the initialization and teardown entirely
to the gendisk as in Ming's more complex series we need to keep the
call in del_gendisk and also do it in blk_cleanup_queue.  For the
normal shutdown on disk that were life del_gendisk does the all the
work on the frozen queue, while for queues that never had a disk
blk_cleanup_queue will clean up the unused rq_qos.

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2022-02-17 15:48 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-16 11:32 [PATCH] blk: do rq_qos_exit in blk_cleanup_queue Wang Jianchao (Kuaishou)
2022-02-16 18:25 ` Bart Van Assche
2022-02-17  2:40 ` Jens Axboe
2022-02-17  7:48 ` Christoph Hellwig
2022-02-17 13:34   ` Jens Axboe
2022-02-17 14:03     ` Christoph Hellwig
2022-02-17 14:55       ` Jens Axboe
2022-02-17 15:48         ` Christoph Hellwig

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).