mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Maxim Patlasov <mpatlasov@parallels.com>
To: miklos@szeredi.hu
Cc: fuse-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org,
	devel@openvz.org
Subject: [PATCH v3 00/12] fuse: optimize scatter-gather direct IO
Date: Fri, 26 Oct 2012 19:47:45 +0400	[thread overview]
Message-ID: <20121026152957.18931.46330.stgit@maximpc.sw.ru> (raw)

Hi,

Existing fuse implementation processes scatter-gather direct IO in suboptimal
way: fuse_direct_IO passes iovec[] to fuse_loop_dio and the latter calls
fuse_direct_read/write for each iovec from iovec[] array. Thus we have as many
submitted fuse-requests as the number of elements in iovec[] array. This is
pure waste of resources and affects performance negatively especially for the
case of many small chunks (e.g. page-size) packed in one iovec[] array.

The patch-set amends situation in a natural way: let's simply pack as
many iovec[] segments to every fuse-request as possible.

To estimate performance improvement I used slightly modified fusexmp over
tmpfs (clearing O_DIRECT bit from fi->flags in xmp_open). The test opened
a file with O_DIRECT, then called readv/writev in a loop. An iovec[] for
readv/writev consisted of 32 segments of 4K each. The throughput on some
commodity (rather feeble) server was (in MB/sec):

        original / patched
writev: ~107     / ~480
readv:  ~114     / ~569

We're exploring possibility to use fuse for our own distributed storage
implementation and big iovec[] arrays of many page-size chunks is typical
use-case for device virtualization thread performing i/o on behalf of
virtual-machine it serves.

Changed in v2:
 - inline array of page pointers req->pages[] is replaced with dynamically
   allocated one; the number of elements is calculated a bit more
   intelligently than being equal to FUSE_MAX_PAGES_PER_REQ; this is done
   for the sake of memory economy.
 - a dynamically allocated array of so-called 'page descriptors' - an offset
   in page plus the length of fragment - is added to fuse_req; this is done
   to simplify processing fuse requests covering several iov-s.

Changed in v3:
 - used iov_iter in fuse_get_user_pages() and __fuse_direct_io()
 - zeroed req->pages[] array on allocation
 - a bunch of minor cleanup changes:
    - used unsigned for npages
    - freed req->pages[] and req->page_descs[] together
    - renamed fuse_get_ua() to fuse_get_user_addr()
    - renamed fuse_get_fr_sz() to fuse_get_user_size()
    - simplified loop in fuse_page_descs_length_init()
 - rebased on v3.7-rc2

Thanks,
Maxim

---

Maxim Patlasov (12):
      fuse: general infrastructure for pages[] of variable size
      fuse: categorize fuse_get_req()
      fuse: rework fuse_retrieve()
      fuse: rework fuse_readpages()
      fuse: rework fuse_perform_write()
      fuse: rework fuse_do_ioctl()
      fuse: add per-page descriptor <offset, length> to fuse_req
      fuse: use req->page_descs[] for argpages cases
      mm: minor cleanup of iov_iter_single_seg_count()
      fuse: pass iov[] to fuse_get_user_pages()
      fuse: optimize fuse_get_user_pages()
      fuse: optimize __fuse_direct_io()


 fs/fuse/cuse.c     |    3 -
 fs/fuse/dev.c      |   98 +++++++++++++++------
 fs/fuse/dir.c      |   39 ++++----
 fs/fuse/file.c     |  242 ++++++++++++++++++++++++++++++++++------------------
 fs/fuse/fuse_i.h   |   47 ++++++++--
 fs/fuse/inode.c    |    6 +
 include/linux/fs.h |    2 
 mm/filemap.c       |    2 
 8 files changed, 292 insertions(+), 147 deletions(-)

-- 
Signature

             reply	other threads:[~2012-10-26 15:48 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-26 15:47 Maxim Patlasov [this message]
2012-10-26 15:48 ` [PATCH 01/12] fuse: general infrastructure for pages[] of variable size Maxim Patlasov
2012-10-26 15:48 ` [PATCH 02/12] fuse: categorize fuse_get_req() Maxim Patlasov
2012-10-26 15:48 ` [PATCH 03/12] fuse: rework fuse_retrieve() Maxim Patlasov
2012-10-26 15:48 ` [PATCH 04/12] fuse: rework fuse_readpages() Maxim Patlasov
2012-10-26 15:49 ` [PATCH 05/12] fuse: rework fuse_perform_write() Maxim Patlasov
2012-10-26 15:49 ` [PATCH 06/12] fuse: rework fuse_do_ioctl() Maxim Patlasov
2012-10-26 15:49 ` [PATCH 07/12] fuse: add per-page descriptor <offset, length> to fuse_req Maxim Patlasov
2012-10-26 15:49 ` [PATCH 08/12] fuse: use req->page_descs[] for argpages cases Maxim Patlasov
2012-10-26 15:50 ` [PATCH 09/12] mm: minor cleanup of iov_iter_single_seg_count() Maxim Patlasov
2012-10-26 15:50 ` [PATCH 10/12] fuse: pass iov[] to fuse_get_user_pages() Maxim Patlasov
2012-10-26 15:50 ` [PATCH 11/12] fuse: optimize fuse_get_user_pages() Maxim Patlasov
2012-10-26 15:50 ` [PATCH 12/12] fuse: optimize __fuse_direct_io() Maxim Patlasov

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=20121026152957.18931.46330.stgit@maximpc.sw.ru \
    --to=mpatlasov@parallels.com \
    --cc=devel@openvz.org \
    --cc=fuse-devel@lists.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=miklos@szeredi.hu \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome