2.6.32-stable review patch. If anyone has any objections, please let us know.

------------------

From: Tejun Heo <tj@kernel.org>

commit 46b30ea9bc3698bc1d1e6fd726c9601d46fa0a91 upstream.

pcpu_first/last_unit_cpu are used to track which cpu has the first andlast units assigned. This in turn is used to determine the span of achunk for man/unmap cache flushes and whether an address belongs tothe first chunk or not in per_cpu_ptr_to_phys().

When the number of possible CPUs isn't power of two, a chunk maycontain unassigned units towards the end of a chunk. The logic todetermine pcpu_last_unit_cpu was incorrect when there was an unusedunit at the end of a chunk. It failed to ignore the unused unit andassigned the unused marker NR_CPUS to pcpu_last_unit_cpu.

This was discovered through kdump failure which was caused bymalfunctioning per_cpu_ptr_to_phys() on a kvm setup with 50 possibleCPUs by CAI Qian.