On Tue, Aug 03, 2021 at 11:23:04AM -0700, Bart Van Assche wrote: > Recent versions of Android use the zram driver on top of the loop driver. > There is a mismatch between the default loop driver queue depth (128) and > the queue depth of the storage device in my test setup (32). That mismatch > results in write latencies that are higher than necessary. Address this > issue by making the default loop driver queue depth configurable. Compared > to configuring the queue depth by writing into the nr_requests sysfs > attribute, this approach does not involve calling synchronize_rcu() to > modify the queue depth. > > Reviewed-by: Ming Lei <ming.lei@xxxxxxxxxx> > Cc: Tetsuo Handa <penguin-kernel@xxxxxxxxxxxxxxxxxxx> > Cc: Christoph Hellwig <hch@xxxxxx> > Cc: Martijn Coenen <maco@xxxxxxxxxxx> > Cc: Jaegeuk Kim <jaegeuk@xxxxxxxxxx> > Signed-off-by: Bart Van Assche <bvanassche@xxxxxxx> > --- > drivers/block/loop.c | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git a/drivers/block/loop.c b/drivers/block/loop.c > index fa1c298a8cfb..b5dbf2d7447e 100644 > --- a/drivers/block/loop.c > +++ b/drivers/block/loop.c > @@ -2098,6 +2098,9 @@ module_param(max_loop, int, 0444); > MODULE_PARM_DESC(max_loop, "Maximum number of loop devices"); > module_param(max_part, int, 0444); > MODULE_PARM_DESC(max_part, "Maximum number of partitions per loop device"); > +static uint32_t default_queue_depth = 128; > +module_param(default_queue_depth, uint, 0644); > +MODULE_PARM_DESC(default_queue_depth, "Default loop device queue depth"); > MODULE_LICENSE("GPL"); > MODULE_ALIAS_BLOCKDEV_MAJOR(LOOP_MAJOR); Please no, this is not the 1990's, we do not need module-wide options like this that are hard to ever remove. Worst case, this should be a per-device option so it needs to be controllable that way. But really, why can this not just be "tuned" on the fly? How would anyone know what to set this value to? Should we just bump it up anyway given that modern memory limits are probably more now? thanks, greg k-h