All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chaitanya Kulkarni <Chaitanya.Kulkarni@wdc.com>
To: Martijn Coenen <maco@android.com>,
	"axboe@kernel.dk" <axboe@kernel.dk>, "hch@lst.de" <hch@lst.de>
Cc: "bvanassche@acm.org" <bvanassche@acm.org>,
	"linux-block@vger.kernel.org" <linux-block@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"kernel-team@android.com" <kernel-team@android.com>
Subject: Re: [PATCH] loop: Add LOOP_SET_FD_WITH_OFFSET ioctl.
Date: Sun, 29 Mar 2020 16:48:12 +0000	[thread overview]
Message-ID: <BYAPR04MB4965F147D89443CAD75FDE0E86CA0@BYAPR04MB4965.namprd04.prod.outlook.com> (raw)
In-Reply-To: 20200329140459.18155-1-maco@android.com

On 03/29/2020 07:05 AM, Martijn Coenen wrote:
> Configuring a loop device for a filesystem that is located at an offset
> currently requires calling LOOP_SET_FD and LOOP_SET_STATUS(64)
> consecutively. This has some downsides.
>
> The most important downside is that it can be slow. Here's setting
> up ~70 regular loop devices on an x86 Android device:
>
> vsoc_x86:/system/apex # time for i in `seq 30 100`;
> do losetup -r /dev/block/loop$i com.android.adbd.apex; done
>      0m01.85s real     0m00.01s user     0m00.01s system
>
> Here's configuring ~70 devices in the same way, but with an offset:
>
> vsoc_x86:/system/apex # time for i in `seq 30 100`;
> do losetup -r -o 4096 /dev/block/loop$i com.android.adbd.apex; done
>      0m03.40s real     0m00.02s user     0m00.03s system
>
> This is almost twice as slow; the main reason for this slowness is that
> LOOP_SET_STATUS(64) calls blk_mq_freeze_queue() to freeze the associated
> queue; this requires waiting for RCU synchronization, which I've
> measured can take about 15-20ms on this device on average.
>
> A more minor downside of having to do two ioctls is that on devices with
> max_part > 0, the kernel will initiate a partition scan, which is
> needless work if the image is at an offset.
>
> This change introduces a new ioctl to combine setting the backing file
> together with the offset, which avoids the above problems. Adding more
> parameters could be a consideration, but offset appears to be the only
> commonly used parameter that is required for accessing the device
> safely.
>
> Signed-off-by: Martijn Coenen<maco@android.com>

This patch seems to solve problem, can you please make sure to add a
blktest [1] for the same since it is a new IOCTL ?

[1] https://github.com/osandov/blktests.



  reply	other threads:[~2020-03-29 16:48 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-29 14:04 [PATCH] loop: Add LOOP_SET_FD_WITH_OFFSET ioctl Martijn Coenen
2020-03-29 16:48 ` Chaitanya Kulkarni [this message]
2020-03-29 20:19 ` Bart Van Assche
2020-03-30  1:00 ` Ming Lei
2020-03-30  8:06   ` Martijn Coenen
2020-03-31  7:48     ` Christoph Hellwig
2020-03-31 11:25       ` Martijn Coenen
2020-03-31 11:40 Martijn Coenen
2020-03-31 11:42 ` Martijn Coenen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=BYAPR04MB4965F147D89443CAD75FDE0E86CA0@BYAPR04MB4965.namprd04.prod.outlook.com \
    --to=chaitanya.kulkarni@wdc.com \
    --cc=axboe@kernel.dk \
    --cc=bvanassche@acm.org \
    --cc=hch@lst.de \
    --cc=kernel-team@android.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maco@android.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.