mm/page_alloc: fix MEMF_no_dma allocations for single NUMA
PATCH v2 1/1 mm/page_alloc: fix MEMF_no_dma allocations for single NUMA
Currently dma_bitsize is zero by default on single NUMA node machines. This makes all alloc_domheap_pages() calls with MEMF_no_dma return NULL.
There is only 1 user of MEMF_no_dma: dom0_memflags, which are used during memory allocation for Dom0. Failing allocation with default dom0_memflags is especially severe for the PV Dom0 case: it makes alloc_chunk() to use suboptimal 2MB allocation algorithm with a search for higher memory addresses.
This can lead to the NMI watchdog timeout during PV Dom0 construction on some machines, which can be worked around by specifying "dma_bits" in Xen's cmdline manually.
Fix the issue by ignoring MEMF_no_dma in cases when dma_bitsize is zero, which means there is no DMA zone. This shouldn't cause any issues for Dom0 because alloc_heap_pages() will first use higher memory addresses for satisfying memory allocation requests.
---
v2:
- A different approach as suggested by Jan, with wording changes
---
CC: Andrew Cooper <[email protected]>
CC: Jan Beulich <[email protected]>
CC: Julien Grall <[email protected]>
CC: Wei Liu <[email protected]>
CC: Boris Ostrovsky <[email protected]>
CC: George Dunlap <[email protected]>
CC: Roger Pau Monné <[email protected]>
--- xen/common/page_alloc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
xen/common/page_alloc.c +3 -1
@@ -2314,7 +2314,9 @@ struct page_info *alloc_domheap_pages(return NULL ; } -if ( dma_bitsize && ((dma_zone =bits_to_zone (dma_bitsize)) < zone_hi) ) +if ( !dma_bitsize ) + memflags &= ~MEMF_no_dma; +else if ( (dma_zone =bits_to_zone (dma_bitsize)) < zone_hi ) pg =alloc_heap_pages (dma_zone +1 , zone_hi, order, memflags, d); if ( (pg == NULL) &&
Signature · 7 lines
2.17.1 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 14 lines
Quoted 1 line
Quoted 1 line · On 08.01.19 at 16:45, <[email protected]> wrote:
Currently
dma_bitsizeis zero by default on single NUMA node machines. This makes allalloc_domheap_pages()calls withMEMF_no_dmareturn NULL.There is only 1 user of
MEMF_no_dma:dom0_memflags, which are used during memory allocation for Dom0. Failing allocation with defaultdom0_memflagsis especially severe for the PV Dom0 case: it makesalloc_chunk()to use suboptimal 2MB allocation algorithm with a search for higher memory addresses.This can lead to the NMI watchdog timeout during PV Dom0 construction on some machines, which can be worked around by specifying "
dma_bits" in Xen's cmdline manually.
Quoted 6 lines
Fix the issue by ignoring
MEMF_no_dmain cases whendma_bitsizeis zero, which means there is no DMA zone. This shouldn't cause any issues for Dom0 becausealloc_heap_pages()will first use higher memory addresses for satisfying memory allocation requests.Signed-off-by Sergey Dyasli <[email protected]>
(could also be Suggested-by)
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel