]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
page-writeback.c: subtract min_free_kbytes from dirtyable memory
authorPaul Szabo <psz@maths.usyd.edu.au>
Wed, 20 Feb 2013 02:14:42 +0000 (13:14 +1100)
committerStephen Rothwell <sfr@canb.auug.org.au>
Wed, 20 Feb 2013 05:52:47 +0000 (16:52 +1100)
When calculating amount of dirtyable memory, min_free_kbytes should be
subtracted because it is not intended for dirty pages.

Addresses http://bugs.debian.org/695182

Signed-off-by: Paul Szabo <psz@maths.usyd.edu.au>
Acked-by: Rik van Riel <riel@redhat.com>
Cc: Wu Fengguang <fengguang.wu@intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/page-writeback.c

index cefafebe4cbce5f1b5f15425dc3eea48da042a1b..79530ec50cbd0ce62aabcb5f8c568e2259c6be33 100644 (file)
@@ -234,6 +234,7 @@ static unsigned long highmem_dirtyable_memory(unsigned long total)
 static unsigned long global_dirtyable_memory(void)
 {
        unsigned long x;
+       extern int min_free_kbytes;
 
        x = global_page_state(NR_FREE_PAGES) + global_reclaimable_pages();
        x -= min(x, dirty_balance_reserve);
@@ -241,6 +242,9 @@ static unsigned long global_dirtyable_memory(void)
        if (!vm_highmem_is_dirtyable)
                x -= highmem_dirtyable_memory(x);
 
+       /* Subtract min_free_kbytes */
+       x -= min(x, min_free_kbytes >> (PAGE_SHIFT - 10));
+
        return x + 1;   /* Ensure that we never return 0 */
 }