Skip to contentSkip to conversation

mmc: Improve block layer requeueing behavior

PATCH In review Christian Löhle 4 participants 9 messages Oct 26, 2022 – Nov 22, 2022

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover mmc: Improve block layer requeueing behavior

Mmcblk relies on block layer requeueing to fulfill some requests under certain conditions. Improve the handling to get nicely ordered requests.

Using the terms a bit loosely to get a point across:
Current behavior for 512 blksz and max_blk_count = 1 the scenario would be as follows:

- request for page 0 lba 0 to 7
- request for page 1 lba 8 to 15
- request for page 2 lba 16 to 23
- request for page 3 lba 24 to 31

mmcblk modifies data->blocks = 1 for each and requeues, this leads to:

Access lba 0
Access lba 8
Access lba 16
Access lba 24
Access lba 1 (1. Requeue for page 0)
Access lba 9 (1. Requeue for page 1)
Access lba 17 (1. Requeue for page 2)
Access lba 25 (1. Requeue for page 3)
Access lba 2 (2. Requeue for page 0)
...

Of course we would rather have lbas consecutive. Hyperstone GmbH | Reichenaustr. 39a | 78467 Konstanz Managing Director: Dr. Jan Peter Berns. Commercial register of local courts: Freiburg HRB381782

#1 lore raw
Quoted 26 lines · Christian Löhle

Mmcblk relies on block layer requeueing to fulfill some requests under certain conditions. Improve the handling to get nicely ordered requests.

Using the terms a bit loosely to get a point across:
Current behavior for 512 blksz and max_blk_count = 1 the scenario would be as follows:

- request for page 0 lba 0 to 7
- request for page 1 lba 8 to 15
- request for page 2 lba 16 to 23
- request for page 3 lba 24 to 31

mmcblk modifies data->blocks = 1 for each and requeues, this leads to:

Access lba 0
Access lba 8
Access lba 16
Access lba 24
Access lba 1 (1. Requeue for page 0)
Access lba 9 (1. Requeue for page 1)
Access lba 17 (1. Requeue for page 2)
Access lba 25 (1. Requeue for page 3)
Access lba 2 (2. Requeue for page 0)
...

Quoted 1 line

Of course we would rather have lbas consecutive.

Does anyone know why the block layer does not support (max_hw_sectors << 9) < PAGE_SIZE ?

#2 lore raw
Quoted 27 lines · Adrian Hunter
Quoted 26 lines · Christian Löhle

Mmcblk relies on block layer requeueing to fulfill some requests under certain conditions. Improve the handling to get nicely ordered requests.

Using the terms a bit loosely to get a point across:
Current behavior for 512 blksz and max_blk_count = 1 the scenario would be as follows:

- request for page 0 lba 0 to 7
- request for page 1 lba 8 to 15
- request for page 2 lba 16 to 23
- request for page 3 lba 24 to 31

mmcblk modifies data->blocks = 1 for each and requeues, this leads to:

Access lba 0
Access lba 8
Access lba 16
Access lba 24
Access lba 1 (1. Requeue for page 0)
Access lba 9 (1. Requeue for page 1)
Access lba 17 (1. Requeue for page 2)
Access lba 25 (1. Requeue for page 3)
Access lba 2 (2. Requeue for page 0)
...

Quoted 4 lines
Quoted 1 line

Of course we would rather have lbas consecutive.

Does anyone know why the block layer does not support (max_hw_sectors << 9) < PAGE_SIZE ?

Hi Adrian,

