smaps: extract pmd walker from smaps code
authorDavid Rientjes <[email protected]>
Sun, 6 May 2007 21:49:21 +0000 (14:49 -0700)
committerLinus Torvalds <[email protected]>
Mon, 7 May 2007 19:12:52 +0000 (12:12 -0700)
commit826fad1b93fdb4ffacfd9cd860f06140e852e377
tree8135bd60f839a83521d457904e4d2578203df339
parent0013572b2ae535bfd6314f22d9aef53725ea00d8
smaps: extract pmd walker from smaps code

Extracts the pmd walker from smaps-specific code in fs/proc/task_mmu.c.

The new struct pmd_walker includes the struct vm_area_struct of the memory to
walk over.  Iteration begins at the vma->vm_start and completes at
vma->vm_end.  A pointer to another data structure may be stored in the private
field such as struct mem_size_stats, which acts as the smaps accumulator.  For
each pmd in the VMA, the action function is called with a pointer to its
struct vm_area_struct, a pointer to the pmd_t, its start and end addresses,
and the private field.

The interface for walking pmd's in a VMA for fs/proc/task_mmu.c is now:

void for_each_pmd(struct vm_area_struct *vma,
  void (*action)(struct vm_area_struct *vma,
 pmd_t *pmd, unsigned long addr,
 unsigned long end,
 void *private),
  void *private);

Since the pmd walker is now extracted from the smaps code, smaps_one_pmd() is
invoked for each pmd in the VMA.  Its behavior and efficiency is identical to
the existing implementation.

Cc: Hugh Dickins <[email protected]>
Cc: Paul Mundt <[email protected]>
Cc: Christoph Lameter <[email protected]>
Signed-off-by: David Rientjes <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
fs/proc/task_mmu.c