Re: [PATCH] x86: Add check for number of available vectors beforeCPU down [v4]

From: Chen, Gong
Date: Thu Jan 02 2014 - 21:44:59 EST


Add some nitpicks below.

Reviewed-by: Chen, Gong <gong.chen@xxxxxxxxxxxxxxx>

On Thu, Jan 02, 2014 at 07:47:24PM -0500, Prarit Bhargava wrote:
> +int check_irq_vectors_for_cpu_disable(void)
> +{
> + int irq, cpu;
> + unsigned int vector, this_count, count;
> + struct irq_desc *desc;
> + struct irq_data *data;
> + struct cpumask affinity_new, online_new;
> +
> + cpumask_copy(&online_new, cpu_online_mask);
> + cpu_clear(smp_processor_id(), online_new);
I notice that you use smp_processor_id() many times. Maybe we can
save it first for speed.

> +
> + this_count = 0;
> + for (vector = FIRST_EXTERNAL_VECTOR; vector < NR_VECTORS; vector++) {
> + irq = __this_cpu_read(vector_irq[vector]);
> + if (irq >= 0) {
> + desc = irq_to_desc(irq);
> + data = irq_desc_get_irq_data(desc);
> + cpumask_copy(&affinity_new, data->affinity);
> + cpu_clear(smp_processor_id(), affinity_new);
> + /*
> + * Only count active non-percpu irqs, and those
> + * irqs that are not linked to on an online cpu; in
> + * fixup_irqs(), chip->irq_set_affinity() will be
> + * called which will set vector_irq[irq] for each
> + * cpu.
> + */
> + if (irq_has_action(irq) && !irqd_is_per_cpu(data) &&
> + (cpumask_empty(&affinity_new) ||
> + !cpumask_subset(&affinity_new, &online_new)))
> + this_count++;
Would you please add some extra comments to describe these two different
conditions that cpumask is empty and non-empty. I feel it is a little bit
sutble and I don't expect I'm confused by myself one day :-).

Attachment: signature.asc
Description: Digital signature