linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: David Rientjes <rientjes@google.com>
To: Michal Hocko <mhocko@suse.cz>
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: Sun, 28 Apr 2013 14:40:37 -0700 (PDT)	[thread overview]
Message-ID: <alpine.DEB.2.02.1304281432160.5570@chino.kir.corp.google.com> (raw)
In-Reply-To: <20130426111739.GF31157@dhcp22.suse.cz>

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

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

  reply	other threads:[~2013-04-28 21:40 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 [this message]
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     ` [patch] mm, memcg: add anon_hugepage stat Michal Hocko
2013-05-02 16:01       ` 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=alpine.DEB.2.02.1304281432160.5570@chino.kir.corp.google.com \
    --to=rientjes@google.com \
    --cc=akpm@linux-foundation.org \
    --cc=hannes@cmpxchg.org \
    --cc=kamezawa.hiroyu@jp.fujitsu.com \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox