Skip to contentSkip to conversation

Make balance_dirty_pages zone aware (2/2)

RFC New Matthew Dobson 1 participant 1 message Nov 22, 2003

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

RFC 1/1 Make balance_dirty_pages zone aware (2/2)

Currently the VM decides to start doing background writeback of pages if 10% of the systems pages are dirty, and starts doing synchronous writeback of pages if 40% are dirty. This is great for smaller memory systems, but in larger memory systems (>2GB or so), a process can dirty ALL of lowmem (ZONE_NORMAL, 896MB) without hitting the 40% dirty page ratio needed to force the process to do writeback. For this and other reasons, it'd be nice to have a zone aware dirty page balancer. That is precisely what these 2 patches try to achieve.

Patch 2/2 - numafy_balance_dirty_pages.patch:

This patch does the following things:
1) Modify balance_dirty_pages_ratelimited() to take a pointer to a
struct page. Use this to determine which zone is being dirtied.
2) Change balance_dirty_pages() to balance_dirty_pages_zone(), which
now takes a reference to a struct zone to (potentially) balance, rather than balancing the whole system.
3) Finally, create get_dirty_limits_zone(), which takes a reference to
a struct zone and returns the dirty limits for that specific zone. The old behavior of get_dirty_limits() is still available by passing a NULL pointer to get_dirty_limits_zone() (background_writeout() uses this).

Comments/criticism requested! :)

Cheers!

-Matt

include/linux/writeback.h +1 -1
diff -Nurp --exclude-from=/home/mcd/.dontdiff linux-2.6.0-test9-setup_perzone_counters/include/linux/writeback.h linux-2.6.0-test9-numafy_balance_dirty_pages/include/linux/writeback.h
@@ -84,7 +84,7 @@ int dirty_writeback_centisecs_handler(st
 				      void __user *, size_t *);
 
 void page_writeback_init(void);
-int balance_dirty_pages_ratelimited(struct address_space *mapping);
+int balance_dirty_pages_ratelimited(struct address_space *mapping, struct page *page);
 int pdflush_operation(void (*fn)(unsigned long), unsigned long arg0);
 int do_writepages(struct address_space *mapping, struct writeback_control *wbc);
 ssize_t sync_page_range(struct inode *inode, struct address_space *mapping,
mm/filemap.c +1 -1
diff -Nurp --exclude-from=/home/mcd/.dontdiff linux-2.6.0-test9-setup_perzone_counters/mm/filemap.c linux-2.6.0-test9-numafy_balance_dirty_pages/mm/filemap.c
@@ -1991,7 +1991,7 @@ __generic_file_aio_write_nolock(struct k
 		page_cache_release(page);
 		if (status < 0)
 			break;
-		status = balance_dirty_pages_ratelimited(mapping);
+		status = balance_dirty_pages_ratelimited(mapping, page);
 		if (status < 0) {
 			pr_debug("async balance_dirty_pages\n");
 			break;
mm/page-writeback.c +40 -19

122 lines not on this page · raw message