diff mbox series

memory: arrange to conserve on DMA reservation

Message ID 6565e881-ec59-4db4-834a-f694bf1b9427@suse.com (mailing list archive)
State New
Headers show
Series memory: arrange to conserve on DMA reservation | expand

Commit Message

Jan Beulich Feb. 25, 2025, 2:58 p.m. UTC
Entities building domains are expected to deal with higher order
allocation attempts (for populating a new domain) failing. If we set
aside a reservation for DMA, try to avoid taking higher order pages from
that reserve pool. Instead favor order-0 ones which often can still be
supplied from higher addressed memory, even if we've run out of
large/huge pages there.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
---
RFC: More generally for any requests targeting remote domains?
diff mbox series

Patch

--- a/xen/common/memory.c
+++ b/xen/common/memory.c
@@ -192,6 +192,14 @@  static void populate_physmap(struct memo
          * delayed.
          */
         a->memflags |= MEMF_no_icache_flush;
+
+        /*
+         * Heuristically assume that during domain construction the caller is
+         * capable of falling back to order-0 allocations, allowing us to
+         * conserve on memory otherwise held back for DMA purposes.
+         */
+        if ( a->extent_order )
+            a->memflags |= MEMF_no_dma;
     }
 
     for ( i = a->nr_done; i < a->nr_extents; i++ )