On Wed, Mar 24, 2021 at 08:19:17PM +0800, Ming Lei wrote: > +static inline void blk_create_io_context(struct request_queue *q) > +{ > + /* > + * Various block parts want %current->io_context, so allocate it up > + * front rather than dealing with lots of pain to allocate it only > + * where needed. This may fail and the block layer knows how to live > + * with it. > + */ I think this comment would make more sense if it were placed above the caller rather than within this function. > + if (unlikely(!current->io_context)) > + create_task_io_context(current, GFP_ATOMIC, q->node); > +} > + > static noinline_for_stack bool submit_bio_checks(struct bio *bio) > { > struct block_device *bdev = bio->bi_bdev; > @@ -836,6 +848,8 @@ static noinline_for_stack bool submit_bio_checks(struct bio *bio) > } > } > > + blk_create_io_context(q); > + > if (!blk_queue_poll(q)) > bio->bi_opf &= ~REQ_HIPRI; > > @@ -876,15 +890,6 @@ static noinline_for_stack bool submit_bio_checks(struct bio *bio) > break; > } > > - /* > - * Various block parts want %current->io_context, so allocate it up > - * front rather than dealing with lots of pain to allocate it only > - * where needed. This may fail and the block layer knows how to live > - * with it. > - */ > - if (unlikely(!current->io_context)) > - create_task_io_context(current, GFP_ATOMIC, q->node); > - > if (blk_throtl_bio(bio)) { > blkcg_bio_issue_init(bio); > return false; > -- > 2.29.2