• David Rientjes's avatar
    smaps: extract pmd walker from smaps code · 826fad1b
    David Rientjes authored
    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 <hugh@veritas.com>
    Cc: Paul Mundt <lethal@linux-sh.org>
    Cc: Christoph Lameter <clameter@sgi.com>
    Signed-off-by: default avatarDavid Rientjes <rientjes@google.com>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    826fad1b
task_mmu.c 11.5 KB