From 0e25bc3be256c02fc9a4c10af53805f8a65870db Mon Sep 17 00:00:00 2001 From: Paul Szabo Date: Wed, 20 Feb 2013 13:14:42 +1100 Subject: [PATCH] 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 --- mm/page-writeback.c | 4 ++++ 1 file changed, 4 insertions(+) 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 */ } -- 2.39.5