Hi all, Today's linux-next merge of the akpm-current tree got a conflict in: lib/cpumask.c between commit: 1abdfe706a57 ("lib: Restrict cpumask_local_spread to houskeeping CPUs") from the tip tree and commit: 6f7ee3fd63c9 ("lib: optimize cpumask_local_spread()") from the akpm-current tree. I fixed it up (see below) and can carry the fix as necessary. This is now fixed as far as linux-next is concerned, but any non trivial conflicts should be mentioned to your upstream maintainer when your tree is submitted for merging. You may also want to consider cooperating with the maintainer of the conflicting tree to minimise any particularly complex conflicts. -- Cheers, Stephen Rothwell diff --cc lib/cpumask.c index 85da6ab4fbb5,2fecbcd8c160..000000000000 --- a/lib/cpumask.c +++ b/lib/cpumask.c @@@ -6,7 -6,7 +6,8 @@@ #include <linux/export.h> #include <linux/memblock.h> #include <linux/numa.h> +#include <linux/sched/isolation.h> + #include <linux/spinlock.h> /** * cpumask_next - get the next cpu in a cpumask @@@ -193,40 -193,56 +194,61 @@@ void __init free_bootmem_cpumask_var(cp } #endif - /** - * cpumask_local_spread - select the i'th cpu with local numa cpu's first - * @i: index number - * @node: local numa_node - * - * This function selects an online CPU according to a numa aware policy; - * local cpus are returned first, followed by non-local ones, then it - * wraps around. - * - * It's not very efficient, but useful for setup. - */ - unsigned int cpumask_local_spread(unsigned int i, int node) + static void calc_node_distance(int *node_dist, int node) + { + int i; + + for (i = 0; i < nr_node_ids; i++) + node_dist[i] = node_distance(node, i); + } + + static int find_nearest_node(int *node_dist, bool *used) + { + int i, min_dist = node_dist[0], node_id = -1; + + /* Choose the first unused node to compare */ + for (i = 0; i < nr_node_ids; i++) { + if (used[i] == 0) { + min_dist = node_dist[i]; + node_id = i; + break; + } + } + + /* Compare and return the nearest node */ + for (i = 0; i < nr_node_ids; i++) { + if (node_dist[i] < min_dist && used[i] == 0) { + min_dist = node_dist[i]; + node_id = i; + } + } + + return node_id; + } + + static unsigned int __cpumask_local_spread(unsigned int i, int node) { - int cpu; + int cpu, hk_flags; + const struct cpumask *mask; + hk_flags = HK_FLAG_DOMAIN | HK_FLAG_MANAGED_IRQ; + mask = housekeeping_cpumask(hk_flags); /* Wrap: we always want a cpu. */ - i %= num_online_cpus(); + i %= cpumask_weight(mask); if (node == NUMA_NO_NODE) { - for_each_cpu(cpu, cpu_online_mask) + for_each_cpu(cpu, mask) { if (i-- == 0) return cpu; + } } else { /* NUMA first. */ - for_each_cpu_and(cpu, cpumask_of_node(node), cpu_online_mask) + for_each_cpu_and(cpu, cpumask_of_node(node), mask) { if (i-- == 0) return cpu; + } - for_each_cpu(cpu, cpu_online_mask) { + for_each_cpu(cpu, mask) { /* Skip NUMA nodes, done above. */ if (cpumask_test_cpu(cpu, cpumask_of_node(node))) continue;
Attachment:
pgpOB6lNZoy_n.pgp
Description: OpenPGP digital signature