On 7/18/25 12:13 AM, Damien Le Moal wrote:
I still do not understand why this patch is needed because you can get the current CPU submitting the BIO inside blk_zone_plug_bio() with raw_smp_processor_id(). That CPU ID should be the same as the cached request that we will use only if the BIO is not going through the BIO work, that is, if it is the first write BIO in-flight for the zone.
I do not agree with the above. With CONFIG_PREEMPT enabled, migration to another CPU may happen after a cached request has been allocated and
before the zoned block device code is called. This can be prevented by surrounding code with preempt_disable() and preempt_enable(). However, I don't think that we want to do this in submit_bio() since there is code in submit_bio() that may sleep (bio_queue_enter()) and sleeping with preemption disabled is not allowed. Is there perhaps something that I'm overlooking or misunderstanding?
Furthermore, for the DM case, you pass a CPU of "-1", but if the DM target needs zone append emulation, it will use zone write plugging. So the same control as for blk-mq is needed.
This "-1" means that it is not known from which CPU a request will be allocated since a migration to another CPU may happen between the blk_zone_plug_bio() call and request allocation. Thanks, Bart.