diff options
author | Thomas Gleixner <tglx@linutronix.de> | 2017-06-20 01:37:42 +0200 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2017-06-22 18:21:21 +0200 |
commit | 52b166af40faec9813cd5ac26d6ba9adec2e3a9d (patch) | |
tree | ba7db235f86582734cc1f24659994d1ec0014368 /arch/x86/kernel/apic/apic.c | |
parent | x86/uv: Use default_cpu_mask_to_apicid_and() (diff) | |
download | linux-52b166af40faec9813cd5ac26d6ba9adec2e3a9d.tar.xz linux-52b166af40faec9813cd5ac26d6ba9adec2e3a9d.zip |
x86/apic: Move online masking to core code
All implementations of apic->cpu_mask_to_apicid_and() mask out the offline
cpus. The callsite already has a mask available, which has the offline CPUs
removed. Use that and remove the extra bits.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Jens Axboe <axboe@kernel.dk>
Cc: Marc Zyngier <marc.zyngier@arm.com>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Keith Busch <keith.busch@intel.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Christoph Hellwig <hch@lst.de>
Link: http://lkml.kernel.org/r/20170619235446.560868224@linutronix.de
Diffstat (limited to 'arch/x86/kernel/apic/apic.c')
-rw-r--r-- | arch/x86/kernel/apic/apic.c | 27 |
1 files changed, 9 insertions, 18 deletions
diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c index e9b322f05051..8a0bde3fc488 100644 --- a/arch/x86/kernel/apic/apic.c +++ b/arch/x86/kernel/apic/apic.c @@ -2205,19 +2205,12 @@ int default_cpu_mask_to_apicid_and(const struct cpumask *cpumask, const struct cpumask *andmask, unsigned int *apicid) { - unsigned int cpu; + unsigned int cpu = cpumask_first_and(cpumask, andmask); - for_each_cpu_and(cpu, cpumask, andmask) { - if (cpumask_test_cpu(cpu, cpu_online_mask)) - break; - } - - if (likely(cpu < nr_cpu_ids)) { - *apicid = per_cpu(x86_cpu_to_apicid, cpu); - return 0; - } - - return -EINVAL; + if (cpu >= nr_cpu_ids) + return -EINVAL; + *apicid = per_cpu(x86_cpu_to_apicid, cpu); + return 0; } int flat_cpu_mask_to_apicid_and(const struct cpumask *cpumask, @@ -2226,14 +2219,12 @@ int flat_cpu_mask_to_apicid_and(const struct cpumask *cpumask, { unsigned long cpu_mask = cpumask_bits(cpumask)[0] & cpumask_bits(andmask)[0] & - cpumask_bits(cpu_online_mask)[0] & APIC_ALL_CPUS; - if (likely(cpu_mask)) { - *apicid = (unsigned int)cpu_mask; - return 0; - } - return -EINVAL; + if (!cpu_mask) + return -EINVAL; + *apicid = (unsigned int)cpu_mask; + return 0; } /* |