linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jan Kara <jack@suse.cz>
To: Li Wang <liwang@nudt.edu.cn>
Cc: viro@zeniv.linux.org.uk, axboe@kernel.dk,
	linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [RFC] VFS: File System Mount Wide O_DIRECT Support
Date: Tue, 4 Sep 2012 14:27:43 +0200	[thread overview]
Message-ID: <20120904122743.GA8656@quack.suse.cz> (raw)
In-Reply-To: <000001cd8a86$89df83b0$9d9e8b10$@edu.cn>

On Tue 04-09-12 18:17:47, Li Wang wrote:
> For file system created on file-backed loop device, there will be two-levels of 
> page cache present, which typically doubles the memory consumption. 
> In many cases, it is beneficial to turn on the O_DIRECT option while performing 
> the upper file system file IO, to bypass the upper page cache, which not only reduces half
> of the memory consumption, but also improves the performance due to shorter copy path.
> 
> For example, the following iozone REREAD test with O_DIRECT turned on over the one without
> enjoys 10x speedup due to redundant cache elimination, consequently, avoiding page cache thrashing
> on a 2GB memory machine running 3.2.9 kernel.
> 
> losetup /dev/loop0 dummy // dummy is a ext4 file with a size of 1.1GB
> mkfs -t ext2 /dev/loop0
> mount /dev/loop0 /dsk
> cd /dsk
> iozone -t 1 -s 1G -r 4M -i 0 -+n -w // produce a 1GB test file
> iozone -t 1 -s 1G -r 4M -i 1 -w // REREAD test without O_DIRECT
> echo 1 > /proc/sys/vm/drop_caches // cleanup the page cache
> iozone -t 1 -s 1G -r 4M -i 1 -w -I // REREAD test with O_DIRECT
> 
> This feature is also expected to be useful for virtualization situation, the file systems inside 
> the guest operation system will use much less of guest memory, which, potencially results in less of 
> host memory use. Especially, it may be more useful if multiple guests are running based 
> on a same disk image file.  
> 
> The idea is simple, leave the desicion for the file system user to enable file system mount 
> wide O_DIRECT support with a new mount option, for example,
  I believe a better approach to your problem is actually to enable
loopback device driver to use direct IO. Someone was actually working on
this but I'm not sure where this ended up.

									Honza
-- 
Jan Kara <jack@suse.cz>
SUSE Labs, CR

  parent reply	other threads:[~2012-09-04 12:27 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-04 10:17 [RFC] VFS: File System Mount Wide O_DIRECT Support Li Wang
2012-09-04 10:57 ` Christoph Hellwig
2012-09-04 14:09   ` Matthew Wilcox
2012-09-04 12:27 ` Jan Kara [this message]
2012-09-04 23:28   ` Zach Brown

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=20120904122743.GA8656@quack.suse.cz \
    --to=jack@suse.cz \
    --cc=axboe@kernel.dk \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=liwang@nudt.edu.cn \
    --cc=viro@zeniv.linux.org.uk \
    /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;
as well as URLs for NNTP newsgroup(s).