On 2025/12/12 8:53, Pankaj Raghav wrote:
Cc: stable@vger.kernel.org Signed-off-by: Swarna Prabhu s.prabhu@samsung.com Co-developed-by: Pankaj Raghav p.raghav@samsung.com Signed-off-by: Pankaj Raghav p.raghav@samsung.com --- Note: We are allocating pages of order aligned to BLK_MAX_BLOCK_SIZE for the mempool page allocator 'sd_page_pool' all the time. This is because we only know that a bigger sector size device is attached at sd_probe and it might be too late to reallocate mempool with order >0.
That is a lot heavier on the memory for the vast majority of devices which are 512B or 4K block size... It may be better to have the special "large block" mempool attached to the scsi disk struct and keep the default single page mempool for all other regular devices.
We had the same feeling as well and we mentioned it in the 1st RFC.
But when will you initialize the mempool for the large block devices? I don't think it makes sense to unconditionally initialize it in init_sd. Do we do it during the sd_probe() when we first encounter a large block device? That way we may not waste any memory if no large block devices are attached.
That sounds reasonable to me. Any system that has a device with a large sector size will get this mempool initialized when the first such device is scanned, and systems with regular disks (the vast majority of cases for scsi) will not. You may want to be careful with that initialization in sd_probe() though: scsi device scan is asynchronous and done in parallel for multiple devices, so you will need some atomicity for checking the mempool existence and initializing it if needed.