qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] Assume madvise for (no)hugepage works
@ 2015-11-19 15:27 Dr. David Alan Gilbert (git)
  2015-11-20 10:26 ` Juan Quintela
  2015-11-21  5:00 ` Amit Shah
  0 siblings, 2 replies; 3+ messages in thread
From: Dr. David Alan Gilbert (git) @ 2015-11-19 15:27 UTC (permalink / raw)
  To: qemu-devel, quintela, amit.shah, jjherne, borntraeger

From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>

madvise() returns EINVAL in the case of many failures, but also
returns it in cases where the host kernel doesn't have THP enabled.
Postcopy only really cares that THP is off before it detects faults,
and turns it back on afterwards; so we're going to have
to assume that if the madvise fails then the host just doesn't do
THP and we can carry on with the postcopy.

Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Tested-by: Jason J. Herne <jjherne@linux.vnet.ibm.com>
---
 migration/postcopy-ram.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/migration/postcopy-ram.c b/migration/postcopy-ram.c
index 22d6b18..3946aa9 100644
--- a/migration/postcopy-ram.c
+++ b/migration/postcopy-ram.c
@@ -241,10 +241,7 @@ static int cleanup_range(const char *block_name, void *host_addr,
      * We turned off hugepage for the precopy stage with postcopy enabled
      * we can turn it back on now.
      */
-    if (qemu_madvise(host_addr, length, QEMU_MADV_HUGEPAGE)) {
-        error_report("%s HUGEPAGE: %s", __func__, strerror(errno));
-        return -1;
-    }
+    qemu_madvise(host_addr, length, QEMU_MADV_HUGEPAGE);
 
     /*
      * We can also turn off userfault now since we should have all the
@@ -345,10 +342,7 @@ static int nhp_range(const char *block_name, void *host_addr,
      * do delete areas of the page, even if THP thinks a hugepage would
      * be a good idea, so force hugepages off.
      */
-    if (qemu_madvise(host_addr, length, QEMU_MADV_NOHUGEPAGE)) {
-        error_report("%s: NOHUGEPAGE: %s", __func__, strerror(errno));
-        return -1;
-    }
+    qemu_madvise(host_addr, length, QEMU_MADV_NOHUGEPAGE);
 
     return 0;
 }
-- 
2.5.0

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

* Re: [Qemu-devel] [PATCH] Assume madvise for (no)hugepage works
  2015-11-19 15:27 [Qemu-devel] [PATCH] Assume madvise for (no)hugepage works Dr. David Alan Gilbert (git)
@ 2015-11-20 10:26 ` Juan Quintela
  2015-11-21  5:00 ` Amit Shah
  1 sibling, 0 replies; 3+ messages in thread
From: Juan Quintela @ 2015-11-20 10:26 UTC (permalink / raw)
  To: Dr. David Alan Gilbert (git); +Cc: amit.shah, borntraeger, qemu-devel, jjherne

"Dr. David Alan Gilbert (git)" <dgilbert@redhat.com> wrote:
> From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
>
> madvise() returns EINVAL in the case of many failures, but also
> returns it in cases where the host kernel doesn't have THP enabled.
> Postcopy only really cares that THP is off before it detects faults,
> and turns it back on afterwards; so we're going to have
> to assume that if the madvise fails then the host just doesn't do
> THP and we can carry on with the postcopy.
>
> Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
> Tested-by: Jason J. Herne <jjherne@linux.vnet.ibm.com>

Reviewed-by: Juan Quintela <quintela@redhat.com>

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

* Re: [Qemu-devel] [PATCH] Assume madvise for (no)hugepage works
  2015-11-19 15:27 [Qemu-devel] [PATCH] Assume madvise for (no)hugepage works Dr. David Alan Gilbert (git)
  2015-11-20 10:26 ` Juan Quintela
@ 2015-11-21  5:00 ` Amit Shah
  1 sibling, 0 replies; 3+ messages in thread
From: Amit Shah @ 2015-11-21  5:00 UTC (permalink / raw)
  To: Dr. David Alan Gilbert (git); +Cc: borntraeger, qemu-devel, jjherne, quintela

On (Thu) 19 Nov 2015 [15:27:48], Dr. David Alan Gilbert (git) wrote:
> From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
> 
> madvise() returns EINVAL in the case of many failures, but also
> returns it in cases where the host kernel doesn't have THP enabled.
> Postcopy only really cares that THP is off before it detects faults,
> and turns it back on afterwards; so we're going to have
> to assume that if the madvise fails then the host just doesn't do
> THP and we can carry on with the postcopy.
> 
> Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
> Tested-by: Jason J. Herne <jjherne@linux.vnet.ibm.com>

Reviewed-by: Amit Shah <amit.shah@redhat.com>

		Amit

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

end of thread, other threads:[~2015-11-21  5:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-11-19 15:27 [Qemu-devel] [PATCH] Assume madvise for (no)hugepage works Dr. David Alan Gilbert (git)
2015-11-20 10:26 ` Juan Quintela
2015-11-21  5:00 ` Amit Shah

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).