x86/dom0: use MEMF_no_scrub for Dom0 RAM allocation
PATCH 1/1 x86/dom0: use MEMF_no_scrub for Dom0 RAM allocation
Now that idle scrub is the default option, all memory is marked as dirty and alloc_domheap_pages() will do eager scrubbing by default. This can lead to longer Dom0 construction and potentially to a watchdog timeout, especially on older H/W (e.g. Harpertown).
Pass MEMF_no_scrub to optimise this process since there is little point in scrubbing memory for Dom0 RAM.
---
CC: Jan Beulich <[email protected]>
CC: Andrew Cooper <[email protected]>
CC: Wei Liu <[email protected]>
CC: "Roger Pau Monné" <[email protected]>
--- xen/arch/x86/hvm/dom0_build.c | 2 +- xen/arch/x86/pv/dom0_build.c | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-)
xen/arch/x86/hvm/dom0_build.c +1 -1
@@ -101,7 +101,7 @@ static int __init pvh_populate_memory_range(struct domain *d,unsigned int range_order =get_order_from_pages (nr_pages +1 ); order =min (range_order ? range_order -1 :0 , order); - page =alloc_domheap_pages (d, order, dom0_memflags); + page =alloc_domheap_pages (d, order, dom0_memflags | MEMF_no_scrub);if ( page ==NULL ) {if ( order ==0 && dom0_memflags )
xen/arch/x86/pv/dom0_build.c +3 -2
@@ -239,7 +239,8 @@ static struct page_info * __init alloc_chunk(struct domain *d, order = last_order; else if ( max_pages & (max_pages - 1) ) --order; -while ( (page =alloc_domheap_pages (d, order, dom0_memflags)) ==NULL ) +while ( (page =alloc_domheap_pages (d, order, dom0_memflags | + MEMF_no_scrub)) ==NULL )if ( order-- ==0 )break ;if ( page )
@@ -265,7 +266,7 @@ static struct page_info * __init alloc_chunk(struct domain *d,if ( d->tot_pages + (1 << order) > d->max_pages )continue ; - pg2 =alloc_domheap_pages (d, order, MEMF_exact_node); + pg2 =alloc_domheap_pages (d, order, MEMF_exact_node | MEMF_no_scrub);if ( pg2 > page ) {free_domheap_pages (page, free_order);
Signature · 7 lines
2.17.1 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 8 lines
Quoted 1 line
Quoted 1 line · On 20.11.18 at 18:00, <[email protected]> wrote:
Now that idle scrub is the default option, all memory is marked as dirty and
alloc_domheap_pages()will do eager scrubbing by default. This can lead to longer Dom0 construction and potentially to a watchdog timeout, especially on older H/W (e.g. Harpertown).Pass
MEMF_no_scrubto optimise this process since there is little point in scrubbing memory for Dom0 RAM.
Good idea.
Quoted 13 lines
xen/arch/x86/pv/dom0_build.c +2
-1@@ -239,7 +239,8 @@ static struct page_info * __init alloc_chunk(struct domain *d, order = last_order; else if ( max_pages & (max_pages - 1) ) --order; -while ( (page =alloc_domheap_pages (d, order, dom0_memflags)) ==NULL ) +while ( (page =alloc_domheap_pages (d, order, dom0_memflags | + MEMF_no_scrub)) ==NULL )if ( order-- ==0 )break ;if ( page )
xen/arch/x86/pv/dom0_build.c static struct page_info * __init alloc_chunk(struct domain *d, · line 272
Quoted 8 lines
xen/arch/x86/pv/dom0_build.c +1
-1@@ -265,7 +266,7 @@ static struct page_info * __init alloc_chunk(struct domain *d,if ( d->tot_pages + (1 << order) > d->max_pages )continue ; - pg2 =alloc_domheap_pages (d, order, MEMF_exact_node); + pg2 =alloc_domheap_pages (d, order, MEMF_exact_node | MEMF_no_scrub);if ( pg2 > page ) {free_domheap_pages (page, free_order);
There are quite a few more allocations up from here. Any reason you don't convert those as well, the more that some even clear_page() what they've just allocated?
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 25 lines · Jan Beulich
Quoted 8 lines
Quoted 1 line
Quoted 1 line · On 20.11.18 at 18:00, <[email protected]> wrote:
Now that idle scrub is the default option, all memory is marked as dirty and
alloc_domheap_pages()will do eager scrubbing by default. This can lead to longer Dom0 construction and potentially to a watchdog timeout, especially on older H/W (e.g. Harpertown).Pass
MEMF_no_scrubto optimise this process since there is little point in scrubbing memory for Dom0 RAM.Good idea.
Quoted 14 lines
xen/arch/x86/pv/dom0_build.c +2
-1@@ -239,7 +239,8 @@ static struct page_info * __init alloc_chunk(struct domain *d, order = last_order; else if ( max_pages & (max_pages - 1) ) --order; -while ( (page =alloc_domheap_pages (d, order, dom0_memflags)) ==NULL ) +while ( (page =alloc_domheap_pages (d, order, dom0_memflags | + MEMF_no_scrub)) ==NULL )if ( order-- ==0 )break ;if ( page )@@ -265,7 +266,7 @@ static struct page_info * __init alloc_chunk(struct domain *d,
Quoted 11 lines
xen/arch/x86/pv/dom0_build.c static struct page_info * __init alloc_chunk(struct domain *d, · line 272
Quoted 7 lines
xen/arch/x86/pv/dom0_build.c +1
-1if ( d->tot_pages + (1 << order) > d->max_pages )continue ; - pg2 =alloc_domheap_pages (d, order, MEMF_exact_node); + pg2 =alloc_domheap_pages (d, order, MEMF_exact_node | MEMF_no_scrub);if ( pg2 > page ) {free_domheap_pages (page, free_order);There are quite a few more allocations up from here. Any reason you don't convert those as well, the more that some even
clear_page()what they've just allocated?
Dom0 RAM is just being the largest allocation. But yes, it should be safe to use MEMF_no_scrub in every alloc_domheap_pages() call during Dom0 construction. I'll send an updated patch after some testing.
--
Thanks,
Sergey
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel