All of lore.kernel.org
 help / color / mirror / Atom feed
* RE: [PATCH][TOOLS] Reducing impact ofdomainsave/restore/dump on Dom0
@ 2007-02-21 15:06 Graham, Simon
  2007-02-21 15:10 ` Keir Fraser
  0 siblings, 1 reply; 4+ messages in thread
From: Graham, Simon @ 2007-02-21 15:06 UTC (permalink / raw)
  To: Keir Fraser, xen-devel


> > Reduce impact of saving/restoring/dumping large domains on Dom0
> memory
> > usage by means of fadvise64() to tell the OS to discard the cache
> pages
> > used for the save/dump file.
> >
> > Signed-off-by: Simon Graham <Simon.Graham@stratus.com>
> 
> Could the fadvise() logic be shared more than it is in this patch?
Also
> you
> sometimes sync-then-fadvise. Is this just a performance enhancement
> (presumably fadvise wouldn't simply discard dirty pages in the buffer
> cache)?
> 

1. You mean putting the fsync/fadvise in a common utility routine? I can
do that.

2. sync-then-advise is only done at the end of writing a file to ensure
that all
   of the cached pages are discarded. Whilst writing the file, I only
fadvise
   which triggers a write back and discards any clean pages up to the
specified offset.
   This is indeed a performance thing -- fsyncing on every write makes
it very slow.

Updated patch will follow...

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH][TOOLS] Reducing impact ofdomainsave/restore/dump on Dom0
  2007-02-21 15:06 [PATCH][TOOLS] Reducing impact ofdomainsave/restore/dump on Dom0 Graham, Simon
@ 2007-02-21 15:10 ` Keir Fraser
  0 siblings, 0 replies; 4+ messages in thread
From: Keir Fraser @ 2007-02-21 15:10 UTC (permalink / raw)
  To: Graham, Simon, Keir Fraser, xen-devel

On 21/2/07 15:06, "Graham, Simon" <Simon.Graham@stratus.com> wrote:

> 2. sync-then-advise is only done at the end of writing a file to ensure
> that all
>    of the cached pages are discarded. Whilst writing the file, I only
> fadvise
>    which triggers a write back and discards any clean pages up to the
> specified offset.
>    This is indeed a performance thing -- fsyncing on every write makes
> it very slow.

Do you need the fsync at all? It's possible that the kernel will
launder-then-discard the affected pages automatically, just from the
fadvise() alone.

 -- Keir

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH][TOOLS] Reducing impact ofdomainsave/restore/dump on Dom0
  2007-02-21 15:22 Graham, Simon
@ 2007-02-22  2:10 ` Robert Read
  0 siblings, 0 replies; 4+ messages in thread
From: Robert Read @ 2007-02-22  2:10 UTC (permalink / raw)
  To: Graham, Simon; +Cc: xen-devel, Keir Fraser

Hi,

I also read somewhere (either the man page or in the code) that the  
sync is necessary for exactly these reasons.

robert


On Feb 21, 2007, at 07:22, Graham, Simon wrote:

>
>
>>
>> Do you need the fsync at all? It's possible that the kernel will
>> launder-then-discard the affected pages automatically, just from the
>> fadvise() alone.
>
> To be honest, I'm not completely sure; the implementation of the  
> fadvise
> call triggers a write back and then explicitely discards any clean  
> pages
> -- I don't _think_ it will discard clean pages once the write back
> completes (but it's not entirely clear to me how much of the write  
> back
> is done synchronously).
>
> However, it definitely makes a perf difference if you explicitely  
> fsync
> before each call to fadvise -- therefore I believe that the fadvise  
> call
> is definitely not cleaning all the pages inline (which would be
> equivalent to the fsync()).
>
> So -- my belief is that without the fsync, there will be some (clean)
> pages for the file still in the cache when this is done; my goal  
> was to
> remove ALL the pages, but perhaps leaving a few lying around is OK..
>
> /simgr
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xensource.com
> http://lists.xensource.com/xen-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: [PATCH][TOOLS] Reducing impact ofdomainsave/restore/dump on Dom0
@ 2007-02-21 15:22 Graham, Simon
  2007-02-22  2:10 ` Robert Read
  0 siblings, 1 reply; 4+ messages in thread
From: Graham, Simon @ 2007-02-21 15:22 UTC (permalink / raw)
  To: Keir Fraser, xen-devel



> 
> Do you need the fsync at all? It's possible that the kernel will
> launder-then-discard the affected pages automatically, just from the
> fadvise() alone.

To be honest, I'm not completely sure; the implementation of the fadvise
call triggers a write back and then explicitely discards any clean pages
-- I don't _think_ it will discard clean pages once the write back
completes (but it's not entirely clear to me how much of the write back
is done synchronously).

However, it definitely makes a perf difference if you explicitely fsync
before each call to fadvise -- therefore I believe that the fadvise call
is definitely not cleaning all the pages inline (which would be
equivalent to the fsync()).

So -- my belief is that without the fsync, there will be some (clean)
pages for the file still in the cache when this is done; my goal was to
remove ALL the pages, but perhaps leaving a few lying around is OK..

/simgr

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2007-02-22  2:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-02-21 15:06 [PATCH][TOOLS] Reducing impact ofdomainsave/restore/dump on Dom0 Graham, Simon
2007-02-21 15:10 ` Keir Fraser
2007-02-21 15:22 Graham, Simon
2007-02-22  2:10 ` Robert Read

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.