aboutsummaryrefslogtreecommitdiffstats
path: root/mm/vmscan.c
diff options
context:
space:
mode:
authorMel Gorman <mgorman@suse.de>2013-07-03 18:02:05 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2013-07-03 19:07:29 -0400
commitb45972265f823ed01eae0867a176320071665787 (patch)
treeded8dcb801e71fe10e38c715a91571c745c563b5 /mm/vmscan.c
parentd04e8acd03e5c3421ef18e3da7bc88d56179ca42 (diff)
mm: vmscan: take page buffers dirty and locked state into account
Page reclaim keeps track of dirty and under writeback pages and uses it to determine if wait_iff_congested() should stall or if kswapd should begin writing back pages. This fails to account for buffer pages that can be under writeback but not PageWriteback which is the case for filesystems like ext3 ordered mode. Furthermore, PageDirty buffer pages can have all the buffers clean and writepage does no IO so it should not be accounted as congested. This patch adds an address_space operation that filesystems may optionally use to check if a page is really dirty or really under writeback. An implementation is provided for for buffer_heads is added and used for block operations and ext3 in ordered mode. By default the page flags are obeyed. Credit goes to Jan Kara for identifying that the page flags alone are not sufficient for ext3 and sanity checking a number of ideas on how the problem could be addressed. Signed-off-by: Mel Gorman <mgorman@suse.de> Cc: Johannes Weiner <hannes@cmpxchg.org> Cc: Michal Hocko <mhocko@suse.cz> Cc: Rik van Riel <riel@redhat.com> Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> Cc: Jiri Slaby <jslaby@suse.cz> Cc: Valdis Kletnieks <Valdis.Kletnieks@vt.edu> Cc: Zlatko Calusic <zcalusic@bitsync.net> Cc: dormando <dormando@rydia.net> Cc: Trond Myklebust <trond.myklebust@fys.uio.no> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/vmscan.c')
-rw-r--r--mm/vmscan.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/mm/vmscan.c b/mm/vmscan.c
index bf4778479e3a..c85794399848 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -673,6 +673,8 @@ static enum page_references page_check_references(struct page *page,
673static void page_check_dirty_writeback(struct page *page, 673static void page_check_dirty_writeback(struct page *page,
674 bool *dirty, bool *writeback) 674 bool *dirty, bool *writeback)
675{ 675{
676 struct address_space *mapping;
677
676 /* 678 /*
677 * Anonymous pages are not handled by flushers and must be written 679 * Anonymous pages are not handled by flushers and must be written
678 * from reclaim context. Do not stall reclaim based on them 680 * from reclaim context. Do not stall reclaim based on them
@@ -686,6 +688,14 @@ static void page_check_dirty_writeback(struct page *page,
686 /* By default assume that the page flags are accurate */ 688 /* By default assume that the page flags are accurate */
687 *dirty = PageDirty(page); 689 *dirty = PageDirty(page);
688 *writeback = PageWriteback(page); 690 *writeback = PageWriteback(page);
691
692 /* Verify dirty/writeback state if the filesystem supports it */
693 if (!page_has_private(page))
694 return;
695
696 mapping = page_mapping(page);
697 if (mapping && mapping->a_ops->is_dirty_writeback)
698 mapping->a_ops->is_dirty_writeback(page, dirty, writeback);
689} 699}
690 700
691/* 701/*