From: Paul Szabo Date: Wed, 20 Feb 2013 02:14:42 +0000 (+1100) Subject: page-writeback.c: subtract min_free_kbytes from dirtyable memory X-Git-Tag: next-20130220~1^2~456 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=0e25bc3be256c02fc9a4c10af53805f8a65870db;p=karo-tx-linux.git page-writeback.c: subtract min_free_kbytes from dirtyable memory 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 Acked-by: Rik van Riel Cc: Wu Fengguang Signed-off-by: Andrew Morton --- diff --git a/mm/page-writeback.c b/mm/page-writeback.c index cefafebe4cbc..79530ec50cbd 100644 --- a/mm/page-writeback.c +++ b/mm/page-writeback.c @@ -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 */ }