Commit 67589c71456b0346500629967292dea3802230b6
Committed by
Tejun Heo
1 parent
a855b84c3d
Exists in
master
and in
20 other branches
percpu: explain why per_cpu_ptr_to_phys() is more complicated than necessary
Add comments about current per_cpu_ptr_to_phys implementation to explain why the logic is more complicated than necessary. -tj: relocated comment into kerneldoc comment Signed-off-by: Dave Young <dyoung@redhat.com> Signed-off-by: Tejun Heo <tj@kernel.org>
Showing 1 changed file with 11 additions and 0 deletions Side-by-side Diff
mm/percpu.c
... | ... | @@ -978,6 +978,17 @@ |
978 | 978 | * address. The caller is responsible for ensuring @addr stays valid |
979 | 979 | * until this function finishes. |
980 | 980 | * |
981 | + * percpu allocator has special setup for the first chunk, which currently | |
982 | + * supports either embedding in linear address space or vmalloc mapping, | |
983 | + * and, from the second one, the backing allocator (currently either vm or | |
984 | + * km) provides translation. | |
985 | + * | |
986 | + * The addr can be tranlated simply without checking if it falls into the | |
987 | + * first chunk. But the current code reflects better how percpu allocator | |
988 | + * actually works, and the verification can discover both bugs in percpu | |
989 | + * allocator itself and per_cpu_ptr_to_phys() callers. So we keep current | |
990 | + * code. | |
991 | + * | |
981 | 992 | * RETURNS: |
982 | 993 | * The physical address for @addr. |
983 | 994 | */ |