From: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
To: Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp>
Cc: akpm@linux-foundation.org, balbir@linux.vnet.ibm.com,
xemul@openvz.org, lizf@cn.fujitsu.com, yamamoto@valinux.co.jp,
hugh@veritas.com, minchan.kim@gmail.com, linux-mm@kvack.org
Subject: [PATCH] memcg fix handle swap cache (was Re: memcg: bad page at page migration)
Date: Sat, 7 Jun 2008 15:23:09 +0900 [thread overview]
Message-ID: <20080607152309.a003b181.kamezawa.hiroyu@jp.fujitsu.com> (raw)
In-Reply-To: <20080606221124.623847aa.nishimura@mxp.nes.nec.co.jp>
Nishimura-san, thank you for your precise report!.
I think this is a fix. could you try ?
Andrew, this is a fix on memcg-handle-swap-cache.patch
Tested on my x86-64 box and fixes the bug.
==
Now (-mm queue), SwapCache is handled by memcg.
But Handling migration of swap-cache was wrong.
Fix to call uncharge() after ClearPageSwapCache() as
__delete_from_swap_cache()(swap_state.c) does.
Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujtsu.com.
Index: linux-2.6.26-rc2-mm1/mm/migrate.c
===================================================================
--- linux-2.6.26-rc2-mm1.orig/mm/migrate.c
+++ linux-2.6.26-rc2-mm1/mm/migrate.c
@@ -358,10 +358,8 @@ static int migrate_page_move_mapping(str
__inc_zone_page_state(newpage, NR_FILE_PAGES);
write_unlock_irq(&mapping->tree_lock);
- if (!PageSwapCache(newpage)) {
+ if (!PageSwapCache(newpage))
mem_cgroup_uncharge_cache_page(page);
- } else
- mem_cgroup_uncharge_page(page);
return 0;
}
@@ -399,7 +397,15 @@ static void migrate_page_copy(struct pag
}
#ifdef CONFIG_SWAP
- ClearPageSwapCache(page);
+ if (PageSwapCache(page)) {
+ ClearPageSwapCache(page);
+ /*
+ * SwapCache is removed implicitly. Uncharge against swapcache
+ * should be called after ClearPageSwapCache() because
+ * mem_cgroup_uncharge_page checks the flag.
+ */
+ mem_cgroup_uncharge_page(page);
+ }
#endif
ClearPageActive(page);
ClearPagePrivate(page);
--
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>
next prev parent reply other threads:[~2008-06-07 6:23 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-06-06 13:11 memcg: bad page at page migration Daisuke Nishimura
2008-06-06 14:43 ` kamezawa.hiroyu
2008-06-06 14:58 ` kamezawa.hiroyu
2008-06-06 16:24 ` Balbir Singh
2008-06-07 6:23 ` KAMEZAWA Hiroyuki [this message]
2008-06-09 0:54 ` [PATCH] memcg fix handle swap cache (was Re: memcg: bad page at page migration) Daisuke Nishimura
2008-06-09 3:48 ` Daisuke Nishimura
2008-06-09 4:35 ` KAMEZAWA Hiroyuki
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=20080607152309.a003b181.kamezawa.hiroyu@jp.fujitsu.com \
--to=kamezawa.hiroyu@jp.fujitsu.com \
--cc=akpm@linux-foundation.org \
--cc=balbir@linux.vnet.ibm.com \
--cc=hugh@veritas.com \
--cc=linux-mm@kvack.org \
--cc=lizf@cn.fujitsu.com \
--cc=minchan.kim@gmail.com \
--cc=nishimura@mxp.nes.nec.co.jp \
--cc=xemul@openvz.org \
--cc=yamamoto@valinux.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