All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] memory: exit when hugepage allocation fails if mem-prealloc
@ 2016-01-22 14:15 Luiz Capitulino
  2016-01-26 10:40 ` Paolo Bonzini
  0 siblings, 1 reply; 2+ messages in thread
From: Luiz Capitulino @ 2016-01-22 14:15 UTC (permalink / raw)
  To: imammedo; +Cc: pbonzini, armbru, qemu-devel

When -mem-prealloc is passed on the command-line, the expected
behavior is to exit if the hugepage allocation fails.  However,
this behavior is broken since commit cc57501dee which made
hugepage allocation fall back to regular ram in case of faliure.

This commit restores the expected behavior for -mem-prealloc.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
---
 numa.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/numa.c b/numa.c
index 425ef8d..0e1638d 100644
--- a/numa.c
+++ b/numa.c
@@ -418,12 +418,13 @@ static void allocate_system_memory_nonnuma(MemoryRegion *mr, Object *owner,
         Error *err = NULL;
         memory_region_init_ram_from_file(mr, owner, name, ram_size, false,
                                          mem_path, &err);
-
-        /* Legacy behavior: if allocation failed, fall back to
-         * regular RAM allocation.
-         */
         if (err) {
             error_report_err(err);
+            if (mem_prealloc)
+                exit(1);
+            /* Legacy behavior: if allocation failed, fall back to
+             * regular RAM allocation.
+             */
             memory_region_init_ram(mr, owner, name, ram_size, &error_fatal);
         }
 #else
-- 
2.1.0

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

* Re: [Qemu-devel] [PATCH] memory: exit when hugepage allocation fails if mem-prealloc
  2016-01-22 14:15 [Qemu-devel] [PATCH] memory: exit when hugepage allocation fails if mem-prealloc Luiz Capitulino
@ 2016-01-26 10:40 ` Paolo Bonzini
  0 siblings, 0 replies; 2+ messages in thread
From: Paolo Bonzini @ 2016-01-26 10:40 UTC (permalink / raw)
  To: Luiz Capitulino, imammedo; +Cc: armbru, qemu-devel



On 22/01/2016 15:15, Luiz Capitulino wrote:
> When -mem-prealloc is passed on the command-line, the expected
> behavior is to exit if the hugepage allocation fails.  However,
> this behavior is broken since commit cc57501dee which made
> hugepage allocation fall back to regular ram in case of faliure.
> 
> This commit restores the expected behavior for -mem-prealloc.
> 
> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
> ---
>  numa.c | 9 +++++----
>  1 file changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/numa.c b/numa.c
> index 425ef8d..0e1638d 100644
> --- a/numa.c
> +++ b/numa.c
> @@ -418,12 +418,13 @@ static void allocate_system_memory_nonnuma(MemoryRegion *mr, Object *owner,
>          Error *err = NULL;
>          memory_region_init_ram_from_file(mr, owner, name, ram_size, false,
>                                           mem_path, &err);
> -
> -        /* Legacy behavior: if allocation failed, fall back to
> -         * regular RAM allocation.
> -         */
>          if (err) {
>              error_report_err(err);
> +            if (mem_prealloc)
> +                exit(1);
> +            /* Legacy behavior: if allocation failed, fall back to
> +             * regular RAM allocation.
> +             */
>              memory_region_init_ram(mr, owner, name, ram_size, &error_fatal);
>          }
>  #else
> 

Right, patch cc57501dee did the correct change but it was insufficient.
 I'll add the braces for you and queue the patch.

Paolo

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

end of thread, other threads:[~2016-01-26 10:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-22 14:15 [Qemu-devel] [PATCH] memory: exit when hugepage allocation fails if mem-prealloc Luiz Capitulino
2016-01-26 10:40 ` Paolo Bonzini

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.