linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Hugh Dickins <hughd@google.com>
To: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp>,
	Andrew Morton <akpm@linux-foundation.org>,
	Ying Han <yinghan@google.com>,
	KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>,
	Minchan Kim <minchan.kim@gmail.com>,
	Balbir Singh <balbir@linux.vnet.ibm.com>,
	linux-mm@kvack.org
Subject: Re: [PATCH mmotm] add the pagefault count into memcg stats: shmem fix
Date: Wed, 18 May 2011 18:54:41 -0700 (PDT)	[thread overview]
Message-ID: <alpine.LSU.2.00.1105181836110.1690@sister.anvils> (raw)
In-Reply-To: <20110519093839.38820e23.kamezawa.hiroyu@jp.fujitsu.com>

On Thu, 19 May 2011, KAMEZAWA Hiroyuki wrote:
> On Wed, 18 May 2011 11:25:48 -0700 (PDT)
> Hugh Dickins <hughd@google.com> wrote:
> 
> > On Wed, 18 May 2011, Daisuke Nishimura wrote:
> > > On Tue, 17 May 2011 11:24:40 -0700 (PDT)
> > > Hugh Dickins <hughd@google.com> wrote:
> > > 
> > > > mem_cgroup_count_vm_event() should update the PGMAJFAULT count for the
> > > > target mm, not for current mm (but of course they're usually the same).
> > > > 
> > > hmm, why ?
> > > In shmem_getpage(), we charge the page to the memcg where current mm belongs to,
> > 
> > (In the case when it's this fault which is creating the page.
> > Just as when filemap_fault() reads in the page, add_to_page_cache
> > will charge it to the current->mm's memcg, yes.  Arguably correct.)
> > 
> > > so I think counting vm events of the memcg is right.
> > 
> > It should be consistent with which task gets the maj_flt++, and
> > it should be consistent with filemap_fault(), and it should be a
> > subset of what's counted by mem_cgroup_count_vm_event(mm, PGFAULT).
> > 
> > In each case, those work on target mm rather than current->mm.
> > 
> 
> Hmm, I have no strong opinion on this but yes, it makes sense to account
> PGMAJFLT to the process whose mm->maj_flt++.

mm->maj_flt++ would be yet another story!  But it's tsk->maj_flt++.

> BTW,  do you think memcg should
> account shmem into vma->vm_mm rather than current->mm ? When vma->vm_mm
> is different from current ? At get_user_pages() + MAJFLT ?

If what we have at present works well enough, I don't think we should
risk breaking it with a funny change like that.

Is there a reason to treat shmem differently from filemap there?
You can argue that if it's shm then yes, but if it's tmpfs then no.

I suppose shmem.c does usually know the difference (by VM_NORESERVE),
but does not export it; and I'd prefer to keep it that way.

Unless we've got a real bug to fix here, let's not mess with it.

Hugh

--
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/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2011-05-19  1:54 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-17 18:24 Hugh Dickins
2011-05-17 20:00 ` Ying Han
2011-05-18  5:43 ` Daisuke Nishimura
2011-05-18 18:25   ` Hugh Dickins
2011-05-19  0:38     ` KAMEZAWA Hiroyuki
2011-05-19  1:54       ` Hugh Dickins [this message]
2011-05-19  2:16     ` Daisuke Nishimura
2011-05-18 18:32 ` Balbir Singh
2011-05-18 23:17 ` Minchan Kim
2011-05-19  0:28   ` Hugh Dickins
2011-05-19  0:37     ` Minchan Kim
2011-05-19  1:35       ` Hugh Dickins
2011-05-22 23:31 ` Minchan Kim

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.LSU.2.00.1105181836110.1690@sister.anvils \
    --to=hughd@google.com \
    --cc=akpm@linux-foundation.org \
    --cc=balbir@linux.vnet.ibm.com \
    --cc=kamezawa.hiroyu@jp.fujitsu.com \
    --cc=kosaki.motohiro@jp.fujitsu.com \
    --cc=linux-mm@kvack.org \
    --cc=minchan.kim@gmail.com \
    --cc=nishimura@mxp.nes.nec.co.jp \
    --cc=yinghan@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