From d83e277a101d82286748bf8d7385bcd065c701c9 Mon Sep 17 00:00:00 2001 From: Mel Gorman Date: Mon, 24 May 2010 14:32:19 -0700 Subject: [PATCH] --- yaml --- r: 198239 b: refs/heads/master c: 67b9509b2c68ae38cecb83a239881cb0ddf087dc h: refs/heads/master i: 198237: 5a639abd0da5a559182465258f8974dc1ea3f2db 198235: b85fa9c0d2efbb529189a23605c3927fe1836608 198231: 0b70a64e2546f44aaf37523634c89cf0bccad8bf 198223: a6ae2c77ee79552c4e1cc5c151d3a821e1ae9ab3 198207: 8996e928b519fc285b4a0af84240dc8f97143e0d v: v3 --- [refs] | 2 +- trunk/mm/migrate.c | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/[refs] b/[refs] index af1843fd61ca..b715a7820701 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 7f60c214fd3a360461f3286c6908084f7f8b1950 +refs/heads/master: 67b9509b2c68ae38cecb83a239881cb0ddf087dc diff --git a/trunk/mm/migrate.c b/trunk/mm/migrate.c index 42a3d24d1107..b114635962dc 100644 --- a/trunk/mm/migrate.c +++ b/trunk/mm/migrate.c @@ -600,6 +600,17 @@ static int unmap_and_move(new_page_t get_new_page, unsigned long private, if (PageAnon(page)) { rcu_read_lock(); rcu_locked = 1; + + /* + * If the page has no mappings any more, just bail. An + * unmapped anon page is likely to be freed soon but worse, + * it's possible its anon_vma disappeared between when + * the page was isolated and when we reached here while + * the RCU lock was not held + */ + if (!page_mapped(page)) + goto rcu_unlock; + anon_vma = page_anon_vma(page); atomic_inc(&anon_vma->external_refcount); }