Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1586120

Re: [PATCH] mm: memcontrol: provide shmem statistics

From Johannes Weiner <hannes@cmpxchg.org>
Newsgroups linux.kernel
Subject Re: [PATCH] mm: memcontrol: provide shmem statistics
Date 2017-02-22 13:50 +0100
Message-ID <tdEwN-1Jr-7@gated-at.bofh.it> (permalink)
References <tdlXb-5cZ-1@gated-at.bofh.it> <tdAjv-78i-11@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Wed, Feb 22, 2017 at 09:12:31AM +0100, Michal Hocko wrote:
> On Tue 21-02-17 11:43:43, Johannes Weiner wrote:
> > Cgroups currently don't report how much shmem they use, which can be
> > useful data to have, in particular since shmem is included in the
> > cache/file item while being reclaimed like anonymous memory.
> > 
> > Add a counter to track shmem pages during charging and uncharging.
> 
> Yes this is indeed useful. Accounting shmem to the page cache was a
> mistake because this is more than confusing. Sad we cannot fix that.

Agreed, this continues to cause confusion with many Linux users :(

> I would have just one concern with this patch. You are relying on
> PageSwapBacked check but it looks like we are going to implement
> MADV_FREE by dropping this flag. I know we do not support MADV_FREE
> on shared mappings but if we ever do then the accounting will become
> subtly broken. Can/Should we rely on shmem_mapping() check instead?

Yes, right now we do MADV_FREE only on private pages, so this patch is
safe with Shaohua's changes to how we use PG_swapbacked.

Should we support MADV_FREE on shared mappings in the future, using
shmem_mapping() for memcg accounting won't work unfortunately, because
shared pages are truncated from the page cache before uncharging, and
that clears the page->mapping pointer. However, in that case we could
probably unaccount the pages from shmem at the time of MADV_FREE, when
we clear the PG_swapbacked bit.

> Other than that the patch looks good to me.

Thanks!

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH] mm: memcontrol: provide shmem statistics Johannes Weiner <hannes@cmpxchg.org> - 2017-02-21 18:00 +0100
  Re: [PATCH] mm: memcontrol: provide shmem statistics Balbir Singh <bsingharora@gmail.com> - 2017-02-22 05:20 +0100
  Re: [PATCH] mm: memcontrol: provide shmem statistics Michal Hocko <mhocko@kernel.org> - 2017-02-22 09:20 +0100
    Re: [PATCH] mm: memcontrol: provide shmem statistics Johannes Weiner <hannes@cmpxchg.org> - 2017-02-22 13:50 +0100
      Re: [PATCH] mm: memcontrol: provide shmem statistics Michal Hocko <mhocko@kernel.org> - 2017-02-22 14:30 +0100

csiph-web