On Mon, 15 Apr 2024, Bart Van Assche wrote: > On 4/15/24 12:56, Mikulas Patocka wrote: > > I am wondering how should QUEUE_FLAG_SAME_COMP work for bio-based > > devices. > > > > I grepped the kernel for QUEUE_FLAG_SAME_COMP and it is tested in > > block/blk-mq.c in blk_mq_complete_need_ipi (this code path is taken only > > for request-based devices) and in block/blk-sysfs.c in > > queue_rq_affinity_show (this just displays the value in sysfs). There are > > no other places where QUEUE_FLAG_SAME_COMP is tested, so I don't see what > > effect is it supposed to have. > > I think the answer depends on whether or not the underlying device > defines the .submit_bio() callback. From block/blk-core.c: > > static void __submit_bio(struct bio *bio) > { > if (unlikely(!blk_crypto_bio_prep(&bio))) > return; > > if (!bio->bi_bdev->bd_has_submit_bio) { > blk_mq_submit_bio(bio); > } else if (likely(bio_queue_enter(bio) == 0)) { > struct gendisk *disk = bio->bi_bdev->bd_disk; > > disk->fops->submit_bio(bio); > blk_queue_exit(disk->queue); > } > } > > In other words, if the .submit_bio() callback is defined, that function > is called. If it is not defined, blk_mq_submit_bio() converts the bio > into a request. QUEUE_FLAG_SAME_COMP affects the request completion > path. On my test setup there are multiple dm instances defined on top of > SCSI devices. The SCSI core does not implement the .submit_bio() > callback. > > Thanks, > > Bart. Yes, setting the flag QUEUE_FLAG_SAME_COMP for bio-based drivers (those that define .submit_bio) has no effect. So, I think that you patch doesn't have any effect too. Mikulas