Skip to contentSkip to conversation

x86/mm: pod: Use the correct memory flags for alloc_domheap_page{, s}

PATCH Superseded Julien Grall 3 participants 5 messages Oct 22, 2015 – Oct 23, 2015

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86/mm: pod: Use the correct memory flags for alloc_domheap_page{, s}

The last parameter of alloc_domheap_page{s,} contain the memory flags and not the order of the allocation.

Use 0 as it was before 1069d63c5ef2510d08b83b2171af660e5bb18c63 "x86/mm/p2m: use defines for page sizes".

Note that PAGE_ORDER_4K is also equal to 0 so the behavior stays the same.

---

Cc George Dunlap <[email protected]>
Cc Keir Fraser <[email protected]>
Cc Jan Beulich <[email protected]>
Cc Andrew Cooper <[email protected]>
---
 xen/arch/x86/mm/p2m-pod.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
xen/arch/x86/mm/p2m-pod.c +2 -2
index 901da37..61cca6f 100644
@@ -222,7 +222,7 @@ p2m_pod_set_cache_target(struct p2m_domain *p2m, unsigned long pod_target, int p
         else
             order = PAGE_ORDER_4K;
     retry:
-        page = alloc_domheap_pages(d, order, PAGE_ORDER_4K);
+        page = alloc_domheap_pages(d, order, 0);
         if ( unlikely(page == NULL) )
         {
             if ( order == PAGE_ORDER_2M )
@@ -477,7 +477,7 @@ p2m_pod_offline_or_broken_replace(struct page_info *p)
 
     free_domheap_page(p);
 
-    p = alloc_domheap_page(d, PAGE_ORDER_4K);
+    p = alloc_domheap_page(d, 0);
     if ( unlikely(!p) )
         return;
 
Signature · 1 line
2.1.4
#1 lore raw

xen/arch/x86/mm/p2m-pod.c p2m_pod_offline_or_broken_replace(struct page_info *p) · line 480

Quoted 7 lines
Quoted 1 line
Quoted 1 line · On 22.10.15 at 17:43, <[email protected]> wrote:
xen/arch/x86/mm/p2m-pod.c +1 -1
@@ -477,7 +477,7 @@ p2m_pod_offline_or_broken_replace(struct page_info *p)
 
     free_domheap_page(p);
 
-    p = alloc_domheap_page(d, PAGE_ORDER_4K);
+    p = alloc_domheap_page(d, 0);

I realize that this is the easiest fix, but I think here we instead want something like

@@ -477,13 +477,14 @@ p2m_pod_offline_or_broken_replace(struct

 {
     struct domain *d;
     struct p2m_domain *p2m;

+ nodeid_t node = phys_to_nid(page_to_maddr(p));

     if ( !(d = page_get_owner(p)) || !(p2m = p2m_get_hostp2m(d)) )
         return;
 
     free_domheap_page(p);

- p = alloc_domheap_page(d, PAGE_ORDER_4K);

+    p = alloc_domheap_pages(d, PAGE_ORDER_4K, MEMF_node(node));
     if ( unlikely(!p) )
         return;

Jan

#2 lore raw
Quoted 10 lines · Jan Beulich

xen/arch/x86/mm/p2m-pod.c p2m_pod_offline_or_broken_replace(struct page_info *p) · line 480

Quoted 7 lines
Quoted 1 line
Quoted 1 line · On 22.10.15 at 17:43, <[email protected]> wrote:
xen/arch/x86/mm/p2m-pod.c +1 -1
@@ -477,7 +477,7 @@ p2m_pod_offline_or_broken_replace(struct page_info *p)
 
     free_domheap_page(p);
 
-    p = alloc_domheap_page(d, PAGE_ORDER_4K);
+    p = alloc_domheap_page(d, 0);

I realize that this is the easiest fix, but I think here we instead want something like

It sounds sensible to me to re-allocate the page on the same numa node.

I will send another version of this patch. Although, I would appreciate if someone can test it because I don't have any NUMA platform.

Regards,

Signature · 1 line
Julien Grall
#3 lore raw
Quoted 14 lines · Julien Grall
Quoted 4 lines · Jan Beulich
Quoted 4 lines
Quoted 1 line
Quoted 1 line · On 22.10.15 at 17:43, <[email protected]> wrote:
(quoted diff) +0 -0
@@ -477,7 +477,7 @@ p2m_pod_offline_or_broken_replace(struct
 page_info *p)
 
Quoted 8 lines

xen/arch/x86/mm/p2m-pod.c p2m_pod_offline_or_broken_replace(struct page_info *p) · line 480

Quoted 4 lines
xen/arch/x86/mm/p2m-pod.c +1 -1
     free_domheap_page(p);
 
-    p = alloc_domheap_page(d, PAGE_ORDER_4K);
+    p = alloc_domheap_page(d, 0);

I realize that this is the easiest fix, but I think here we instead want
something like

Quoted 3 lines

It sounds sensible to me to re-allocate the page on the same numa node.

Indeed. It may be worth mentioning this in the changelog too, IMHO.

Quoted 4 lines

I will send another version of this patch. Although, I would appreciate
if someone can test it because I don't have any NUMA platform.

I'm up for it... What would it be a reasonable test, that actually stress this?

I certainly can do a "regular" test cycle such as: boot --> create a guest --> play a bit with it --> shutdown. Is it enough?

I think it should be an HVM guest, right? And perhaps I should specify different mem= and memmax= ?

Just let me know and, if you remember, Cc me when sending next version.

Regards,
Dario

Signature · 4 lines
<<This happens because I choose it to happen!>> (Raistlin Majere)
-----------------------------------------------------------------
Dario Faggioli, Ph.D, http://about.me/dario.faggioli
Senior Software Engineer, Citrix Systems R&D Ltd., Cambridge (UK)

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

#4 lore raw
In reply to Julien Grall
Quoted 13 lines
Quoted 1 line
Quoted 1 line · On 22.10.15 at 18:13, <[email protected]> wrote:
Quoted 10 lines · Jan Beulich

xen/arch/x86/mm/p2m-pod.c p2m_pod_offline_or_broken_replace(struct page_info *p) · line 480

Quoted 7 lines
Quoted 1 line
Quoted 1 line · On 22.10.15 at 17:43, <[email protected]> wrote:
xen/arch/x86/mm/p2m-pod.c +1 -1
@@ -477,7 +477,7 @@ p2m_pod_offline_or_broken_replace(struct page_info *p)
 
     free_domheap_page(p);
 
-    p = alloc_domheap_page(d, PAGE_ORDER_4K);
+    p = alloc_domheap_page(d, 0);

I realize that this is the easiest fix, but I think here we instead want something like

Quoted 4 lines

It sounds sensible to me to re-allocate the page on the same numa node.

I will send another version of this patch. Although, I would appreciate if someone can test it because I don't have any NUMA platform.

To test this code path, memory hut unplug would need to be supported by the platform too, or you'd have to manage to be unlucky for your system to have a faulty memory page in the "right" slot.

Jan