Re: [PATCH] RFC: loop: Avoid calling blk_mq_freeze_queue() when possible.

2019-08-19 Thread Martijn Coenen
On Mon, Aug 19, 2019 at 11:06 AM Martijn Coenen wrote: > One idea to fix is to call blk_queue_logical_block_size() as part of > LOOP_SET_FD, to match the block size of the backing fs in case the > backing file is opened with O_DIRECT; you could argue that if the > backing file is opened with O_DIR

Re: [PATCH] RFC: loop: Avoid calling blk_mq_freeze_queue() when possible.

2019-08-19 Thread Martijn Coenen
On Wed, Aug 14, 2019 at 1:34 PM Ming Lei wrote: > Another candidate is to not switch to q_usage_counter's percpu mode > until loop becomes Lo_bound, and this way may be more clean. I was thinking about this more; our current sequence is: 1) LOOP_SET_FD 2) LOOP_SET_STATUS64 // for lo_offset/lo_si

Re: [PATCH] RFC: loop: Avoid calling blk_mq_freeze_queue() when possible.

2019-08-15 Thread Martijn Coenen
On Thu, Aug 15, 2019 at 6:34 PM Ming Lei wrote: > If nothing will change, why does the userspace bother to send > SET_STATUS? We don't change transfer, but we do change the offset and sizelimit. In our specific case, we know there won't be any I/O from userspace at this point; so from that point

Re: [PATCH] RFC: loop: Avoid calling blk_mq_freeze_queue() when possible.

2019-08-15 Thread Ming Lei
On Thu, Aug 15, 2019 at 11:38 PM Martijn Coenen wrote: > > On Wed, Aug 14, 2019 at 12:47 PM Ming Lei wrote: > > blk_queue_init_done() is only called in blk_queue_init_done() for > > this purpose, so this approach should be fine, IMO. > > I was thinking somebody might add more stuff to "init" in t

Re: [PATCH] RFC: loop: Avoid calling blk_mq_freeze_queue() when possible.

2019-08-15 Thread Martijn Coenen
On Wed, Aug 14, 2019 at 12:47 PM Ming Lei wrote: > blk_queue_init_done() is only called in blk_queue_init_done() for > this purpose, so this approach should be fine, IMO. I was thinking somebody might add more stuff to "init" in the future, and then that new stuff would now no longer be executed

Re: [PATCH] RFC: loop: Avoid calling blk_mq_freeze_queue() when possible.

2019-08-15 Thread Martijn Coenen
On Wed, Aug 14, 2019 at 4:29 PM Bart Van Assche wrote: > Hi Martijn, > > Is the loop driver used in Android Q to make a file on a filesystem > visible as a block device or rather to make a subset of a block device > visible as a block device? In the latter case, have you considered to > use the dm

Re: [PATCH] RFC: loop: Avoid calling blk_mq_freeze_queue() when possible.

2019-08-14 Thread Bart Van Assche
On 8/14/19 3:32 AM, Martijn Coenen wrote: Since Android Q, the creation and configuration of loop devices is in the critical path of device boot. We found that the configuration of loop devices is pretty slow, because many ioctl()'s involve freezing the block queue, which in turn needs to wait fo

Re: [PATCH] RFC: loop: Avoid calling blk_mq_freeze_queue() when possible.

2019-08-14 Thread Ming Lei
On Wed, Aug 14, 2019 at 01:38:25PM +0200, Martijn Coenen wrote: > On Wed, Aug 14, 2019 at 1:34 PM Ming Lei wrote: > > Another candidate is to not switch to q_usage_counter's percpu mode > > until loop becomes Lo_bound, and this way may be more clean. > > Thanks! I had considered this too, but tho

Re: [PATCH] RFC: loop: Avoid calling blk_mq_freeze_queue() when possible.

2019-08-14 Thread Martijn Coenen
On Wed, Aug 14, 2019 at 1:34 PM Ming Lei wrote: > Another candidate is to not switch to q_usage_counter's percpu mode > until loop becomes Lo_bound, and this way may be more clean. Thanks! I had considered this too, but thought it a bit risky to mess with the init flag from the loop driver. Maybe

Re: [PATCH] RFC: loop: Avoid calling blk_mq_freeze_queue() when possible.

2019-08-14 Thread Ming Lei
On Wed, Aug 14, 2019 at 12:32:44PM +0200, Martijn Coenen wrote: > Since Android Q, the creation and configuration of loop devices is in > the critical path of device boot. We found that the configuration of > loop devices is pretty slow, because many ioctl()'s involve freezing the > block queue, wh