Skip to content

Commit

Permalink
percpu: explain why per_cpu_ptr_to_phys() is more complicated than ne…
Browse files Browse the repository at this point in the history
…cessary

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>
  • Loading branch information
Dave Young authored and Tejun Heo committed Nov 23, 2011
1 parent a855b84 commit 67589c7
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions mm/percpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -978,6 +978,17 @@ bool is_kernel_percpu_address(unsigned long addr)
* address. The caller is responsible for ensuring @addr stays valid
* until this function finishes.
*
* 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.
*
* RETURNS:
* The physical address for @addr.
*/
Expand Down

0 comments on commit 67589c7

Please sign in to comment.