nodemask: API cleanup and fixes
v2 cover nodemask: API cleanup and fixes
This series supersedes the single "page-alloc: Clamp get_free_buddy() to online nodes" patch, and performs some preparatory cleanup.
Andrew Cooper (3):
page-alloc: Rename the first_node local variable
nodemask: Remove implicit addressof from the API
page-alloc: Clamp get_free_buddy() to online nodes
xen/arch/x86/dom0_build.c | 12 +-- xen/arch/x86/numa.c | 8 +- xen/arch/x86/srat.c | 15 ++-- xen/common/domain.c | 8 +- xen/common/page_alloc.c | 40 +++++----- xen/common/sched_credit.c | 2 +- xen/common/sysctl.c | 2 +- xen/include/xen/nodemask.h | 181 ++++++++++++++++++--------------------------- 8 files changed, 118 insertions(+), 150 deletions(-)
Signature · 7 lines
2.11.0 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
PATCH v2 1/3 page-alloc: Rename the first_node local variable
first_node is the name of a local variable, and part of the nodemask API. The only reason this compiles is because the nodemask API is implemented as a macro rather than an inline function.
It is confusing to read, and breaks when the nodemask API is cleaned up. Rename the local variable to just 'first' which is still clear in context.
No functional change.
---
CC: Jan Beulich <[email protected]>
CC: Wei Liu <[email protected]>
CC: Roger Pau Monné <[email protected]>
CC: Stefano Stabellini <[email protected]>
CC: Julien Grall <[email protected]>
CC: George Dunlap <[email protected]>
v2:
* New
--- xen/common/page_alloc.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
xen/common/page_alloc.c +5 -5
@@ -810,7 +810,7 @@ static struct page_info *get_free_buddy(unsigned int zone_lo, unsigned int order, unsigned int memflags, const struct domain *d) { - nodeid_t first_node, node = MEMF_get_node(memflags), req_node = node; + nodeid_t first, node = MEMF_get_node(memflags), req_node = node;nodemask_t nodemask = d ? d->node_affinity : node_online_map;unsigned int j, zone, nodemask_retry =0 ;struct page_info *pg;
@@ -832,7 +832,7 @@ static struct page_info *get_free_buddy(unsigned int zone_lo,ASSERT_UNREACHABLE ();return NULL ; } - first_node = node; + first = node;/* * Start with requested node, but exhaust all node memory in requested
@@ -878,19 +878,19 @@ static struct page_info *get_free_buddy(unsigned int zone_lo, {/* Very first node may be caller-specified and outside nodemask. */ ASSERT (!nodemask_retry); - first_node = node =first_node (nodemask); + first = node =first_node (nodemask);if ( node <MAX_NUMNODES )continue ; } else if ( (node = next_node(node, nodemask)) >= MAX_NUMNODES ) node = first_node(nodemask); -if ( node == first_node ) +if ( node == first ) {/* When we have tried all in nodemask, we fall back to others. */ if ( (memflags & MEMF_exact_node) || nodemask_retry++ )return NULL ;nodes_andnot (nodemask, node_online_map, nodemask); - first_node = node =first_node (nodemask); + first = node =first_node (nodemask);if ( node >=MAX_NUMNODES )return NULL ; }
Signature · 7 lines
2.11.0 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [Xen-devel] [PATCH 1/3] page-alloc: Rename the first_node local variable
Quoted 11 lines
Quoted 1 line
Quoted 1 line · On 25.06.19 at 16:43, <[email protected]> wrote:
first_nodeis the name of a local variable, and part of the nodemask API. The only reason this compiles is because the nodemask API is implemented as a macro rather than an inline function.It is confusing to read, and breaks when the nodemask API is cleaned up. Rename the local variable to just 'first' which is still clear in context.
No functional change.
Signed-off-by Andrew Cooper <[email protected]>
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
PATCH v2 2/3 nodemask: Remove implicit addressof from the API
In reply to Andrew CooperThe nodemask API differs from the cpumask API because each wrapper to bitmap operations is further wrapped by a macro which takes the address of the nodemask objects.
This results in code which is slightly confusing to read as it doesn't follow C's calling conventions, and prohibits the use of slightly more complicated constructs for specifying parameters.
Drop all wrapping macros, rename the nodemask static inline functions to drop the double underscores, and feed MAX_NUMNODES into appropriate locations.
Take the opportunity to drop a compiler workaround for node_isset() for GCC 3.3.2 which is long out of support, and implment it with a static inline.
Update all callers to use the correct indirection themselves.
No functional change.
---
CC: Jan Beulich <[email protected]>
CC: Wei Liu <[email protected]>
CC: Roger Pau Monné <[email protected]>
CC: Stefano Stabellini <[email protected]>
CC: Julien Grall <[email protected]>
CC: George Dunlap <[email protected]>
v2:
* New
--- xen/arch/x86/dom0_build.c | 12 +-- xen/arch/x86/numa.c | 8 +- xen/arch/x86/srat.c | 15 ++-- xen/common/domain.c | 8 +- xen/common/page_alloc.c | 28 +++---- xen/common/sched_credit.c | 2 +- xen/common/sysctl.c | 2 +- xen/include/xen/nodemask.h | 181 ++++++++++++++++++--------------------------- 8 files changed, 110 insertions(+), 146 deletions(-)
xen/arch/x86/dom0_build.c +6 -6
@@ -231,7 +231,7 @@ unsigned int __init dom0_max_vcpus(void)if ( pv_shim ) { -nodes_setall (dom0_nodes); +nodes_setall (&dom0_nodes);/* * When booting in shim mode APs are not started until the guest brings
@@ -246,11 +246,11 @@ unsigned int __init dom0_max_vcpus(void)for ( i =0 ; i < dom0_nr_pxms; ++i )if ( (node =pxm_to_node (dom0_pxms[i])) !=NUMA_NO_NODE ) -node_set (node, dom0_nodes); -nodes_and (dom0_nodes, dom0_nodes, node_online_map); -if (nodes_empty (dom0_nodes) ) +node_set (node, &dom0_nodes); +nodes_and (&dom0_nodes, &dom0_nodes, &node_online_map); +if (nodes_empty (&dom0_nodes) ) dom0_nodes = node_online_map; - for_each_node_mask ( node, dom0_nodes ) + for_each_node_mask ( node, &dom0_nodes )cpumask_or (&dom0_cpus, &dom0_cpus, &node_to_cpumask (node));cpumask_and (&dom0_cpus, &dom0_cpus, cpupool0->cpu_valid);if (cpumask_empty (&dom0_cpus) )
@@ -344,7 +344,7 @@ unsigned long __init dom0_compute_nr_pages(if ( !dom0_mem_set &&CONFIG_DOM0_MEM [0 ] )parse_dom0_mem (CONFIG_DOM0_MEM ); -for_each_node_mask ( node, dom0_nodes ) +for_each_node_mask ( node, &dom0_nodes ) avail += avail_domheap_pages_region(node, 0, 0) +initial_images_nrpages (node);
xen/arch/x86/numa.c +4 -4
@@ -186,15 +186,15 @@ void __init numa_init_array(void)mapping. To avoid this fill in the mapping for all possible CPUs, as the number of CPUs is not known yet. We round robin the existing nodes. */ - rr =first_node (node_online_map); + rr =first_node (&node_online_map);for ( i =0 ; i < nr_cpu_ids; i++ ) {if ( cpu_to_node[i] !=NUMA_NO_NODE )continue ;numa_set_node (i, rr); - rr =next_node (rr, node_online_map); + rr =next_node (rr, &node_online_map);if ( rr ==MAX_NUMNODES ) - rr =first_node (node_online_map); + rr =first_node (&node_online_map); } }
@@ -271,7 +271,7 @@ void __init numa_initmem_init(unsigned long start_pfn, unsigned long end_pfn)/* setup dummy node covering all memory */ memnode_shift =BITS_PER_LONG -1 ; memnodemap = _memnodemap; -nodes_clear (node_online_map); +nodes_clear (&node_online_map);node_set_online (0 );for ( i =0 ; i < nr_cpu_ids; i++ )numa_set_node (i,0 );
xen/arch/x86/srat.c +8 -7
@@ -228,7 +228,7 @@ acpi_numa_x2apic_affinity_init(const struct acpi_srat_x2apic_cpu_affinity *pa) } apicid_to_node[pa->apic_id] = node; -node_set (node, processor_nodes_parsed); +node_set (node, &processor_nodes_parsed); acpi_numa =1 ;printk (KERN_INFO "SRAT: PXM %u -> APIC %08x -> Node %u\n" , pxm, pa->apic_id, node);
@@ -261,7 +261,7 @@ acpi_numa_processor_affinity_init(const struct acpi_srat_cpu_affinity *pa)return ; } apicid_to_node[pa->apic_id] = node; -node_set (node, processor_nodes_parsed); +node_set (node, &processor_nodes_parsed); acpi_numa =1 ;printk (KERN_INFO "SRAT: PXM %u -> APIC %02x -> Node %u\n" , pxm, pa->apic_id, node);
@@ -332,7 +332,7 @@ acpi_numa_memory_affinity_init(const struct acpi_srat_mem_affinity *ma)if (!(ma->flags &ACPI_SRAT_MEM_HOT_PLUGGABLE )) {struct node *nd = &nodes[node]; -if (!node_test_and_set (node, memory_nodes_parsed)) { +if (!node_test_and_set (node, &memory_nodes_parsed)) { nd->start = start; nd->end = end; }else {
@@ -376,7 +376,7 @@ static int __init nodes_cover_memory(void) do { found = 0; - for_each_node_mask(j, memory_nodes_parsed) + for_each_node_mask( j, &memory_nodes_parsed ) if (start < nodes[j].end && end > nodes[j].start) { if (start >= nodes[j].start) {
@@ -480,10 +480,11 @@ int __init acpi_scan_nodes(u64 start, u64 end)return -1 ; } -nodes_or (all_nodes_parsed, memory_nodes_parsed, processor_nodes_parsed); +nodes_or (&all_nodes_parsed, &memory_nodes_parsed, + &processor_nodes_parsed);/* Finally register nodes */ -for_each_node_mask (i, all_nodes_parsed) +for_each_node_mask ( i, &all_nodes_parsed ) {u64 size = nodes[i].end - nodes[i].start;if ( size ==0 )
@@ -495,7 +496,7 @@ int __init acpi_scan_nodes(u64 start, u64 end)for (i =0 ; i < nr_cpu_ids; i++) {if (cpu_to_node[i] ==NUMA_NO_NODE )continue ; -if (!node_isset (cpu_to_node[i], processor_nodes_parsed)) +if (!node_isset (cpu_to_node[i], &processor_nodes_parsed))numa_set_node (i,NUMA_NO_NODE ); }numa_init_array ();
xen/common/domain.c +4 -4
@@ -613,9 +613,9 @@ void domain_update_node_affinity(struct domain *d) dom_affinity =cpumask_empty (dom_cpumask_soft) ? dom_cpumask : dom_cpumask_soft; -nodes_clear (d->node_affinity); +nodes_clear (&d->node_affinity); for_each_cpu ( cpu, dom_affinity ) -node_set (cpu_to_node (cpu), d->node_affinity); +node_set (cpu_to_node (cpu), &d->node_affinity); }spin_unlock (&d->node_affinity_lock);
@@ -628,7 +628,7 @@ void domain_update_node_affinity(struct domain *d)int domain_set_node_affinity (struct domain *d,const nodemask_t *affinity) {/* Being affine with no nodes is just wrong */ -if (nodes_empty (*affinity) ) +if (nodes_empty (affinity) )return -EINVAL ;spin_lock (&d->node_affinity_lock);
@@ -637,7 +637,7 @@ int domain_set_node_affinity(struct domain *d, const nodemask_t *affinity)* Being/becoming explicitly affine to all nodes is not particularly * useful. Let's take it as the `reset node affinity` command. */ -if (nodes_full (*affinity) ) +if (nodes_full (affinity) ) { d->auto_node_affinity =1 ; goto out;
xen/common/page_alloc.c +14 -14
@@ -820,9 +820,9 @@ static struct page_info *get_free_buddy(unsigned int zone_lo, {if ( d !=NULL ) { - node =next_node (d->last_alloc_node, nodemask); + node =next_node (d->last_alloc_node, &nodemask);if ( node >=MAX_NUMNODES ) - node =first_node (nodemask); + node =first_node (&nodemask); }if ( node >=MAX_NUMNODES ) node =cpu_to_node (smp_processor_id ());
@@ -874,23 +874,23 @@ static struct page_info *get_free_buddy(unsigned int zone_lo,return NULL ;/* Pick next node. */ -if ( !node_isset (node, nodemask) ) +if ( !node_isset (node, &nodemask) ) {/* Very first node may be caller-specified and outside nodemask. */ ASSERT (!nodemask_retry); - first = node =first_node (nodemask); + first = node =first_node (&nodemask);if ( node <MAX_NUMNODES )continue ; } -else if ( (node =next_node (node, nodemask)) >=MAX_NUMNODES ) - node =first_node (nodemask); +else if ( (node =next_node (node, &nodemask)) >=MAX_NUMNODES ) + node =first_node (&nodemask);if ( node == first ) {/* When we have tried all in nodemask, we fall back to others. */ if ( (memflags & MEMF_exact_node) || nodemask_retry++ )return NULL ; -nodes_andnot (nodemask, node_online_map, nodemask); - first = node =first_node (nodemask); +nodes_andnot (&nodemask, &node_online_map, &nodemask); + first = node =first_node (&nodemask);if ( node >=MAX_NUMNODES )return NULL ; }
@@ -1167,7 +1167,7 @@ static unsigned int node_to_scrub(bool get_node) node =0 ;if ( node_need_scrub[node] && - (!get_node || !node_test_and_set (node, node_scrubbing)) ) + (!get_node || !node_test_and_set (node, &node_scrubbing)) )return node;/*
@@ -1178,7 +1178,7 @@ static unsigned int node_to_scrub(bool get_node)for ( ; ; ) {do { - node =cycle_node (node, node_online_map); + node =cycle_node (node, &node_online_map); }while ( !cpumask_empty (&node_to_cpumask (node)) && (node != local_node) );
@@ -1201,10 +1201,10 @@ static unsigned int node_to_scrub(bool get_node)* then we'd need to take this lock every time we come in here. */ if ( (dist < shortest || closest ==NUMA_NO_NODE ) && - !node_test_and_set (node, node_scrubbing) ) + !node_test_and_set (node, &node_scrubbing) ) {if ( closest !=NUMA_NO_NODE ) -node_clear (closest, node_scrubbing); +node_clear (closest, &node_scrubbing); shortest = dist; closest = node; }
@@ -1356,7 +1356,7 @@ bool scrub_free_pages(void)spin_unlock (&heap_lock); out_nolock: -node_clear (node, node_scrubbing); +node_clear (node, &node_scrubbing);return node_to_scrub (false) !=NUMA_NO_NODE ; }
@@ -2006,7 +2006,7 @@ static void __init scrub_heap_pages(void)continue ; last_distance =INT_MAX ; - best_node =first_node (node_online_map); + best_node =first_node (&node_online_map);/* Figure out which NODE CPUs are close. */ for_each_online_node ( j ) {
xen/common/sched_credit.c +1 -1
@@ -1810,7 +1810,7 @@ csched_load_balance(struct csched_private *prv, int cpu, }while ( peer_cpu != first_cpu ); next_node: - peer_node =cycle_node (peer_node, node_online_map); + peer_node =cycle_node (peer_node, &node_online_map); }while ( peer_node != node ); }
xen/common/sysctl.c +1 -1
@@ -280,7 +280,7 @@ long do_sysctl(XEN_GUEST_HANDLE_PARAM(xen_sysctl_t) u_sysctl)bool_t do_meminfo = !guest_handle_is_null (ni->meminfo);bool_t do_distance = !guest_handle_is_null (ni->distance); - num_nodes =last_node (node_online_map) +1 ; + num_nodes =last_node (&node_online_map) +1 ;if ( do_meminfo || do_distance ) {
xen/include/xen/nodemask.h +72 -109
289 lines not on this page · raw message
Signature · 7 lines
2.11.0 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [Xen-devel] [PATCH 2/3] nodemask: Remove implicit addressof from the API
Quoted 12 lines
Quoted 1 line
Quoted 1 line · On 25.06.19 at 16:43, <[email protected]> wrote:
The nodemask API differs from the cpumask API because each wrapper to bitmap operations is further wrapped by a macro which takes the address of the nodemask objects.
This results in code which is slightly confusing to read as it doesn't follow C's calling conventions, and prohibits the use of slightly more complicated constructs for specifying parameters.
Drop all wrapping macros, rename the nodemask static inline functions to drop the double underscores, and feed
MAX_NUMNODESinto appropriate locations.
Quoted 8 lines
Take the opportunity to drop a compiler workaround for
node_isset()for GCC 3.3.2 which is long out of support, and implment it with a static inline.Update all callers to use the correct indirection themselves.
No functional change.
Signed-off-by Andrew Cooper <[email protected]>
I'm okay with this in principle, so
(with one aspect addressed below), but to be honest I would have hoped that the switch to the cpumask.h model would also imply a switch to the naming used there (e.g. nodemask_and()). This would have provided the opportunity to not do the entire switch in one patch.
xen/include/xen/nodemask.h line 93
Quoted 6 lines
xen/include/xen/nodemask.h +4
-2-/* No static inline type checking - see Subtlety (1) above. */ -#define node_isset (node, nodemask) test_bit((node), (nodemask).bits) +static inline int node_isset (int node,const nodemask_t *src) +{ +return test_bit (node, src->bits); +}
Since this is a new function, could I ask that you make it return bool? (Same for the test_and_... and a few others below then.) And (also elsewhere) could I further ask that plain int be switched to unsigned int at this occasion?
Quoted 11 lines
xen/include/xen/nodemask.h +3
-5-#define nodes_shift_right (dst, src, n) \ - __nodes_shift_right(&(dst), &(src), (n), MAX_NUMNODES) -static inline void __nodes_shift_right (nodemask_t *dstp, -const nodemask_t *srcp,int n,int nbits) +static inline void nodes_shift_right (nodemask_t *dstp,const nodemask_t *srcp, +int n) { -bitmap_shift_right (dstp->bits, srcp->bits, n, nbits); +bitmap_shift_right (dstp->bits, srcp->bits, n,MAX_NUMNODES ); }
xen/include/xen/nodemask.h line 170
Quoted 10 lines
xen/include/xen/nodemask.h +3
-5-#define nodes_shift_left (dst, src, n) \ - __nodes_shift_left(&(dst), &(src), (n), MAX_NUMNODES) -static inline void __nodes_shift_left (nodemask_t *dstp, -const nodemask_t *srcp,int n,int nbits) +static inline void nodes_shift_left (nodemask_t *dstp,const nodemask_t *srcp, +int n) { -bitmap_shift_left (dstp->bits, srcp->bits, n, nbits); +bitmap_shift_left (dstp->bits, srcp->bits, n,MAX_NUMNODES ); }
How about ditching rather than adjusting these two?
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
PATCH v2 3/3 page-alloc: Clamp get_free_buddy() to online nodes
In reply to Andrew Cooperd->node_affinity defaults to NODE_MASK_ALL which has bits set outside of node_online_map. This in turn causes the loop in get_free_buddy() to waste effort iterating over offline nodes.
Always clamp d->node_affinity to node_online_map when in use.
---
CC: Jan Beulich <[email protected]>
CC: Wei Liu <[email protected]>
CC: Roger Pau Monné <[email protected]>
CC: Stefano Stabellini <[email protected]>
CC: Julien Grall <[email protected]>
CC: George Dunlap <[email protected]>
v2:
* Rebase over the nodemask API change, and implement with a single nodes_and()
--- xen/common/page_alloc.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
xen/common/page_alloc.c +5 -1
@@ -811,11 +811,15 @@ static struct page_info *get_free_buddy(unsigned int zone_lo, const struct domain *d) {nodeid_t first, node =MEMF_get_node (memflags), req_node = node; -nodemask_t nodemask = d ? d->node_affinity : node_online_map; +nodemask_t nodemask;unsigned int j, zone, nodemask_retry =0 ;struct page_info *pg;bool use_unscrubbed = (memflags & MEMF_no_scrub); +/* Clamp nodemask to node_online_map and optionally d->node_affinity. */ +nodes_and (&nodemask, &node_online_map, + d ? &d->node_affinity : &node_online_map); +if ( node ==NUMA_NO_NODE ) {if ( d !=NULL )
Signature · 7 lines
2.11.0 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [Xen-devel] [PATCH 3/3] page-alloc: Clamp get_free_buddy() to online nodes
Quoted 8 lines
Quoted 1 line
Quoted 1 line · On 25.06.19 at 16:43, <[email protected]> wrote:
d->node_affinitydefaults toNODE_MASK_ALLwhich has bits set outside ofnode_online_map. This in turn causes the loop inget_free_buddy()to waste effort iterating over offline nodes.Always clamp
d->node_affinitytonode_online_mapwhen in use.Signed-off-by Andrew Cooper <[email protected]>
despite ...
Quoted 5 lines
xen/common/page_alloc.c +0
-0@@ -811,11 +811,15 @@ static struct page_info *get_free_buddy(unsigned int zone_lo, const struct domain *d) {
xen/common/page_alloc.c static struct page_info *get_free_buddy(unsigned int zone_lo, · line 821
Quoted 10 lines
xen/common/page_alloc.c +4
-1nodeid_t first, node =MEMF_get_node (memflags), req_node = node; -nodemask_t nodemask = d ? d->node_affinity : node_online_map; +nodemask_t nodemask;unsigned int j, zone, nodemask_retry =0 ;struct page_info *pg;bool use_unscrubbed = (memflags & MEMF_no_scrub); +/* Clamp nodemask to node_online_map and optionally d->node_affinity. */ +nodes_and (&nodemask, &node_online_map, + d ? &d->node_affinity : &node_online_map);
... finding it a little odd (inefficient) to AND node_online_map with itself.
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [Xen-devel] [PATCH 3/3] page-alloc: Clamp get_free_buddy() to online nodes
Quoted 23 lines · Jan Beulich
Quoted 8 lines
Quoted 1 line
Quoted 1 line · On 25.06.19 at 16:43, <[email protected]> wrote:
d->node_affinitydefaults toNODE_MASK_ALLwhich has bits set outside ofnode_online_map. This in turn causes the loop inget_free_buddy()to waste effort iterating over offline nodes.Always clamp
d->node_affinitytonode_online_mapwhen in use.Signed-off-by Andrew Cooper <[email protected]>Reviewed-by Jan Beulich <[email protected]>despite ...
Quoted 12 lines
xen/common/page_alloc.c +1
-1@@ -811,11 +811,15 @@ static struct page_info *get_free_buddy(unsigned int zone_lo, const struct domain *d) {nodeid_t first, node =MEMF_get_node (memflags), req_node = node; -nodemask_t nodemask = d ? d->node_affinity : node_online_map; +nodemask_t nodemask;unsigned int j, zone, nodemask_retry =0 ;struct page_info *pg;bool use_unscrubbed = (memflags & MEMF_no_scrub);
Quoted 4 lines
xen/common/page_alloc.c static struct page_info *get_free_buddy(unsigned int zone_lo, · line 821
Quoted 3 lines
xen/common/page_alloc.c +3
-0+/* Clamp nodemask to node_online_map and optionally d->node_affinity. */ +nodes_and (&nodemask, &node_online_map, + d ? &d->node_affinity : &node_online_map);... finding it a little odd (inefficient) to AND
node_online_mapwith itself.
Well - there is an O(n) loop for the copy, and an O(n) loop for and, or a single O(n) loop which does both when realising that foo = a & a is a copy operation in disguise.
~Andrew
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
[Xen-devel] [PATCH 4/3] nodemask: Don't opencode cycle_node()
In reply to Andrew CooperNo functional change.
---
CC: Jan Beulich <[email protected]>
CC: Wei Liu <[email protected]>
CC: Roger Pau Monné <[email protected]>
CC: Stefano Stabellini <[email protected]>
CC: Julien Grall <[email protected]>
CC: George Dunlap <[email protected]>
--- xen/arch/x86/numa.c | 4 +--- xen/common/page_alloc.c | 7 ++----- 2 files changed, 3 insertions(+), 8 deletions(-)
xen/arch/x86/numa.c +1 -3
@@ -192,9 +192,7 @@ void __init numa_init_array(void)if ( cpu_to_node[i] !=NUMA_NO_NODE )continue ;numa_set_node (i, rr); - rr =next_node (rr, &node_online_map); -if ( rr ==MAX_NUMNODES ) - rr =first_node (&node_online_map); + rr =cycle_node (rr, &node_online_map); } }
xen/common/page_alloc.c +2 -5
@@ -823,11 +823,8 @@ static struct page_info *get_free_buddy(unsigned int zone_lo,if ( node ==NUMA_NO_NODE ) {if ( d !=NULL ) - { - node =next_node (d->last_alloc_node, &nodemask); -if ( node >=MAX_NUMNODES ) - node =first_node (&nodemask); - } + node =cycle_node (d->last_alloc_node, &nodemask); +if ( node >=MAX_NUMNODES ) node =cpu_to_node (smp_processor_id ()); }
Signature · 7 lines
2.11.0 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Jan Beulich
Acked-byRe: [Xen-devel] [PATCH 4/3] nodemask: Don't opencode cycle_node()
Quoted 4 lines
Quoted 1 line
Quoted 1 line · On 25.06.19 at 16:58, <[email protected]> wrote:
No functional change.
Signed-off-by Andrew Cooper <[email protected]>
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel