All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mike Snitzer <snitzer@redhat.com>
To: Mikulas Patocka <mpatocka@redhat.com>
Cc: dm-devel@redhat.com, Alasdair G Kergon <agk@redhat.com>
Subject: Re: [PATCH 4/4] dm: implement no-clone optimization
Date: Thu, 14 Feb 2019 12:01:20 -0500	[thread overview]
Message-ID: <20190214170119.GA15261@redhat.com> (raw)
In-Reply-To: <alpine.LRH.2.02.1902141125520.16727@file01.intranet.prod.int.rdu2.redhat.com>

On Thu, Feb 14 2019 at 11:54am -0500,
Mikulas Patocka <mpatocka@redhat.com> wrote:

> 
> 
> On Thu, 14 Feb 2019, Mike Snitzer wrote:
> 
> > On Thu, Feb 14 2019 at 10:00am -0500,
> > Mikulas Patocka <mpatocka@redhat.com> wrote:
> > 
> > > This patch improves performance of dm-linear and dm-striped targets.
> > > Device mapper copies the whole bio and passes it to the lower layer. This
> > > copying may be avoided in special cases.
> > > 
> > > This patch changes the logic so that instead of copying the bio we
> > > allocate a structure dm_noclone (it has only 4 entries), save the values
> > > bi_end_io and bi_private in it, overwrite these values in the bio and pass
> > > the bio to the lower block device.
> > > 
> > > When the bio is finished, the function noclone_endio restores te values
> > > bi_end_io and bi_private and passes the bio to the original bi_end_io
> > > function.
> > > 
> > > This optimization can only be done by dm-linear and dm-striped targets,
> > > the target can op-in by setting ti->no_clone = true.
> > > 
> > > Performance improvement:
> > > 
> > > # modprobe brd rd_size=1048576
> > > # dd if=/dev/zero of=/dev/ram0 bs=1M oflag=direct
> > > # dmsetup create lin --table "0 2097152 linear /dev/ram0 0"
> > > # fio --ioengine=psync --iodepth=1 --rw=read --bs=512 --direct=1 --numjobs=12 --time_based --runtime=10 --group_reporting --name=/dev/mapper/lin
> > > 
> > > x86-64, 2x six-core
> > > /dev/ram0					2449MiB/s
> > > /dev/mapper/lin 5.0-rc without optimization	1970MiB/s
> > > /dev/mapper/lin 5.0-rc with optimization	2238MiB/s
> > > 
> > > arm64, quad core:
> > > /dev/ram0					457MiB/s
> > > /dev/mapper/lin 5.0-rc without optimization	325MiB/s
> > > /dev/mapper/lin 5.0-rc with optimization	364MiB/s
> > > 
> > > Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
> > 
> > Nice performance improvement.  But each device should have its own
> > mempool for dm_noclone + front padding.  So it should be wired into
> > dm_alloc_md_mempools().
> 
> We don't need to use mempools - if the slab allocation fails, we fall back 
> to the cloning path that has mempools.

But the implementation benefits from each DM device having control over
any extra memory it'd like to use for front padding.  Same as is done
now for the full-blown DM core with cloning.

> > It is fine if you don't actually deal with supporting per-bio-data in 
> > this patch, but a follow-on patch to add support for noclone-based 
> > per-bio-data shouldn't be expected to refactor the location of the 
> > mempool allocation (module vs per-device granularity).
> > 
> > Mike
> 
> I tried to use per-bio-data and other features - and it makes the 
> structure dm_noclone and function noclone_endio grow:
> 
> #define DM_NOCLONE_MAGIC 9693664
> struct dm_noclone {
> 	struct mapped_device *md;
> 	struct dm_target *ti;
> 	struct bio *bio;
> 	struct bvec_iter orig_bi_iter;
> 	bio_end_io_t *orig_bi_end_io;
> 	void *orig_bi_private;
> 	unsigned long start_time;
> 	/* ... per-bio data ... */
> 	/* DM_NOCLONE_MAGIC */
> };
> 
> And this growth degrades performance on linear target - from 2238MiB/s to 
> 2145MiB/s.

It shouldn't if done properly.. for linear there wouldn't be any growth.

  reply	other threads:[~2019-02-14 17:01 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-14 15:00 [PATCH 4/4] dm: implement no-clone optimization Mikulas Patocka
2019-02-14 15:55 ` Mike Snitzer
2019-02-14 16:54   ` Mikulas Patocka
2019-02-14 17:01     ` Mike Snitzer [this message]
2019-02-15 14:09       ` Mikulas Patocka

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=20190214170119.GA15261@redhat.com \
    --to=snitzer@redhat.com \
    --cc=agk@redhat.com \
    --cc=dm-devel@redhat.com \
    --cc=mpatocka@redhat.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.