diff options
author | Paul Szabo <psz@maths.usyd.edu.au> | 2013-02-22 19:34:42 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-02-23 20:50:17 -0500 |
commit | 75f7ad8e043d9383337d917584297f7737154bbf (patch) | |
tree | 101f5f2373b615bf83838cd13615fd123dfd765c | |
parent | 08b52706d505658eac0962d215ff697f898bbc13 (diff) |
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
[akpm@linux-foundation.org: fix up min_free_kbytes extern declarations]
[akpm@linux-foundation.org: fix min() warning]
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>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | include/linux/mm.h | 3 | ||||
-rw-r--r-- | kernel/sysctl.c | 1 | ||||
-rw-r--r-- | mm/huge_memory.c | 1 | ||||
-rw-r--r-- | mm/page-writeback.c | 3 |
4 files changed, 6 insertions, 2 deletions
diff --git a/include/linux/mm.h b/include/linux/mm.h index 1d4122bf6f27..437da0ce78c7 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h | |||
@@ -1393,6 +1393,9 @@ extern void setup_per_cpu_pageset(void); | |||
1393 | extern void zone_pcp_update(struct zone *zone); | 1393 | extern void zone_pcp_update(struct zone *zone); |
1394 | extern void zone_pcp_reset(struct zone *zone); | 1394 | extern void zone_pcp_reset(struct zone *zone); |
1395 | 1395 | ||
1396 | /* page_alloc.c */ | ||
1397 | extern int min_free_kbytes; | ||
1398 | |||
1396 | /* nommu.c */ | 1399 | /* nommu.c */ |
1397 | extern atomic_long_t mmap_pages_allocated; | 1400 | extern atomic_long_t mmap_pages_allocated; |
1398 | extern int nommu_shrink_inode_mappings(struct inode *, size_t, size_t); | 1401 | extern int nommu_shrink_inode_mappings(struct inode *, size_t, size_t); |
diff --git a/kernel/sysctl.c b/kernel/sysctl.c index 467d8b923fcd..95e9e55602a8 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c | |||
@@ -105,7 +105,6 @@ extern char core_pattern[]; | |||
105 | extern unsigned int core_pipe_limit; | 105 | extern unsigned int core_pipe_limit; |
106 | #endif | 106 | #endif |
107 | extern int pid_max; | 107 | extern int pid_max; |
108 | extern int min_free_kbytes; | ||
109 | extern int pid_max_min, pid_max_max; | 108 | extern int pid_max_min, pid_max_max; |
110 | extern int sysctl_drop_caches; | 109 | extern int sysctl_drop_caches; |
111 | extern int percpu_pagelist_fraction; | 110 | extern int percpu_pagelist_fraction; |
diff --git a/mm/huge_memory.c b/mm/huge_memory.c index b1cc6591ed83..c63a21d0e991 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c | |||
@@ -105,7 +105,6 @@ static int set_recommended_min_free_kbytes(void) | |||
105 | struct zone *zone; | 105 | struct zone *zone; |
106 | int nr_zones = 0; | 106 | int nr_zones = 0; |
107 | unsigned long recommended_min; | 107 | unsigned long recommended_min; |
108 | extern int min_free_kbytes; | ||
109 | 108 | ||
110 | if (!khugepaged_enabled()) | 109 | if (!khugepaged_enabled()) |
111 | return 0; | 110 | return 0; |
diff --git a/mm/page-writeback.c b/mm/page-writeback.c index 7300c9d5e1d9..cdc377c456c0 100644 --- a/mm/page-writeback.c +++ b/mm/page-writeback.c | |||
@@ -241,6 +241,9 @@ static unsigned long global_dirtyable_memory(void) | |||
241 | if (!vm_highmem_is_dirtyable) | 241 | if (!vm_highmem_is_dirtyable) |
242 | x -= highmem_dirtyable_memory(x); | 242 | x -= highmem_dirtyable_memory(x); |
243 | 243 | ||
244 | /* Subtract min_free_kbytes */ | ||
245 | x -= min_t(unsigned long, x, min_free_kbytes >> (PAGE_SHIFT - 10)); | ||
246 | |||
244 | return x + 1; /* Ensure that we never return 0 */ | 247 | return x + 1; /* Ensure that we never return 0 */ |
245 | } | 248 | } |
246 | 249 | ||