Skip to contentSkip to conversation

xen: arm: reduce the size of the xen heap to max 1/8 RAM size

PATCH Applied Ian Campbell 3 participants 5 messages Jul 23, 2013 – Aug 20, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xen: arm: reduce the size of the xen heap to max 1/8 RAM size

From: Ian Campbell <[email protected]>

When building a 1GB dom0 on a system with 2GB RAM we are running out of domheap pages, while there are still plenty of xenheap pages spare.

I would have sworn that when the domheap was exhausted we would fall back to allocating xenheap pages but this doesn't appear to be the case. It's possible that we have setup something incorrectly on ARM but alloc_domheap_pages pretty clearly tries to allocate memory from MEMZONE_XEN+1..zone_hi.

Without the fallback from domheap to xenheap taking 1GB of any system with >1GB of RAM for xenheap is excessive so instead set a limit of 1/8 of the total amount of RAM. By way of comparison x86_32 used to have a static 12MB xenheap (which also included .text etc) and in theory supported up to 16GB RAM, by that measure 1/8 is plenty.

---
 xen/arch/arm/setup.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
xen/arch/arm/setup.c +2 -2
index 2f9fdc8..195c28e 100644
@@ -316,14 +316,14 @@ static void __init setup_mm(unsigned long dtb_paddr, size_t dtb_size)
      *
      *  - must be 32 MiB aligned
      *  - must not include Xen itself or the boot modules
-     *  - must be at most 1 GiB
+     *  - must be at most 1/8 the total RAM in the system
      *  - must be at least 128M
      *
      * We try to allocate the largest xenheap possible within these
      * constraints.
      */
     heap_pages = (ram_size >> PAGE_SHIFT);
