* [PATCH] blk-mq: only alloc hctx point as many as nr_hw_queues
@ 2017-07-13 16:10 weiping zhang
2017-07-13 16:14 ` Jens Axboe
0 siblings, 1 reply; 4+ messages in thread
From: weiping zhang @ 2017-07-13 16:10 UTC (permalink / raw)
To: axboe; +Cc: linux-block
one hw queue only has one hctx, reduce it's number same as nr_hw_queues.
Signed-off-by: weiping zhang <zhangweiping@didichuxing.com>
---
block/blk-mq.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/block/blk-mq.c b/block/blk-mq.c
index 05dfa3f..8c98f59 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -2320,8 +2320,8 @@ struct request_queue *blk_mq_init_allocated_queue(struct blk_mq_tag_set *set,
/* init q->mq_kobj and sw queues' kobjects */
blk_mq_sysfs_init(q);
- q->queue_hw_ctx = kzalloc_node(nr_cpu_ids * sizeof(*(q->queue_hw_ctx)),
- GFP_KERNEL, set->numa_node);
+ q->queue_hw_ctx = kzalloc_node(set->nr_hw_queues *
+ sizeof(*(q->queue_hw_ctx)),GFP_KERNEL, set->numa_node);
if (!q->queue_hw_ctx)
goto err_percpu;
--
2.9.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] blk-mq: only alloc hctx point as many as nr_hw_queues
2017-07-13 16:10 [PATCH] blk-mq: only alloc hctx point as many as nr_hw_queues weiping zhang
@ 2017-07-13 16:14 ` Jens Axboe
2017-07-13 16:30 ` weiping zhang
0 siblings, 1 reply; 4+ messages in thread
From: Jens Axboe @ 2017-07-13 16:14 UTC (permalink / raw)
To: weiping; +Cc: linux-block
On 07/13/2017 10:10 AM, weiping zhang wrote:
> one hw queue only has one hctx, reduce it's number same as nr_hw_queues.
What happens if a device registers with eg 4 hw queues, then later
calls blk_mq_update_nr_hw_queues()?
--
Jens Axboe
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] blk-mq: only alloc hctx point as many as nr_hw_queues
2017-07-13 16:14 ` Jens Axboe
@ 2017-07-13 16:30 ` weiping zhang
2017-07-13 16:38 ` Jens Axboe
0 siblings, 1 reply; 4+ messages in thread
From: weiping zhang @ 2017-07-13 16:30 UTC (permalink / raw)
To: Jens Axboe; +Cc: linux-block
On Thu, Jul 13, 2017 at 10:14:31AM -0600, Jens Axboe wrote:
> On 07/13/2017 10:10 AM, weiping zhang wrote:
> > one hw queue only has one hctx, reduce it's number same as nr_hw_queues.
>
> What happens if a device registers with eg 4 hw queues, then later
> calls blk_mq_update_nr_hw_queues()?
>
your means, 10 cpu, and device has 10 hw queues, but only register 4,
and then update it to 10, no place store new hctx. Am i understanding
right ? if yes, could you tell me why driver do that ? thanks.
--
weiping
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] blk-mq: only alloc hctx point as many as nr_hw_queues
2017-07-13 16:30 ` weiping zhang
@ 2017-07-13 16:38 ` Jens Axboe
0 siblings, 0 replies; 4+ messages in thread
From: Jens Axboe @ 2017-07-13 16:38 UTC (permalink / raw)
To: linux-block; +Cc: weiping
On 07/13/2017 10:30 AM, weiping zhang wrote:
> On Thu, Jul 13, 2017 at 10:14:31AM -0600, Jens Axboe wrote:
>> On 07/13/2017 10:10 AM, weiping zhang wrote:
>>> one hw queue only has one hctx, reduce it's number same as nr_hw_queues.
>>
>> What happens if a device registers with eg 4 hw queues, then later
>> calls blk_mq_update_nr_hw_queues()?
>>
>
> your means, 10 cpu, and device has 10 hw queues, but only register 4,
> and then update it to 10, no place store new hctx. Am i understanding
> right ? if yes, could you tell me why driver do that ? thanks.
It doesn't matter why the driver would do that, the fact is that this is
a feature we support and it's a part of the API. NBD uses it, for
instance. Your patch breaks it, for saving a bit of memory. So I will
not include it.
--
Jens Axboe
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-07-13 16:38 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-07-13 16:10 [PATCH] blk-mq: only alloc hctx point as many as nr_hw_queues weiping zhang
2017-07-13 16:14 ` Jens Axboe
2017-07-13 16:30 ` weiping zhang
2017-07-13 16:38 ` Jens Axboe
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.