[xen stable-4.10] mm/page_alloc: fix MEMF_no_dma allocations for single NUMA

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

[xen stable-4.10] mm/page_alloc: fix MEMF_no_dma allocations for single NUMA

commit 8774be8a40ef82116948e9f1955c86e3e2d3bdba
Author:     Sergey Dyasli <[hidden email]>
AuthorDate: Fri Feb 1 11:47:45 2019 +0100
Commit:     Jan Beulich <[hidden email]>
CommitDate: Fri Feb 1 11:47:45 2019 +0100

    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.
    Signed-off-by: Sergey Dyasli <[hidden email]>
    Reviewed-by: Jan Beulich <[hidden email]>
    master commit: 5ac2dddb173b69be259ce4b259e73f971a4816c1
    master date: 2019-01-09 15:45:14 +0100
 xen/common/page_alloc.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/xen/common/page_alloc.c b/xen/common/page_alloc.c
index 598c3432c9..f3c7dbefb1 100644
--- a/xen/common/page_alloc.c
+++ b/xen/common/page_alloc.c
@@ -2249,7 +2249,9 @@ struct page_info *alloc_domheap_pages(
     if ( memflags & MEMF_no_owner )
         memflags |= MEMF_no_refcount;
-    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) &&
generated by git-patchbot for /home/xen/git/xen.git#stable-4.10

Xen-changelog mailing list
[hidden email]