From: Ying Han <yinghan@google.com>
To: Hugh Dickins <hughd@google.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>,
KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>,
Minchan Kim <minchan.kim@gmail.com>,
Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp>,
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: Tue, 17 May 2011 13:00:14 -0700 [thread overview]
Message-ID: <BANLkTinQR2BSdyPfgTaY3my4W28czuWqpg@mail.gmail.com> (raw)
In-Reply-To: <alpine.LSU.2.00.1105171120220.29593@sister.anvils>
[-- Attachment #1: Type: text/plain, Size: 2336 bytes --]
On Tue, May 17, 2011 at 11:24 AM, 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).
>
> We don't know the target mm in shmem_getpage(), so do it at the outer
> level in shmem_fault(); and it's easier to follow if we move the
> count_vm_event(PGMAJFAULT) there too.
>
> Hah, it was using __count_vm_event() before, sneaking that update into
> the unpreemptible section under info->lock: well, it comes to the same
> on x86 at least, and I still think it's best to keep these together.
>
> Signed-off-by: Hugh Dickins <hughd@google.com>
> ---
>
> mm/shmem.c | 13 ++++++-------
> 1 file changed, 6 insertions(+), 7 deletions(-)
>
> --- mmotm/mm/shmem.c 2011-05-13 14:57:45.367884578 -0700
> +++ linux/mm/shmem.c 2011-05-17 10:27:19.901934756 -0700
> @@ -1293,14 +1293,10 @@ repeat:
> swappage = lookup_swap_cache(swap);
> if (!swappage) {
> shmem_swp_unmap(entry);
> + spin_unlock(&info->lock);
> /* here we actually do the io */
> - if (type && !(*type & VM_FAULT_MAJOR)) {
> - __count_vm_event(PGMAJFAULT);
> - mem_cgroup_count_vm_event(current->mm,
> - PGMAJFAULT);
> + if (type)
> *type |= VM_FAULT_MAJOR;
> - }
> - spin_unlock(&info->lock);
> swappage = shmem_swapin(swap, gfp, info, idx);
> if (!swappage) {
> spin_lock(&info->lock);
> @@ -1539,7 +1535,10 @@ static int shmem_fault(struct vm_area_st
> error = shmem_getpage(inode, vmf->pgoff, &vmf->page, SGP_CACHE,
> &ret);
> if (error)
> return ((error == -ENOMEM) ? VM_FAULT_OOM :
> VM_FAULT_SIGBUS);
> -
> + if (ret & VM_FAULT_MAJOR) {
> + count_vm_event(PGMAJFAULT);
> + mem_cgroup_count_vm_event(vma->vm_mm, PGMAJFAULT);
> + }
> return ret | VM_FAULT_LOCKED;
> }
>
> Thank you Hugh for the fix.
Acked-by: Ying Han<yinghan@google.com>
--Ying
[-- Attachment #2: Type: text/html, Size: 3366 bytes --]
next prev parent reply other threads:[~2011-05-17 20:00 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-17 18:24 [PATCH mmotm] add the pagefault count into memcg stats: shmem fix Hugh Dickins
2011-05-17 20:00 ` Ying Han [this message]
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
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=BANLkTinQR2BSdyPfgTaY3my4W28czuWqpg@mail.gmail.com \
--to=yinghan@google.com \
--cc=akpm@linux-foundation.org \
--cc=balbir@linux.vnet.ibm.com \
--cc=hughd@google.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 \
/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).