linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Michal Hocko <mhocko@suse.cz>
To: David Rientjes <rientjes@google.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Johannes Weiner <hannes@cmpxchg.org>,
	KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>,
	linux-mm@kvack.org
Subject: Re: [patch] mm, memcg: add anon_hugepage stat
Date: Thu, 2 May 2013 16:17:09 +0200	[thread overview]
Message-ID: <20130502141709.GM1950@dhcp22.suse.cz> (raw)
In-Reply-To: <alpine.DEB.2.02.1304281432160.5570@chino.kir.corp.google.com>

On Sun 28-04-13 14:40:37, David Rientjes wrote:
> On Fri, 26 Apr 2013, Michal Hocko wrote:
> 
> > Yes, useful and I had it on my todo list for quite some time. Never got
> > to it though. Thanks!
> > 
> 
> I think I'll add an anon_pages counter as well for non-thp for comparison, 

I am not sure I understand. I assume you want to export the anon counter
as well, right? Wouldn't that be too confusing? Yes, rss is a terrible
name and mixing it with swapcache is arguably a good idea but are there
any cases where you want anon - swapcache?

> and probably do it in the same patch.
> 
> The problem is that we don't always have the memcg context for the page 
> when calling page_add_anon_rmap() or page_remove_rmap().
> 
>  [ An example in this patch is in page_remove_rmap() where I was calling 
>    mem_cgroup_update_page_stat() after mem_cgroup_uncharge_page(). ]
> 
> For example, in unuse_pte():
> 
> 	if (page == swapcache)
> 		page_add_anon_rmap(page, vma, addr);
> 	else /* ksm created a completely new copy */
> 		page_add_new_anon_rmap(page, vma, addr);
> 	mem_cgroup_commit_charge_swapin(page, memcg);
> 
> There are a couple of options to fix this and I really don't have a strong 
> preference for which one we go with:
> 
>  - pass struct mem_cgroup * to page_add_anon_rmap() and 
>    page_remove_rmap(), such as "memcg" in the above example), or
> 
>  - separate out the anon page/hugepage ZVC accounting entirely from these 
>    two functions and add a followup call to a new function dedicated for 
>    this purpose once the memcg commit has been done.
> 
> I'm leaning toward doing the latter just because it's cleaner, but it 
> means page_remove_rmap() picks up a return value (anon or not?) and 
> page_add_anon_rmap() picks up a return value (_mapcount == 0?).
> 
> Comments?

-- 
Michal Hocko
SUSE Labs

--
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>

  parent reply	other threads:[~2013-05-02 14:17 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-25 21:41 David Rientjes
2013-04-25 21:55 ` Andrew Morton
2013-04-25 23:07   ` David Rientjes
2013-04-26 11:17 ` Michal Hocko
2013-04-28 21:40   ` David Rientjes
2013-04-30  0:22     ` [patch] mm, memcg: add rss_huge stat to memory.stat David Rientjes
2013-04-30 17:36       ` Johannes Weiner
2013-05-02 14:17     ` Michal Hocko [this message]
2013-05-02 16:01       ` [patch] mm, memcg: add anon_hugepage stat David Rientjes

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=20130502141709.GM1950@dhcp22.suse.cz \
    --to=mhocko@suse.cz \
    --cc=akpm@linux-foundation.org \
    --cc=hannes@cmpxchg.org \
    --cc=kamezawa.hiroyu@jp.fujitsu.com \
    --cc=linux-mm@kvack.org \
    --cc=rientjes@google.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