From 254ab2882a1ef244246b2a3d18c7d1f4b20d1678 Mon Sep 17 00:00:00 2001 From: Linus Torvalds Date: Sun, 16 Oct 2005 17:36:06 -0700 Subject: [PATCH] --- yaml --- r: 9902 b: refs/heads/master c: 3d80636a0d5f056ffc26472d05b6027a7a9f6e1c h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/mm/vmscan.c | 13 +++++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/[refs] b/[refs] index f2757c28b024..d4a4f8b5c1ac 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 688ce17b8599abc548b406c00e4d18ae0dec954f +refs/heads/master: 3d80636a0d5f056ffc26472d05b6027a7a9f6e1c diff --git a/trunk/mm/vmscan.c b/trunk/mm/vmscan.c index 0ea71e887bb6..64f9570cff56 100644 --- a/trunk/mm/vmscan.c +++ b/trunk/mm/vmscan.c @@ -511,10 +511,11 @@ static int shrink_list(struct list_head *page_list, struct scan_control *sc) * PageDirty _after_ making sure that the page is freeable and * not in use by anybody. (pagecache + us == 2) */ - if (page_count(page) != 2 || PageDirty(page)) { - write_unlock_irq(&mapping->tree_lock); - goto keep_locked; - } + if (unlikely(page_count(page) != 2)) + goto cannot_free; + smp_rmb(); + if (unlikely(PageDirty(page))) + goto cannot_free; #ifdef CONFIG_SWAP if (PageSwapCache(page)) { @@ -538,6 +539,10 @@ static int shrink_list(struct list_head *page_list, struct scan_control *sc) __pagevec_release_nonlru(&freed_pvec); continue; +cannot_free: + write_unlock_irq(&mapping->tree_lock); + goto keep_locked; + activate_locked: SetPageActive(page); pgactivate++;