HWPOISON: Stop shrinking at right page count
authorAndi Kleen <ak@linux.intel.com>
Tue, 28 Sep 2010 05:37:55 +0000 (07:37 +0200)
committerAndi Kleen <ak@linux.intel.com>
Thu, 7 Oct 2010 07:47:10 +0000 (09:47 +0200)
When we call the slab shrinker to free a page we need to stop at
page count one because the caller always holds a single reference, not zero.

This avoids useless looping over slab shrinkers and freeing too much
memory.

Reviewed-by: Wu Fengguang <fengguang.wu@intel.com>
Signed-off-by: Andi Kleen <ak@linux.intel.com>
mm/memory-failure.c

index cd7e6974de77bbfb044d81e264cf337b5014dd90..757f6b0accfe84d959b7fe5899b5916ad0ed1f14 100644 (file)
@@ -235,7 +235,7 @@ void shake_page(struct page *p, int access)
                int nr;
                do {
                        nr = shrink_slab(1000, GFP_KERNEL, 1000);
-                       if (page_count(p) == 0)
+                       if (page_count(p) == 1)
                                break;
                } while (nr > 10);
        }