From: Sandeep Patil <sspatil@android.com>
To: Vlastimil Babka <vbabka@suse.cz>
Cc: Andrew Morton <akpm@linux-foundation.org>,
adobriyan@gmail.com, avagin@openvz.org,
linux-fsdevel@vger.kernel.org, linux-mm@kvack.org,
linux-kernel@vger.kernel.org, stable@vger.kernel.org,
kernel-team@android.com, dancol@google.com
Subject: Re: [PATCH] mm: proc: smaps_rollup: Fix pss_locked calculation
Date: Sat, 2 Feb 2019 22:21:14 -0800 [thread overview]
Message-ID: <20190203062114.GC235465@google.com> (raw)
In-Reply-To: <b15205cd-33e3-6cac-b6a4-65266be7a9c8@suse.cz>
On Tue, Jan 29, 2019 at 04:52:21PM +0100, Vlastimil Babka wrote:
> On 1/29/19 1:15 AM, Andrew Morton wrote:
> > On Sun, 20 Jan 2019 17:10:49 -0800 Sandeep Patil <sspatil@android.com> wrote:
> >
> >> The 'pss_locked' field of smaps_rollup was being calculated incorrectly
> >> as it accumulated the current pss everytime a locked VMA was found.
> >>
> >> Fix that by making sure we record the current pss value before each VMA
> >> is walked. So, we can only add the delta if the VMA was found to be
> >> VM_LOCKED.
> >>
> >> ...
> >>
> >> --- a/fs/proc/task_mmu.c
> >> +++ b/fs/proc/task_mmu.c
> >> @@ -709,6 +709,7 @@ static void smap_gather_stats(struct vm_area_struct *vma,
> >> #endif
> >> .mm = vma->vm_mm,
> >> };
> >> + unsigned long pss;
> >>
> >> smaps_walk.private = mss;
> >>
> >> @@ -737,11 +738,12 @@ static void smap_gather_stats(struct vm_area_struct *vma,
> >> }
> >> }
> >> #endif
> >> -
> >> + /* record current pss so we can calculate the delta after page walk */
> >> + pss = mss->pss;
> >> /* mmap_sem is held in m_start */
> >> walk_page_vma(vma, &smaps_walk);
> >> if (vma->vm_flags & VM_LOCKED)
> >> - mss->pss_locked += mss->pss;
> >> + mss->pss_locked += mss->pss - pss;
> >> }
> >
> > This seems to be a rather obscure way of accumulating
> > mem_size_stats.pss_locked. Wouldn't it make more sense to do this in
> > smaps_account(), wherever we increment mem_size_stats.pss?
> >
> > It would be a tiny bit less efficient but I think that the code cleanup
> > justifies such a cost?
>
> Yeah, Sandeep could you add 'bool locked' param to smaps_account() and check it
> there? We probably don't need the whole vma param yet.
Agree, I will send -v2 shortly.
- ssp
prev parent reply other threads:[~2019-02-03 6:21 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-21 1:10 [PATCH] mm: proc: smaps_rollup: Fix pss_locked calculation Sandeep Patil
2019-01-23 22:57 ` Sasha Levin
2019-01-23 22:57 ` Sasha Levin
2019-01-24 21:39 ` Sandeep Patil
2019-01-25 6:21 ` Greg KH
2019-01-29 0:15 ` Andrew Morton
2019-01-29 15:52 ` Vlastimil Babka
2019-02-03 6:21 ` Sandeep Patil [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190203062114.GC235465@google.com \
--to=sspatil@android.com \
--cc=adobriyan@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=avagin@openvz.org \
--cc=dancol@google.com \
--cc=kernel-team@android.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=stable@vger.kernel.org \
--cc=vbabka@suse.cz \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.