• Bart Van Assche's avatar
    block: Reduce the amount of memory used for tag sets · f7e76dbc
    Bart Van Assche authored
    Instead of allocating an array of size nr_cpu_ids for set->tags, allocate
    an array of size set->nr_hw_queues. This patch improves behavior that was
    introduced by commit 868f2f0b ("blk-mq: dynamic h/w context count").
    
    Reallocating tag sets from inside __blk_mq_update_nr_hw_queues() is safe
    because:
    - All request queues that share the tag sets are frozen before the tag sets
      are reallocated.
    - blk_mq_queue_tag_busy_iter() holds q->q_usage_counter while active and
      hence is serialized against __blk_mq_update_nr_hw_queues().
    
    Cc: Keith Busch <keith.busch@intel.com>
    Cc: Christoph Hellwig <hch@infradead.org>
    Cc: Ming Lei <ming.lei@redhat.com>
    Cc: Hannes Reinecke <hare@suse.com>
    Cc: Johannes Thumshirn <jthumshirn@suse.de>
    Signed-off-by: default avatarBart Van Assche <bvanassche@acm.org>
    Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
    f7e76dbc
blk-mq.c 86 KB