Skip to contentSkip to conversation

percpu: add comment to per_cpu_ptr_to_phys

PATCH In review Dave Young 2 participants 2 messages Nov 23, 2011

Subsystems (4)
lore
Share & tools
lore

Dave Young

author
#0 lore raw

PATCH 1/1 percpu: add comment to per_cpu_ptr_to_phys

add comments about current per_cpu_ptr_to_phys implementation to explain why the logic is more complicated than necessary.

---
 mm/percpu.c |   13 +++++++++++++
 1 file changed, 13 insertions(+)
mm/percpu.c +13 -0
@@ -988,6 +988,19 @@ phys_addr_t per_cpu_ptr_to_phys(void *ad
 	unsigned int cpu;
 
 	/*
+	 * percpu allocator has special setup for the first chunk,
+	 * which currently supports either embedding in linear address space
+	 * or vmalloc mapping, and, from the second one, the backing
+	 * allocator (currently either vm or km) provides translation.
+	 *
+	 * The addr can be tranlated simply without checking if it falls
+	 * into the first chunk. But the current code reflects better
+	 * how percpu allocator actually works, and the verification can
+	 * discover both bugs in percpu allocator itself and
+	 * per_cpu_ptr_to_phys() callers. So we keep current code.
+	 */
+
+	/*
 	 * The following test on first_start/end isn't strictly
 	 * necessary but will speed up lookups of addresses which
 	 * aren't in the first chunk.

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

maintainer
#1 lore raw

Hello,

Quoted 4 lines · Dave Young

add comments about current per_cpu_ptr_to_phys implementation to explain why the logic is more complicated than necessary.

Moved the comment into the kerneldoc comment and applied to percpu/for-3.2-fixes.

Thank you very much.

Signature · 1 line
tejun