-    xenheap_pages = min(1ul << (30 - PAGE_SHIFT), heap_pages);
+    xenheap_pages = max(heap_pages/8, 128UL<<(20-PAGE_SHIFT));
 
     do
     {
Signature · 1 line
1.8.3.2
#1 lore raw

Hi Keir,

Was I mistaken about the domheap->xenheap fallback or have we cocked something up on ARM?

Cheers,
Ian.

Quoted 43 lines · Ian Campbell

From: Ian Campbell <[email protected]>

When building a 1GB dom0 on a system with 2GB RAM we are running out of domheap pages, while there are still plenty of xenheap pages spare.

I would have sworn that when the domheap was exhausted we would fall back to allocating xenheap pages but this doesn't appear to be the case. It's possible that we have setup something incorrectly on ARM but alloc_domheap_pages pretty clearly tries to allocate memory from MEMZONE_XEN+1..zone_hi.

Without the fallback from domheap to xenheap taking 1GB of any system with >1GB of RAM for xenheap is excessive so instead set a limit of 1/8 of the total amount of RAM. By way of comparison x86_32 used to have a static 12MB xenheap (which also included .text etc) and in theory supported up to 16GB RAM, by that measure 1/8 is plenty.

---
 xen/arch/arm/setup.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
xen/arch/arm/setup.c +2 -2
index 2f9fdc8..195c28e 100644
@@ -316,14 +316,14 @@ static void __init setup_mm(unsigned long dtb_paddr, size_t dtb_size)
      *
      *  - must be 32 MiB aligned
      *  - must not include Xen itself or the boot modules
-     *  - must be at most 1 GiB
+     *  - must be at most 1/8 the total RAM in the system
      *  - must be at least 128M
      *
      * We try to allocate the largest xenheap possible within these
      * constraints.
      */
     heap_pages = (ram_size >> PAGE_SHIFT);
-    xenheap_pages = min(1ul << (30 - PAGE_SHIFT), heap_pages);
+    xenheap_pages = max(heap_pages/8, 128UL<<(20-PAGE_SHIFT));
 
     do
     {
#2 lore raw
Quoted 4 lines · Ian Campbell

Hi Keir,

Was I mistaken about the domheap->xenheap fallback or have we cocked something up on ARM?

Tim told me IRL that the fallback is deliberately not there. So I think this patch is correct.

@arm folks: ping ;-)

Quoted 55 lines

Cheers,
Ian.

Quoted 33 lines · Ian Campbell

From: Ian Campbell <[email protected]>

When building a 1GB dom0 on a system with 2GB RAM we are running out of domheap pages, while there are still plenty of xenheap pages spare.

I would have sworn that when the domheap was exhausted we would fall back to allocating xenheap pages but this doesn't appear to be the case. It's possible that we have setup something incorrectly on ARM but alloc_domheap_pages pretty clearly tries to allocate memory from MEMZONE_XEN+1..zone_hi.

Without the fallback from domheap to xenheap taking 1GB of any system with >1GB of RAM for xenheap is excessive so instead set a limit of 1/8 of the total amount of RAM. By way of comparison x86_32 used to have a static 12MB xenheap (which also included .text etc) and in theory supported up to 16GB RAM, by that measure 1/8 is plenty.

---
 xen/arch/arm/setup.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
xen/arch/arm/setup.c +1 -1
index 2f9fdc8..195c28e 100644
@@ -316,14 +316,14 @@ static void __init setup_mm(unsigned long dtb_paddr, size_t dtb_size)
      *
      *  - must be 32 MiB aligned
      *  - must not include Xen itself or the boot modules
-     *  - must be at most 1 GiB
+     *  - must be at most 1/8 the total RAM in the system
      *  - must be at least 128M

xen/arch/arm/setup.c static void __init setup_mm(unsigned long dtb_paddr, size_t dtb_size) · line 329

Quoted 10 lines
xen/arch/arm/setup.c +1 -1
      *
      * We try to allocate the largest xenheap possible within these
      * constraints.
      */
     heap_pages = (ram_size >> PAGE_SHIFT);
-    xenheap_pages = min(1ul << (30 - PAGE_SHIFT), heap_pages);
+    xenheap_pages = max(heap_pages/8, 128UL<<(20-PAGE_SHIFT));
 
     do
     {

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

Acked-by
#3 lore raw
Quoted 10 lines · Ian Campbell
Quoted 4 lines · Ian Campbell

Hi Keir,

Was I mistaken about the domheap->xenheap fallback or have we cocked something up on ARM?

Tim told me IRL that the fallback is deliberately not there. So I think this patch is correct.

@arm folks: ping ;-)

Quoted 63 lines
Quoted 47 lines

Cheers,
Ian.

Quoted 41 lines · Ian Campbell

From: Ian Campbell <[email protected]>

When building a 1GB dom0 on a system with 2GB RAM we are running out of domheap pages, while there are still plenty of xenheap pages spare.

I would have sworn that when the domheap was exhausted we would fall back to allocating xenheap pages but this doesn't appear to be the case. It's possible that we have setup something incorrectly on ARM but alloc_domheap_pages pretty clearly tries to allocate memory from MEMZONE_XEN+1..zone_hi.

Without the fallback from domheap to xenheap taking 1GB of any system with >1GB of RAM for xenheap is excessive so instead set a limit of 1/8 of the total amount of RAM. By way of comparison x86_32 used to have a static 12MB xenheap (which also included .text etc) and in theory supported up to 16GB RAM, by that measure 1/8 is plenty.

---
 xen/arch/arm/setup.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
xen/arch/arm/setup.c +2 -2
index 2f9fdc8..195c28e 100644
@@ -316,14 +316,14 @@ static void __init setup_mm(unsigned long dtb_paddr, size_t dtb_size)
      *
      *  - must be 32 MiB aligned
      *  - must not include Xen itself or the boot modules
-     *  - must be at most 1 GiB
+     *  - must be at most 1/8 the total RAM in the system
      *  - must be at least 128M
      *
      * We try to allocate the largest xenheap possible within these
      * constraints.
      */
     heap_pages = (ram_size >> PAGE_SHIFT);
-    xenheap_pages = min(1ul << (30 - PAGE_SHIFT), heap_pages);
+    xenheap_pages = max(heap_pages/8, 128UL<<(20-PAGE_SHIFT));
 
Quoted 9 lines

xen/arch/arm/setup.c static void __init setup_mm(unsigned long dtb_paddr, size_t dtb_size) · line 329

Quoted 2 lines
xen/arch/arm/setup.c +0 -0
     do
     {

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

Applied
#4 lore raw
Quoted 7 lines · Tim Deegan
Quoted 6 lines · Ian Campbell
Quoted 4 lines · Ian Campbell

Hi Keir,

Was I mistaken about the domheap->xenheap fallback or have we cocked something up on ARM?

Quoted 6 lines
Quoted 4 lines

Tim told me IRL that the fallback is deliberately not there. So I think this patch is correct.

@arm folks: ping ;-)

thanks, applied.