From: Minchan Kim <minchan@kernel.org>
To: Jerome Marchand <jmarchan@redhat.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
Hugh Dickins <hughd@google.com>,
Bongkyu Kim <bongkyu.kim@lge.com>,
Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>,
Jonathan Corbet <corbet@lwn.net>
Subject: Re: [PATCH v2] mm: show proportional swap share of the mapping
Date: Wed, 29 Jul 2015 19:30:11 +0900 [thread overview]
Message-ID: <20150729102849.GA19352@bgram> (raw)
In-Reply-To: <55B88FF1.7050502@redhat.com>
Hi Jerome,
On Wed, Jul 29, 2015 at 10:33:53AM +0200, Jerome Marchand wrote:
> On 06/15/2015 03:06 PM, Minchan Kim wrote:
> > We want to know per-process workingset size for smart memory management
> > on userland and we use swap(ex, zram) heavily to maximize memory efficiency
> > so workingset includes swap as well as RSS.
> >
> > On such system, if there are lots of shared anonymous pages, it's
> > really hard to figure out exactly how many each process consumes
> > memory(ie, rss + wap) if the system has lots of shared anonymous
> > memory(e.g, android).
> >
> > This patch introduces SwapPss field on /proc/<pid>/smaps so we can get
> > more exact workingset size per process.
> >
> > Bongkyu tested it. Result is below.
> >
> > 1. 50M used swap
> > SwapTotal: 461976 kB
> > SwapFree: 411192 kB
> >
> > $ adb shell cat /proc/*/smaps | grep "SwapPss:" | awk '{sum += $2} END {print sum}';
> > 48236
> > $ adb shell cat /proc/*/smaps | grep "Swap:" | awk '{sum += $2} END {print sum}';
> > 141184
>
> Hi Minchan,
>
> I just found out about this patch. What kind of shared memory is that?
> Since it's android, I'm inclined to think something specific like
> ashmem. I'm asking because this patch won't help for more common type of
> shared memory. See my comment below.
It's normal heap of parent(IOW, MAP_ANON|MAP_PRIVATE memory which is share
by child processes).
>
> >
> > 2. 240M used swap
> > SwapTotal: 461976 kB
> > SwapFree: 216808 kB
> >
> > $ adb shell cat /proc/*/smaps | grep "SwapPss:" | awk '{sum += $2} END {print sum}';
> > 230315
> > $ adb shell cat /proc/*/smaps | grep "Swap:" | awk '{sum += $2} END {print sum}';
> > 1387744
> >
> snip
> > diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c
> > index 6dee68d013ff..d537899f4b25 100644
> > --- a/fs/proc/task_mmu.c
> > +++ b/fs/proc/task_mmu.c
> > @@ -446,6 +446,7 @@ struct mem_size_stats {
> > unsigned long anonymous_thp;
> > unsigned long swap;
> > u64 pss;
> > + u64 swap_pss;
> > };
> >
> > static void smaps_account(struct mem_size_stats *mss, struct page *page,
> > @@ -492,9 +493,20 @@ static void smaps_pte_entry(pte_t *pte, unsigned long addr,
> > } else if (is_swap_pte(*pte)) {
>
> This won't work for sysV shm, tmpfs and MAP_SHARED | MAP_ANONYMOUS
> mapping pages which are pte_none when paged out. They're currently not
> accounted at all when in swap.
This patch doesn't handle those pages because we don't have supported
thoses pages. IMHO, if someone need it, it should be another patch and
he can contribute it in future.
Thanks.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2015-07-29 10:30 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-15 13:06 [PATCH v2] mm: show proportional swap share of the mapping Minchan Kim
2015-07-07 13:47 ` Minchan Kim
2015-07-14 21:07 ` Andrew Morton
2015-07-15 23:49 ` Minchan Kim
2015-07-29 8:33 ` Jerome Marchand
2015-07-29 10:30 ` Minchan Kim [this message]
2015-07-29 11:56 ` Jerome Marchand
2015-08-05 11:38 ` Vlastimil Babka
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=20150729102849.GA19352@bgram \
--to=minchan@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=bongkyu.kim@lge.com \
--cc=corbet@lwn.net \
--cc=hughd@google.com \
--cc=jmarchan@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=sergey.senozhatsky.work@gmail.com \
/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 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).