diff for duplicates of <20170330171255.GF20181@localhost.localdomain> diff --git a/a/1.txt b/N1/1.txt index b2949eb..2f64759 100644 --- a/a/1.txt +++ b/N1/1.txt @@ -6,89 +6,3 @@ case. Please let me know if you've any concerns with the proposal. Thanks, Keith --------------- next part -------------- ->From e73acee5864d1d22261a0a701e32ce54ff4fdd28 Mon Sep 17 00:00:00 2001 -From: Keith Busch <keith.busch@intel.com> -Date: Tue, 28 Mar 2017 16:26:23 -0600 -Subject: [PATCH] irq/affinity: Assign all CPUs a vector - -The number of vectors to assign needs to be adjusted for each node such -that it doesn't exceed the number of CPUs in that node. This patch -recalculates the vector assignment per-node so that we don't try to -assign more vectors than there are CPUs. When that previously happened, -the cpus_per_vec was calculated to be 0, so many vectors had no CPUs -assigned. This then goes on to fail to allocate descriptors due to -empty masks, leading to an unoptimal spread. - -Not only does this patch get the intended spread, this also fixes -other subsystems that depend on every CPU being assigned to something: -blk_mq_map_swqueue dereferences NULL while mapping s/w queues when CPUs -are unnassigned, so making sure all CPUs are assigned fixes that. - -Signed-off-by: Keith Busch <keith.busch at intel.com> -Reviewed-by: Sagi Grimberg <sagi at grimberg.me> -Reviewed-by: Christoph Hellwig <hch at lst.de> ---- - kernel/irq/affinity.c | 20 +++++++++++--------- - 1 file changed, 11 insertions(+), 9 deletions(-) - -diff --git a/kernel/irq/affinity.c b/kernel/irq/affinity.c -index 4544b11..dc52911 100644 ---- a/kernel/irq/affinity.c -+++ b/kernel/irq/affinity.c -@@ -59,7 +59,7 @@ static int get_nodes_in_cpumask(const struct cpumask *mask, nodemask_t *nodemsk) - struct cpumask * - irq_create_affinity_masks(int nvecs, const struct irq_affinity *affd) - { -- int n, nodes, vecs_per_node, cpus_per_vec, extra_vecs, curvec; -+ int n, nodes, cpus_per_vec, extra_vecs, curvec; - int affv = nvecs - affd->pre_vectors - affd->post_vectors; - int last_affv = affv + affd->pre_vectors; - nodemask_t nodemsk = NODE_MASK_NONE; -@@ -94,19 +94,21 @@ irq_create_affinity_masks(int nvecs, const struct irq_affinity *affd) - goto done; - } - -- /* Spread the vectors per node */ -- vecs_per_node = affv / nodes; -- /* Account for rounding errors */ -- extra_vecs = affv - (nodes * vecs_per_node); -- - for_each_node_mask(n, nodemsk) { -- int ncpus, v, vecs_to_assign = vecs_per_node; -+ int ncpus, v, vecs_to_assign, vecs_per_node; -+ -+ /* Spread the vectors per node */ -+ vecs_per_node = (affv - curvec) / nodes; - - /* Get the cpus on this node which are in the mask */ - cpumask_and(nmsk, cpu_online_mask, cpumask_of_node(n)); - - /* Calculate the number of cpus per vector */ - ncpus = cpumask_weight(nmsk); -+ vecs_to_assign = min(vecs_per_node, ncpus); -+ -+ /* Account for rounding errors */ -+ extra_vecs = ncpus - vecs_to_assign; - - for (v = 0; curvec < last_affv && v < vecs_to_assign; - curvec++, v++) { -@@ -115,14 +117,14 @@ irq_create_affinity_masks(int nvecs, const struct irq_affinity *affd) - /* Account for extra vectors to compensate rounding errors */ - if (extra_vecs) { - cpus_per_vec++; -- if (!--extra_vecs) -- vecs_per_node++; -+ --extra_vecs; - } - irq_spread_init_one(masks + curvec, nmsk, cpus_per_vec); - } - - if (curvec >= last_affv) - break; -+ --nodes; - } - - done: --- -2.7.2 diff --git a/N1/2.hdr b/N1/2.hdr new file mode 100644 index 0000000..3ffdd80 --- /dev/null +++ b/N1/2.hdr @@ -0,0 +1,2 @@ +Content-Type: text/plain; charset=us-ascii +Content-Disposition: attachment; filename="0001-irq-affinity-Assign-all-CPUs-a-vector.patch" diff --git a/N1/2.txt b/N1/2.txt new file mode 100644 index 0000000..bc56b71 --- /dev/null +++ b/N1/2.txt @@ -0,0 +1,85 @@ +>From e73acee5864d1d22261a0a701e32ce54ff4fdd28 Mon Sep 17 00:00:00 2001 +From: Keith Busch <keith.busch@intel.com> +Date: Tue, 28 Mar 2017 16:26:23 -0600 +Subject: [PATCH] irq/affinity: Assign all CPUs a vector + +The number of vectors to assign needs to be adjusted for each node such +that it doesn't exceed the number of CPUs in that node. This patch +recalculates the vector assignment per-node so that we don't try to +assign more vectors than there are CPUs. When that previously happened, +the cpus_per_vec was calculated to be 0, so many vectors had no CPUs +assigned. This then goes on to fail to allocate descriptors due to +empty masks, leading to an unoptimal spread. + +Not only does this patch get the intended spread, this also fixes +other subsystems that depend on every CPU being assigned to something: +blk_mq_map_swqueue dereferences NULL while mapping s/w queues when CPUs +are unnassigned, so making sure all CPUs are assigned fixes that. + +Signed-off-by: Keith Busch <keith.busch@intel.com> +Reviewed-by: Sagi Grimberg <sagi@grimberg.me> +Reviewed-by: Christoph Hellwig <hch@lst.de> +--- + kernel/irq/affinity.c | 20 +++++++++++--------- + 1 file changed, 11 insertions(+), 9 deletions(-) + +diff --git a/kernel/irq/affinity.c b/kernel/irq/affinity.c +index 4544b11..dc52911 100644 +--- a/kernel/irq/affinity.c ++++ b/kernel/irq/affinity.c +@@ -59,7 +59,7 @@ static int get_nodes_in_cpumask(const struct cpumask *mask, nodemask_t *nodemsk) + struct cpumask * + irq_create_affinity_masks(int nvecs, const struct irq_affinity *affd) + { +- int n, nodes, vecs_per_node, cpus_per_vec, extra_vecs, curvec; ++ int n, nodes, cpus_per_vec, extra_vecs, curvec; + int affv = nvecs - affd->pre_vectors - affd->post_vectors; + int last_affv = affv + affd->pre_vectors; + nodemask_t nodemsk = NODE_MASK_NONE; +@@ -94,19 +94,21 @@ irq_create_affinity_masks(int nvecs, const struct irq_affinity *affd) + goto done; + } + +- /* Spread the vectors per node */ +- vecs_per_node = affv / nodes; +- /* Account for rounding errors */ +- extra_vecs = affv - (nodes * vecs_per_node); +- + for_each_node_mask(n, nodemsk) { +- int ncpus, v, vecs_to_assign = vecs_per_node; ++ int ncpus, v, vecs_to_assign, vecs_per_node; ++ ++ /* Spread the vectors per node */ ++ vecs_per_node = (affv - curvec) / nodes; + + /* Get the cpus on this node which are in the mask */ + cpumask_and(nmsk, cpu_online_mask, cpumask_of_node(n)); + + /* Calculate the number of cpus per vector */ + ncpus = cpumask_weight(nmsk); ++ vecs_to_assign = min(vecs_per_node, ncpus); ++ ++ /* Account for rounding errors */ ++ extra_vecs = ncpus - vecs_to_assign; + + for (v = 0; curvec < last_affv && v < vecs_to_assign; + curvec++, v++) { +@@ -115,14 +117,14 @@ irq_create_affinity_masks(int nvecs, const struct irq_affinity *affd) + /* Account for extra vectors to compensate rounding errors */ + if (extra_vecs) { + cpus_per_vec++; +- if (!--extra_vecs) +- vecs_per_node++; ++ --extra_vecs; + } + irq_spread_init_one(masks + curvec, nmsk, cpus_per_vec); + } + + if (curvec >= last_affv) + break; ++ --nodes; + } + + done: +-- +2.7.2 diff --git a/a/content_digest b/N1/content_digest index 0ed63c5..2e5e05e 100644 --- a/a/content_digest +++ b/N1/content_digest @@ -1,9 +1,13 @@ "ref\01490743277-14139-1-git-send-email-keith.busch@intel.com\0" "ref\020170330082106.GC11344@lst.de\0" - "From\0keith.busch@intel.com (Keith Busch)\0" - "Subject\0[PATCH] irq/affinity: Assign all CPUs a vector\0" + "From\0Keith Busch <keith.busch@intel.com>\0" + "Subject\0Re: [PATCH] irq/affinity: Assign all CPUs a vector\0" "Date\0Thu, 30 Mar 2017 13:12:55 -0400\0" - "\00:1\0" + "To\0Thomas Gleixner <tglx@linutronix.de>\0" + "Cc\0linux-kernel@vger.kernel.org" + linux-nvme@lists.infradead.org + " Christoph Hellwig <hch@lst.de>\0" + "\01:1\0" "b\0" "Hi Thomas,\n" "\n" @@ -12,8 +16,10 @@ "case. Please let me know if you've any concerns with the proposal.\n" "\n" "Thanks,\n" - "Keith\n" - "-------------- next part --------------\n" + Keith + "\01:2\0" + "fn\00001-irq-affinity-Assign-all-CPUs-a-vector.patch\0" + "b\0" ">From e73acee5864d1d22261a0a701e32ce54ff4fdd28 Mon Sep 17 00:00:00 2001\n" "From: Keith Busch <keith.busch@intel.com>\n" "Date: Tue, 28 Mar 2017 16:26:23 -0600\n" @@ -32,9 +38,9 @@ "blk_mq_map_swqueue dereferences NULL while mapping s/w queues when CPUs\n" "are unnassigned, so making sure all CPUs are assigned fixes that.\n" "\n" - "Signed-off-by: Keith Busch <keith.busch at intel.com>\n" - "Reviewed-by: Sagi Grimberg <sagi at grimberg.me>\n" - "Reviewed-by: Christoph Hellwig <hch at lst.de>\n" + "Signed-off-by: Keith Busch <keith.busch@intel.com>\n" + "Reviewed-by: Sagi Grimberg <sagi@grimberg.me>\n" + "Reviewed-by: Christoph Hellwig <hch@lst.de>\n" "---\n" " kernel/irq/affinity.c | 20 +++++++++++---------\n" " 1 file changed, 11 insertions(+), 9 deletions(-)\n" @@ -100,4 +106,4 @@ "-- \n" 2.7.2 -45015b6bf88a82c6e22541f59f832a2d5449e67d4475f8717c433d6206d49dba +a44532cc75712f49cd9d69475e0bbc7380e82b3635a449b6430c07a5b4b77e4e
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.