summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2010-09-21 07:57:19 +0200
committerGreg Kroah-Hartman <gregkh@suse.de>2011-03-21 12:45:44 -0700
commitd941cd42c4c5056eaffaa35fb30480effc9a5278 (patch)
treed216c19ab02b5c01aee6f2da75421bdb2f7ed7e8
parent1ecd68e25ed5ab04861ea146cc87ce936481d79f (diff)
downloadkernel-common-d941cd42c4c5056eaffaa35fb30480effc9a5278.tar.gz
kernel-common-d941cd42c4c5056eaffaa35fb30480effc9a5278.tar.bz2
kernel-common-d941cd42c4c5056eaffaa35fb30480effc9a5278.zip
percpu: fix pcpu_last_unit_cpu
commit 46b30ea9bc3698bc1d1e6fd726c9601d46fa0a91 upstream. pcpu_first/last_unit_cpu are used to track which cpu has the first and last units assigned. This in turn is used to determine the span of a chunk for man/unmap cache flushes and whether an address belongs to the first chunk or not in per_cpu_ptr_to_phys(). When the number of possible CPUs isn't power of two, a chunk may contain unassigned units towards the end of a chunk. The logic to determine pcpu_last_unit_cpu was incorrect when there was an unused unit at the end of a chunk. It failed to ignore the unused unit and assigned the unused marker NR_CPUS to pcpu_last_unit_cpu. This was discovered through kdump failure which was caused by malfunctioning per_cpu_ptr_to_phys() on a kvm setup with 50 possible CPUs by CAI Qian. Signed-off-by: Tejun Heo <tj@kernel.org> Reported-by: CAI Qian <caiqian@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r--mm/percpu.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/mm/percpu.c b/mm/percpu.c
index 083e7c91e5f6..9aea73cc647c 100644
--- a/mm/percpu.c
+++ b/mm/percpu.c
@@ -1724,9 +1724,9 @@ int __init pcpu_setup_first_chunk(const struct pcpu_alloc_info *ai,
if (pcpu_first_unit_cpu == NR_CPUS)
pcpu_first_unit_cpu = cpu;
+ pcpu_last_unit_cpu = cpu;
}
}
- pcpu_last_unit_cpu = cpu;
pcpu_nr_units = unit;
for_each_possible_cpu(cpu)