diff options
author | Hugh Dickins <hughd@google.com> | 2012-04-18 23:34:46 -0700 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-04-22 15:39:16 -0700 |
commit | e31c1287e43fb65773fba0e9f2b2ec418268a45d (patch) | |
tree | 03f75e6782f1ee6dad891540081f36af8974b57e /mm | |
parent | 9462c8836507a4ed5bc677c702582f3f5f77eb86 (diff) |
memcg: fix Bad page state after replace_page_cache
commit 9b7f43afd417a6feb80841d30ced4051c362eb5d upstream.
My 9ce70c0240d0 "memcg: fix deadlock by inverting lrucare nesting" put a
nasty little bug into v3.3's version of mem_cgroup_replace_page_cache(),
sometimes used for FUSE. Replacing __mem_cgroup_commit_charge_lrucare()
by __mem_cgroup_commit_charge(), I used the "pc" pointer set up earlier:
but it's for oldpage, and needs now to be for newpage. Once oldpage was
freed, its PageCgroupUsed bit (cleared above but set again here) caused
"Bad page state" messages - and perhaps worse, being missed from newpage.
(I didn't find this by using FUSE, but in reusing the function for tmpfs.)
Signed-off-by: Hugh Dickins <hughd@google.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'mm')
-rw-r--r-- | mm/memcontrol.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/mm/memcontrol.c b/mm/memcontrol.c index cd412fc9b80..6fe7afe66a7 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -3350,6 +3350,7 @@ void mem_cgroup_replace_page_cache(struct page *oldpage, * the newpage may be on LRU(or pagevec for LRU) already. We lock * LRU while we overwrite pc->mem_cgroup. */ + pc = lookup_page_cgroup(newpage); __mem_cgroup_commit_charge(memcg, newpage, 1, pc, type, true); } |