linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp>
To: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
	linux-mm <linux-mm@kvack.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Lee Schermerhorn <Lee.Schermerhorn@hp.com>,
	Rik van Riel <riel@redhat.com>,
	KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>,
	Balbir Singh <balbir@linux.vnet.ibm.com>
Subject: Re: [-mm][PATCH 9/10]  memcg: fix mem_cgroup_end_migration() race
Date: Wed, 25 Jun 2008 19:53:55 +0900	[thread overview]
Message-ID: <20080625195355.6f452a4f.nishimura@mxp.nes.nec.co.jp> (raw)
In-Reply-To: <20080625190914.D867.KOSAKI.MOTOHIRO@jp.fujitsu.com>

On Wed, 25 Jun 2008 19:10:11 +0900, KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com> wrote:
> 
> =
> From: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
> 
> In general, mem_cgroup's charge on ANON page is removed when page_remove_rmap()
> is called.
> 
> At migration, the newpage is remapped again by remove_migration_ptes(). But
> pte may be already changed (by task exits).
> It is charged at page allocation but have no chance to be uncharged in that
> case because it is never added to rmap.
> 
> Handle that corner case in mem_cgroup_end_migration().
> 
> 
Sorry for late reply.

I've confirmed that this patch fixes the bad page problem
I had been seeing on my test(survived more than 28h w/o errors).

> Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
> Acked-by: Balbir Singh <balbir@linux.vnet.ibm.com>
> Signed-off-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
> 

Tested-by: Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp>


Thanks,
Daisuke Nishimura.

> ---
>  mm/memcontrol.c |   14 +++++++++++++-
>  1 file changed, 13 insertions(+), 1 deletion(-)
> 
> Index: b/mm/memcontrol.c
> ===================================================================
> --- a/mm/memcontrol.c
> +++ b/mm/memcontrol.c
> @@ -747,10 +747,22 @@ int mem_cgroup_prepare_migration(struct 
>  /* remove redundant charge if migration failed*/
>  void mem_cgroup_end_migration(struct page *newpage)
>  {
> -	/* At success, page->mapping is not NULL and nothing to do. */
> +	/*
> +	 * At success, page->mapping is not NULL.
> +	 * special rollback care is necessary when
> +	 * 1. at migration failure. (newpage->mapping is cleared in this case)
> +	 * 2. the newpage was moved but not remapped again because the task
> +	 *    exits and the newpage is obsolete. In this case, the new page
> +	 *    may be a swapcache. So, we just call mem_cgroup_uncharge_page()
> +	 *    always for avoiding mess. The  page_cgroup will be removed if
> +	 *    unnecessary. File cache pages is still on radix-tree. Don't
> +	 *    care it.
> +	 */
>  	if (!newpage->mapping)
>  		__mem_cgroup_uncharge_common(newpage,
>  					 MEM_CGROUP_CHARGE_TYPE_FORCE);
> +	else if (PageAnon(newpage))
> +		mem_cgroup_uncharge_page(newpage);
>  }
>  
>  /*
> 
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/

--
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:[~2008-06-25 10:53 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-25  9:59 [-mm][PATCH 0/10] memory related bugfix set for 2.6.26-rc5-mm3 v2 KOSAKI Motohiro
2008-06-25 10:01 ` [-mm][PATCH 1/10] fix UNEVICTABLE_LRU and !PROC_PAGE_MONITOR build KOSAKI Motohiro
2008-07-03  5:36   ` Andrew Morton
2008-07-03  6:02     ` KOSAKI Motohiro
2008-07-03 13:16       ` Rik van Riel
2008-06-25 10:02 ` [-mm][PATCH 2/10] fix printk in show_free_areas() KOSAKI Motohiro
2008-06-25 10:03 ` [-mm][PATCH 3/10] fix munlock page table walk - now requires 'mm' KOSAKI Motohiro
2008-06-25 10:04 ` [-mm][PATCH 4/10] fix migration_entry_wait() for speculative page cache KOSAKI Motohiro
2008-06-25 10:05 ` [-mm][PATCH 5/10] collect lru meminfo statistics from correct offset KOSAKI Motohiro
2008-06-25 10:06 ` [-mm][PATCH 6/10] fix incorrect Mlocked field of /proc/meminfo KOSAKI Motohiro
2008-06-25 10:07 ` [-mm][PATCH 7/10] prevent incorrect oom under split_lru KOSAKI Motohiro
2008-06-25 10:09 ` [-mm][PATCH 8/10] fix shmem page migration incorrectness on memcgroup KOSAKI Motohiro
2008-06-27  5:08   ` MinChan Kim
2008-06-27  5:41     ` KOSAKI Motohiro
2008-06-27  7:57       ` MinChan Kim
2008-06-27  8:52         ` KAMEZAWA Hiroyuki
2008-06-27  9:29           ` Daisuke Nishimura
2008-06-27 10:13           ` MinChan Kim
2008-06-27 12:24           ` kamezawa.hiroyu
2008-06-25 10:10 ` [-mm][PATCH 9/10] memcg: fix mem_cgroup_end_migration() race KOSAKI Motohiro
2008-06-25 10:53   ` Daisuke Nishimura [this message]
2008-06-25 10:11 ` [-mm][PATCH 10/10] putback_lru_page()/unevictable page handling rework v4 KOSAKI Motohiro
2008-06-25 10:14   ` KOSAKI Motohiro
2008-06-25 22:13     ` Andrew Morton
2008-06-26  1:31       ` KOSAKI Motohiro
2008-06-25 16:29   ` Lee Schermerhorn
2008-06-26  8:08     ` KOSAKI Motohiro
2008-06-25 15:09 ` [-mm][PATCH 0/10] memory related bugfix set for 2.6.26-rc5-mm3 v2 Lee Schermerhorn

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=20080625195355.6f452a4f.nishimura@mxp.nes.nec.co.jp \
    --to=nishimura@mxp.nes.nec.co.jp \
    --cc=Lee.Schermerhorn@hp.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-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=riel@redhat.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