• Paolo Valente's avatar
    block, bfq: split sync bfq_queues on a per-actuator basis · 9778369a
    Paolo Valente authored
    Single-LUN multi-actuator SCSI drives, as well as all multi-actuator
    SATA drives appear as a single device to the I/O subsystem [1].  Yet
    they address commands to different actuators internally, as a function
    of Logical Block Addressing (LBAs). A given sector is reachable by
    only one of the actuators. For example, Seagate’s Serial Advanced
    Technology Attachment (SATA) version contains two actuators and maps
    the lower half of the SATA LBA space to the lower actuator and the
    upper half to the upper actuator.
    
    Evidently, to fully utilize actuators, no actuator must be left idle
    or underutilized while there is pending I/O for it. The block layer
    must somehow control the load of each actuator individually. This
    commit lays the ground for allowing BFQ to provide such a per-actuator
    control.
    
    BFQ associates an I/O-request sync bfq_queue with each process doing
    synchronous I/O, or with a group of processes, in case of queue
    merging. Then BFQ serves one bfq_queue at a time. While in service, a
    bfq_queue is emptied in request-position order. Yet the same process,
    or group of processes, may generate I/O for different actuators. In
    this case, different streams of I/O (each for a different actuator)
    get all inserted into the same sync bfq_queue. So there is basically
    no individual control on when each stream is served, i.e., on when the
    I/O requests of the stream are picked from the bfq_queue and
    dispatched to the drive.
    
    This commit enables BFQ to control the service of each actuator
    individually for synchronous I/O, by simply splitting each sync
    bfq_queue into N queues, one for each actuator. In other words, a sync
    bfq_queue is now associated to a pair (process, actuator). As a
    consequence of this split, the per-queue proportional-share policy
    implemented by BFQ will guarantee that the sync I/O generated for each
    actuator, by each process, receives its fair share of service.
    
    This is just a preparatory patch. If the I/O of the same process
    happens to be sent to different queues, then each of these queues may
    undergo queue merging. To handle this event, the bfq_io_cq data
    structure must be properly extended. In addition, stable merging must
    be disabled to avoid loss of control on individual actuators. Finally,
    also async queues must be split. These issues are described in detail
    and addressed in next commits. As for this commit, although multiple
    per-process bfq_queues are provided, the I/O of each process or group
    of processes is still sent to only one queue, regardless of the
    actuator the I/O is for. The forwarding to distinct bfq_queues will be
    enabled after addressing the above issues.
    
    [1] https://www.linaro.org/blog/budget-fair-queueing-bfq-linux-io-scheduler-optimizations-for-multi-actuator-sata-hard-drives/Reviewed-by: default avatarDamien Le Moal <damien.lemoal@opensource.wdc.com>
    Signed-off-by: default avatarGabriele Felici <felicigb@gmail.com>
    Signed-off-by: default avatarCarmine Zaccagnino <carmine@carminezacc.com>
    Signed-off-by: default avatarPaolo Valente <paolo.valente@linaro.org>
    Link: https://lore.kernel.org/r/20230103145503.71712-2-paolo.valente@linaro.orgSigned-off-by: default avatarJens Axboe <axboe@kernel.dk>
    9778369a
bfq-iosched.h 38.6 KB