qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Aurelien Jarno <aurelien@aurel32.net>
To: Luiz Capitulino <lcapitulino@redhat.com>
Cc: aarcange@redhat.com, jan.kiszka@siemens.com, aliguori@us.ibm.com,
	qemu-devel <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [PATCH] Call MADV_HUGEPAGE for guest RAM allocations
Date: Sun, 21 Oct 2012 05:46:25 +0200	[thread overview]
Message-ID: <20121021034625.GD5261@ohm.aurel32.net> (raw)
In-Reply-To: <20121015155754.54f11e01@doriath.home>

On Mon, Oct 15, 2012 at 03:57:54PM -0300, Luiz Capitulino wrote:
> On Fri, 5 Oct 2012 16:47:57 -0300
> Luiz Capitulino <lcapitulino@redhat.com> wrote:
> 
> > This makes it possible for QEMU to use transparent huge pages (THP)
> > when transparent_hugepage/enabled=madvise. Otherwise THP is only
> > used when it's enabled system wide.
> > 
> > Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
> 
> ping?
> 
> > ---
> >  exec.c  | 1 +
> >  osdep.h | 5 +++++
> >  2 files changed, 6 insertions(+)
> > 
> > diff --git a/exec.c b/exec.c
> > index 1114a09..7504909 100644
> > --- a/exec.c
> > +++ b/exec.c
> > @@ -2584,6 +2584,7 @@ ram_addr_t qemu_ram_alloc_from_ptr(ram_addr_t size, void *host,
> >      cpu_physical_memory_set_dirty_range(new_block->offset, size, 0xff);
> >  
> >      qemu_ram_setup_dump(new_block->host, size);
> > +    qemu_madvise(new_block->host, size, QEMU_MADV_HUGEPAGE);
> >  
> >      if (kvm_enabled())
> >          kvm_setup_guest_memory(new_block->host, size);
> > diff --git a/osdep.h b/osdep.h
> > index cb213e0..c5fd3d9 100644
> > --- a/osdep.h
> > +++ b/osdep.h
> > @@ -108,6 +108,11 @@ void qemu_vfree(void *ptr);
> >  #else
> >  #define QEMU_MADV_DONTDUMP QEMU_MADV_INVALID
> >  #endif
> > +#ifdef MADV_HUGEPAGE
> > +#define QEMU_MADV_HUGEPAGE MADV_HUGEPAGE
> > +#else
> > +#define QEMU_MADV_HUGEPAGE QEMU_MADV_INVALID
> > +#endif
> >  
> >  #elif defined(CONFIG_POSIX_MADVISE)
> >  
> 

I don't know this part of QEMU very well, so I tried to compare with how
it was done for KSM. I found two main differences:
- In the case of -mem-path QEMU doesn't try to mark the pages as
  mergeable.
- An option (-machine mem-merge=false/true) is provided to enable KSM,
  defaulting to true.

I am not sure if it makes sense for hugepages, but providing a
mem-huge=false/true defaulting to true might be a good idea.

-- 
Aurelien Jarno                          GPG: 1024D/F1BCDB73
aurelien@aurel32.net                 http://www.aurel32.net

  parent reply	other threads:[~2012-10-21  3:46 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-05 19:47 [Qemu-devel] [PATCH] Call MADV_HUGEPAGE for guest RAM allocations Luiz Capitulino
2012-10-15 18:57 ` Luiz Capitulino
2012-10-15 21:14   ` Michael Tokarev
2012-10-21  3:46   ` Aurelien Jarno [this message]
2012-10-22 13:50     ` Luiz Capitulino

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=20121021034625.GD5261@ohm.aurel32.net \
    --to=aurelien@aurel32.net \
    --cc=aarcange@redhat.com \
    --cc=aliguori@us.ibm.com \
    --cc=jan.kiszka@siemens.com \
    --cc=lcapitulino@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /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).