Does this mean that the following patch series would not only be useful for UFS but also for MMC? "[PATCH 00/10] Support DMA segments smaller than the page size"
(https://lore.kernel.org/linux-block/[email protected]/).

Thanks,

Bart.

#3 lore raw
Quoted 33 lines · Bart Van Assche
Quoted 27 lines · Adrian Hunter
Quoted 26 lines · Christian Löhle

Mmcblk relies on block layer requeueing to fulfill some requests under certain conditions. Improve the handling to get nicely ordered requests.

Using the terms a bit loosely to get a point across:
Current behavior for 512 blksz and max_blk_count = 1 the scenario would be as follows:

- request for page 0 lba 0 to 7
- request for page 1 lba 8 to 15
- request for page 2 lba 16 to 23
- request for page 3 lba 24 to 31

mmcblk modifies data->blocks = 1 for each and requeues, this leads to:

Access lba 0
Access lba 8
Access lba 16
Access lba 24
Access lba 1 (1. Requeue for page 0)
Access lba 9 (1. Requeue for page 1)
Access lba 17 (1. Requeue for page 2)
Access lba 25 (1. Requeue for page 3)
Access lba 2 (2. Requeue for page 0)
...

Quoted 4 lines
Quoted 1 line

Of course we would rather have lbas consecutive.

Does anyone know why the block layer does not support (max_hw_sectors << 9) < PAGE_SIZE ?

Quoted 6 lines

Hi Adrian,

Does this mean that the following patch series would not only be useful for UFS but also for MMC? "[PATCH 00/10] Support DMA segments smaller than the page size"
(https://lore.kernel.org/linux-block/[email protected]/).

That patchset still does not allow max_hw_sectors = 1 which is what Christian's case needs.

#4 lore raw
Quoted 5 lines · Adrian Hunter
Quoted 4 lines · Bart Van Assche
Quoted 2 lines · Adrian Hunter

Does anyone know why the block layer does not support (max_hw_sectors << 9) < PAGE_SIZE ?

Quoted 7 lines
Quoted 4 lines

Does this mean that the following patch series would not only be useful for UFS but also for MMC? "[PATCH 00/10] Support DMA segments smaller than the page size"
(https://lore.kernel.org/linux-block/[email protected]/).

That patchset still does not allow max_hw_sectors = 1 which is what Christian's case needs.

Hi Adrian,

Why would that patch series not support max_hw_sectors = 1? What am I overlooking?

Thanks,

Bart.

#5 lore raw
Quoted 11 lines · Bart Van Assche
Quoted 10 lines · Adrian Hunter
Quoted 8 lines · Bart Van Assche
Quoted 2 lines · Adrian Hunter

Does anyone know why the block layer does not support (max_hw_sectors << 9) < PAGE_SIZE ?

Does this mean that the following patch series would not only be useful for UFS but also for MMC? "[PATCH 00/10] Support DMA segments smaller than the page size"
(https://lore.kernel.org/linux-block/[email protected]/).

Quoted 6 lines
Quoted 2 lines

That patchset still does not allow max_hw_sectors = 1 which is what Christian's case needs.

Hi Adrian,

Why would that patch series not support max_hw_sectors = 1? What am I overlooking?

blk_queue_max_hw_sectors() does not allow it.

#6 lore raw
Quoted 1 line · Adrian Hunter

blk_queue_max_hw_sectors() does not allow it.

Right, I modified blk_queue_max_segment_size() in my patch series but not blk_queue_max_hw_sectors(). Adding a change for blk_queue_max_hw_sectors() to that patch series should be easy since that patch series already adds support for max_sectors being smaller than the page size.

Thanks,

Bart.

#7 lore raw
Quoted 9 lines · Adrian Hunter
Quoted 1 line

blk_queue_max_hw_sectors() does not allow it.

Right, I modified blk_queue_max_segment_size() in my patch series but not blk_queue_max_hw_sectors(). Adding a change for blk_queue_max_hw_sectors() to that patch series should be easy since that patch series already adds support for max_sectors being smaller than the page size.

Once you do, please publish it to the scsi mailing list as well.

Thanks,
Avri

Quoted 4 lines

Thanks,

Bart.

#8 lore raw
Quoted 1 line · Avri Altman

Once you do, please publish it to the scsi mailing list as well.

I will Cc the linux-scsi mailing list.

Thanks,

Bart.