Re: [PATCH 2/4] maps: address based vma walking

From: Fengguang Wu
Date: Thu Aug 16 2007 - 22:55:44 EST


On Thu, Aug 16, 2007 at 09:16:17PM -0500, Matt Mackall wrote:
> On Fri, Aug 17, 2007 at 06:05:18AM +0800, Fengguang Wu wrote:
> > Split large vmas into page groups of proc_maps_private.batch_size bytes, and
> > iterate them one by one for seqfile->show. This allows us to export large scale
> > process address space information via the seqfile interface. The old behavior
> > of walking one vma at a time can be achieved by setting the batching size to
> > ~0UL.
> >
> > Cc: Matt Mackall <mpm@xxxxxxxxxxx>
> > Cc: Al Viro <viro@xxxxxxxxxxxxxxxx>
> > Signed-off-by: Fengguang Wu <wfg@xxxxxxxxxxxxxxxx>
> > ---
> > fs/proc/task_mmu.c | 105 ++++++++++++--------------------------
> > include/linux/proc_fs.h | 6 +-
> > mm/mempolicy.c | 2
> > 3 files changed, 38 insertions(+), 75 deletions(-)
> >
> > --- linux-2.6.23-rc2-mm2.orig/include/linux/proc_fs.h
> > +++ linux-2.6.23-rc2-mm2/include/linux/proc_fs.h
> > @@ -283,9 +283,9 @@ static inline struct proc_dir_entry *PDE
> > struct proc_maps_private {
> > struct pid *pid;
> > struct task_struct *task;
> > -#ifdef CONFIG_MMU
> > - struct vm_area_struct *tail_vma;
> > -#endif
> > + struct mm_struct *mm;
> > + /* walk min(batch_size, remaining_size_of(vma)) bytes at a time */
> > + unsigned long batch_size;
> > };
> >
> > #endif /* _LINUX_PROC_FS_H */
> > --- linux-2.6.23-rc2-mm2.orig/mm/mempolicy.c
> > +++ linux-2.6.23-rc2-mm2/mm/mempolicy.c
> > @@ -1937,7 +1937,5 @@ out:
> > seq_putc(m, '\n');
> > kfree(md);
> >
> > - if (m->count < m->size)
> > - m->version = (vma != priv->tail_vma) ? vma->vm_start : 0;
> > return 0;
> > }
>
> What's this bit for?

This function is called by show_numa_map_checked(), which in turn also
uses m_start/m_next/m_stop. m->version used to store start address of
vmas, but now may also point to the middle of a vma.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/