diff mbox series

[Xen-devel,01/27] xen/x86: numa: Don't check alloc_boot_pages return

Message ID 20170814142418.13267-2-julien.grall@arm.com
State Accepted
Commit e942b20cfa00978af1556d731076885c035d2f37
Headers show
Series xen/arm: Memory subsystem clean-up | expand

Commit Message

Julien Grall Aug. 14, 2017, 2:23 p.m. UTC
alloc_boot_pages will panic if it is not possible to allocate. So the
check in the caller is pointless.

Signed-off-by: Julien Grall <julien.grall@arm.com>
---

Cc: Jan Beulich <jbeulich@suse.com>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/numa.c | 8 --------
 1 file changed, 8 deletions(-)

Comments

Andre Przywara Aug. 22, 2017, 11:22 a.m. UTC | #1
Hi,

On 14/08/17 15:23, Julien Grall wrote:
> alloc_boot_pages will panic if it is not possible to allocate. So the
> check in the caller is pointless.

More than that I don't see why "0" couldn't be a valid MFN. At least the
code in alloc_boot_pages() doesn't treat it specially, so it doesn't
signal an error condition in the first place.

> Signed-off-by: Julien Grall <julien.grall@arm.com>

Reviewed-by: Andre Przywara <andre.przywara@arm.com>

Cheers,
Andre.

> ---
> 
> Cc: Jan Beulich <jbeulich@suse.com>
> Cc: Andrew Cooper <andrew.cooper3@citrix.com>
> ---
>  xen/arch/x86/numa.c | 8 --------
>  1 file changed, 8 deletions(-)
> 
> diff --git a/xen/arch/x86/numa.c b/xen/arch/x86/numa.c
> index d45196fafc..ffeba6e180 100644
> --- a/xen/arch/x86/numa.c
> +++ b/xen/arch/x86/numa.c
> @@ -101,14 +101,6 @@ static int __init allocate_cachealigned_memnodemap(void)
>      unsigned long size = PFN_UP(memnodemapsize * sizeof(*memnodemap));
>      unsigned long mfn = alloc_boot_pages(size, 1);
>  
> -    if ( !mfn )
> -    {
> -        printk(KERN_ERR
> -               "NUMA: Unable to allocate Memory to Node hash map\n");
> -        memnodemapsize = 0;
> -        return -1;
> -    }
> -
>      memnodemap = mfn_to_virt(mfn);
>      mfn <<= PAGE_SHIFT;
>      size <<= PAGE_SHIFT;
>
diff mbox series

Patch

diff --git a/xen/arch/x86/numa.c b/xen/arch/x86/numa.c
index d45196fafc..ffeba6e180 100644
--- a/xen/arch/x86/numa.c
+++ b/xen/arch/x86/numa.c
@@ -101,14 +101,6 @@  static int __init allocate_cachealigned_memnodemap(void)
     unsigned long size = PFN_UP(memnodemapsize * sizeof(*memnodemap));
     unsigned long mfn = alloc_boot_pages(size, 1);
 
-    if ( !mfn )
-    {
-        printk(KERN_ERR
-               "NUMA: Unable to allocate Memory to Node hash map\n");
-        memnodemapsize = 0;
-        return -1;
-    }
-
     memnodemap = mfn_to_virt(mfn);
     mfn <<= PAGE_SHIFT;
     size <<= PAGE_SHIFT;