aboutsummaryrefslogtreecommitdiffstats
path: root/mm/page-writeback.c
diff options
context:
space:
mode:
Diffstat (limited to 'mm/page-writeback.c')
-rw-r--r--mm/page-writeback.c41
1 files changed, 18 insertions, 23 deletions
diff --git a/mm/page-writeback.c b/mm/page-writeback.c
index 1d2fc89ca56d..be0efbde4994 100644
--- a/mm/page-writeback.c
+++ b/mm/page-writeback.c
@@ -133,11 +133,9 @@ get_dirty_limits(long *pbackground, long *pdirty,
133 133
134#ifdef CONFIG_HIGHMEM 134#ifdef CONFIG_HIGHMEM
135 /* 135 /*
136 * If this mapping can only allocate from low memory, 136 * We always exclude high memory from our count.
137 * we exclude high memory from our count.
138 */ 137 */
139 if (mapping && !(mapping_gfp_mask(mapping) & __GFP_HIGHMEM)) 138 available_memory -= totalhigh_pages;
140 available_memory -= totalhigh_pages;
141#endif 139#endif
142 140
143 141
@@ -526,28 +524,25 @@ static struct notifier_block __cpuinitdata ratelimit_nb = {
526}; 524};
527 525
528/* 526/*
529 * If the machine has a large highmem:lowmem ratio then scale back the default 527 * Called early on to tune the page writeback dirty limits.
530 * dirty memory thresholds: allowing too much dirty highmem pins an excessive 528 *
531 * number of buffer_heads. 529 * We used to scale dirty pages according to how total memory
530 * related to pages that could be allocated for buffers (by
531 * comparing nr_free_buffer_pages() to vm_total_pages.
532 *
533 * However, that was when we used "dirty_ratio" to scale with
534 * all memory, and we don't do that any more. "dirty_ratio"
535 * is now applied to total non-HIGHPAGE memory (by subtracting
536 * totalhigh_pages from vm_total_pages), and as such we can't
537 * get into the old insane situation any more where we had
538 * large amounts of dirty pages compared to a small amount of
539 * non-HIGHMEM memory.
540 *
541 * But we might still want to scale the dirty_ratio by how
542 * much memory the box has..
532 */ 543 */
533void __init page_writeback_init(void) 544void __init page_writeback_init(void)
534{ 545{
535 long buffer_pages = nr_free_buffer_pages();
536 long correction;
537
538 correction = (100 * 4 * buffer_pages) / vm_total_pages;
539
540 if (correction < 100) {
541 dirty_background_ratio *= correction;
542 dirty_background_ratio /= 100;
543 vm_dirty_ratio *= correction;
544 vm_dirty_ratio /= 100;
545
546 if (dirty_background_ratio <= 0)
547 dirty_background_ratio = 1;
548 if (vm_dirty_ratio <= 0)
549 vm_dirty_ratio = 1;
550 }
551 mod_timer(&wb_timer, jiffies + dirty_writeback_interval); 546 mod_timer(&wb_timer, jiffies + dirty_writeback_interval);
552 writeback_set_ratelimit(); 547 writeback_set_ratelimit();
553 register_cpu_notifier(&ratelimit_nb); 548 register_cpu_notifier(&ratelimit_nb);