linux-um archives
 help / color / mirror / Atom feed
From: Matt Ayres <matta@tektonic.net>
To: William Stearns <wstearns@pobox.com>
Cc: Jeff Dike <jdike@addtoit.com>,
	ML-uml-devel <user-mode-linux-devel@lists.sourceforge.net>
Subject: Re: [uml-devel] Swapping directly to host swap area?
Date: Fri, 19 Mar 2004 11:58:11 -0500	[thread overview]
Message-ID: <1079715490.11383.5.camel@cpx.office.tektonic.net> (raw)
In-Reply-To: <Pine.LNX.4.44.0403190014030.2368-200000@sparrow>

Does this actually work?  I had tried something similiar and it couldn't
read/write the file as O_DIRECT requires the data to be aligned.

Also, in my thinking it would be better to open the rootfs O_DIRECT and
leave swap as is.  O_DIRECT was made for applications who do their own
caching (such as UML).  You're essentially caching the data twice (which
ubd-mmap was aiming to fix).  If you open swapfs as O_DIRECT and a UML
swaps a lot it will just thrash the disk, normally the swapping will be
done in memory and might not ever touch the disk.

Here is the link to my patch, it's not clean as it was never intended to
be distributed.  It also doesn't work, it's very close to working I just
lack good pointer/memory allocation knowledge.

http://www.tektonic.net/public/odirect-not-working.diff

On Fri, 2004-03-19 at 00:51, William Stearns wrote:
> Good morning, Jeff,
> 
> On Tue, 27 Jan 2004, Jeff Dike wrote:
> 
> > wstearns@pobox.com said:
> > > In the current setup, the host kernel sees this as a normal
> > > write to an open file, caching it in the process and so not truly
> > > freeing up the ram for a bit. 
> > 
> > This is, and this could be done by setting O_DIRECT on UML swap devices.  That
> > way, writes go directly (and asynchronously) to the device without landing
> > in the cache.
> > 
> > With mmap in effect, this can also be done with a MADVISE_DONTNEED on the
> > relevant pages of the swap file.
> > 
> > Patches cheerfully accepted.
> 
> 	In that case, patch cheerfully submitted.  :-)
> 	The attached adds a fourth ubd option, "D".  When enabled, the 
> open call for that ubd file will use the O_DIRECT option.  I didn't tackle 
> the MADVISE portion, sorry.
> 	When I try to use it, I get back "cannot stat /dev/ubd/1: No 
> such file or directory."  The file is, of course, there, and I've checked 
> I'm using a kernel with this patch.  Does the Linux open64 not handle 
> O_DIRECT?
> 
> 	If the patch is mangled in transit or missing, it will also be up
> at http://www.stearns.org/uml/ in a bit, along with a kernel compiled with 
> this patch.
> 	Cheers,
> 	- Bill
> 
> ---------------------------------------------------------------------------
>         "Where's the kaboom, there was supposed to be
> an earth-shattering kaboom!"
>         -- Marvin Martian
> (Courtesy of John Green <johngreen@starband.net>)
> --------------------------------------------------------------------------
> William Stearns (wstearns@pobox.com).  Mason, Buildkernel, freedups, p0f,
> rsync-backup, ssh-keyinstall, dns-check, more at:   http://www.stearns.org
> --------------------------------------------------------------------------



-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
_______________________________________________
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel

      reply	other threads:[~2004-03-19 16:58 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-01-25 23:34 [uml-devel] Swapping directly to host swap area? William Stearns
2004-01-27  3:01 ` Dan Shearer
2004-01-28  4:39 ` Jeff Dike
2004-01-28 14:01   ` [uml-devel] O_DIRECT (was: Swapping directly to host swap area?) Goetz Bock
2004-01-30 17:27     ` Jeff Dike
2004-02-05 16:59   ` [uml-devel] Swapping directly to host swap area? BlaisorBlade
2004-02-11  0:43     ` Jeff Dike
2004-02-12 19:08       ` BlaisorBlade
2004-02-12 21:36         ` Jeff Dike
2004-03-19  5:51   ` William Stearns
2004-03-19 16:58     ` Matt Ayres [this message]

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=1079715490.11383.5.camel@cpx.office.tektonic.net \
    --to=matta@tektonic.net \
    --cc=jdike@addtoit.com \
    --cc=user-mode-linux-devel@lists.sourceforge.net \
    --cc=wstearns@pobox.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox