linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: + mm-proc-pid-smaps_rollup-convert-to-single-value-seq_file.patch added to -mm tree
       [not found] <20180723235548.nLTzP%akpm@linux-foundation.org>
@ 2018-07-24 18:29 ` Alexey Dobriyan
  0 siblings, 0 replies; only message in thread
From: Alexey Dobriyan @ 2018-07-24 18:29 UTC (permalink / raw)
  To: akpm; +Cc: linux-kernel, dancol, vbabka

On Mon, Jul 23, 2018 at 04:55:48PM -0700, akpm@linux-foundation.org wrote:
> The patch titled
>      Subject: mm: /proc/pid/smaps_rollup: convert to single value seq_file
> has been added to the -mm tree.  Its filename is
>      mm-proc-pid-smaps_rollup-convert-to-single-value-seq_file.patch

> Subject: mm: /proc/pid/smaps_rollup: convert to single value seq_file
> 
> The /proc/pid/smaps_rollup file is currently implemented via the
> m_start/m_next/m_stop seq_file iterators shared with the other maps files,
> that iterate over vma's.  However, the rollup file doesn't print anything
> for each vma, only accumulate the stats.

What I don't understand why keep seq_ops then and not do all the work in
->show hook.  Currently /proc/*/smaps_rollup is at ~500 bytes so with
minimum 1 page seq buffer, no buffer resizing is possible.

> +static int show_smaps_rollup(struct seq_file *m, void *v)
> +{
> +	struct proc_maps_private *priv = m->private;
> +	struct mem_size_stats *mss = priv->rollup;
> +	struct vm_area_struct *vma;
> +
> +	/*
> +	 * We might be called multiple times when e.g. the seq buffer
> +	 * overflows. Gather the stats only once.

It doesn't!

> +	if (!mss->finished) {
> +		for (vma = priv->mm->mmap; vma; vma = vma->vm_next) {
> +			smap_gather_stats(vma, mss);
> +			mss->last_vma_end = vma->vm_end;
>  		}
> -		last_vma = !m_next_vma(priv, vma);
> -	} else {
> -		rollup_mode = false;
> -		memset(&mss_stack, 0, sizeof(mss_stack));
> -		mss = &mss_stack;

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2018-07-24 18:29 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20180723235548.nLTzP%akpm@linux-foundation.org>
2018-07-24 18:29 ` + mm-proc-pid-smaps_rollup-convert-to-single-value-seq_file.patch added to -mm tree Alexey Dobriyan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).