[RFC][PATCH 05/11] blkiocg async: __set_page_dirty_nobuffer not to record process info

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Munehiro Ikeda
Date: Thursday, July 8, 2010 - 8:17 pm

For same reason of introducing block_commit_write_noiotrack()
in the previous patch, this patch introduces
__set_page_dirty_nobuffer_noiotrack().
redirty_page_for_writepage() calls
__set_page_dirty_nobuffers_noiotrack()
because overwriting the process info for iotrack isn't needed
when redirtying.

Signed-off-by: Munehiro "Muuhh" Ikeda <m-ikeda@ds.jp.nec.com>
---
 include/linux/mm.h  |    1 +
 mm/page-writeback.c |   55 +++++++++++++++++++++++++++++++++++---------------
 2 files changed, 39 insertions(+), 17 deletions(-)

diff --git a/include/linux/mm.h b/include/linux/mm.h
index b969efb..08a957b 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -851,6 +851,7 @@ extern int try_to_release_page(struct page * page, gfp_t gfp_mask);
 extern void do_invalidatepage(struct page *page, unsigned long offset);
 
 int __set_page_dirty_nobuffers(struct page *page);
+int __set_page_dirty_nobuffers_noiotrack(struct page *page);
 int __set_page_dirty_no_writeback(struct page *page);
 int redirty_page_for_writepage(struct writeback_control *wbc,
 				struct page *page);
diff --git a/mm/page-writeback.c b/mm/page-writeback.c
index f3e6b2c..bdd6fdb 100644
--- a/mm/page-writeback.c
+++ b/mm/page-writeback.c
@@ -1099,22 +1099,11 @@ void account_page_dirtied(struct page *page, struct address_space *mapping)
 	}
 }
 
-/*
- * For address_spaces which do not use buffers.  Just tag the page as dirty in
- * its radix tree.
- *
- * This is also used when a single buffer is being dirtied: we want to set the
- * page dirty in that case, but not all the buffers.  This is a "bottom-up"
- * dirtying, whereas __set_page_dirty_buffers() is a "top-down" dirtying.
- *
- * Most callers have locked the page, which pins the address_space in memory.
- * But zap_pte_range() does not lock the page, however in that case the
- * mapping is pinned by the vma's ->vm_file reference.
- *
- * We take care to handle the case where the page was truncated from the
- * mapping by re-checking page_mapping() inside tree_lock.
+/**
+ * ____set_page_dirty_nobuffers - helper function for __set_page_dirty_nobuffers*
+ * If track is true, dirtying process info will be recorded for iotrack
  */
-int __set_page_dirty_nobuffers(struct page *page)
+static int ____set_page_dirty_nobuffers(struct page *page, int track)
 {
 	if (!TestSetPageDirty(page)) {
 		struct address_space *mapping = page_mapping(page);
@@ -1129,7 +1118,9 @@ int __set_page_dirty_nobuffers(struct page *page)
 			BUG_ON(mapping2 != mapping);
 			WARN_ON_ONCE(!PagePrivate(page) && !PageUptodate(page));
 			account_page_dirtied(page, mapping);
-			blk_iotrack_reset_owner_pagedirty(page, current->mm);
+			if (track)
+				blk_iotrack_reset_owner_pagedirty(page,
+					current->mm);
 			radix_tree_tag_set(&mapping->page_tree,
 				page_index(page), PAGECACHE_TAG_DIRTY);
 		}
@@ -1142,8 +1133,38 @@ int __set_page_dirty_nobuffers(struct page *page)
 	}
 	return 0;
 }
+
+/*
+ * For address_spaces which do not use buffers.  Just tag the page as dirty in
+ * its radix tree.
+ *
+ * This is also used when a single buffer is being dirtied: we want to set the
+ * page dirty in that case, but not all the buffers.  This is a "bottom-up"
+ * dirtying, whereas __set_page_dirty_buffers() is a "top-down" dirtying.
+ *
+ * Most callers have locked the page, which pins the address_space in memory.
+ * But zap_pte_range() does not lock the page, however in that case the
+ * mapping is pinned by the vma's ->vm_file reference.
+ *
+ * We take care to handle the case where the page was truncated from the
+ * mapping by re-checking page_mapping() inside tree_lock.
+ */
+int __set_page_dirty_nobuffers(struct page *page)
+{
+	return ____set_page_dirty_nobuffers(page, 1);
+}
 EXPORT_SYMBOL(__set_page_dirty_nobuffers);
 
+/**
+ * Same as __set_page_dirty_nobuffers, but doesn't record process
+ * info for iotrack.
+ */
+int __set_page_dirty_nobuffers_noiotrack(struct page *page)
+{
+	return ____set_page_dirty_nobuffers(page, 0);
+}
+EXPORT_SYMBOL(__set_page_dirty_nobuffers_noiotrack);
+
 /*
  * When a writepage implementation decides that it doesn't want to write this
  * page for some reason, it should redirty the locked page via
@@ -1152,7 +1173,7 @@ EXPORT_SYMBOL(__set_page_dirty_nobuffers);
 int redirty_page_for_writepage(struct writeback_control *wbc, struct page *page)
 {
 	wbc->pages_skipped++;
-	return __set_page_dirty_nobuffers(page);
+	return __set_page_dirty_nobuffers_noiotrack(page);
 }
 EXPORT_SYMBOL(redirty_page_for_writepage);
 
-- 
1.6.2.5
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[RFC][PATCH 00/11] blkiocg async support, Munehiro Ikeda, (Thu Jul 8, 7:57 pm)
[RFC][PATCH 03/11] blkiocg async: Hooks for iotrack, Munehiro Ikeda, (Thu Jul 8, 8:16 pm)
[RFC][PATCH 05/11] blkiocg async: __set_page_dirty_nobuffe ..., Munehiro Ikeda, (Thu Jul 8, 8:17 pm)
Re: [RFC][PATCH 02/11] blkiocg async: The main part of iotrack, KAMEZAWA Hiroyuki, (Fri Jul 9, 12:35 am)
Re: [RFC][PATCH 02/11] blkiocg async: The main part of iotrack, KAMEZAWA Hiroyuki, (Fri Jul 9, 12:38 am)
Re: [RFC][PATCH 00/11] blkiocg async support, Andrea Righi, (Fri Jul 9, 3:04 am)
Re: [RFC][PATCH 00/11] blkiocg async support, Vivek Goyal, (Fri Jul 9, 6:45 am)
Re: [RFC][PATCH 03/11] blkiocg async: Hooks for iotrack, Munehiro Ikeda, (Fri Jul 9, 4:43 pm)
Re: [RFC][PATCH 00/11] blkiocg async support, Munehiro Ikeda, (Fri Jul 9, 5:17 pm)
Re: [RFC][PATCH 00/11] blkiocg async support, Nauman Rafique, (Fri Jul 9, 5:55 pm)
Re: [RFC][PATCH 00/11] blkiocg async support, Vivek Goyal, (Sat Jul 10, 6:24 am)
Re: [RFC][PATCH 02/11] blkiocg async: The main part of iotrack, KAMEZAWA Hiroyuki, (Sun Jul 11, 5:11 pm)
Re: [RFC][PATCH 00/11] blkiocg async support, KAMEZAWA Hiroyuki, (Sun Jul 11, 5:20 pm)
Re: [RFC][PATCH 00/11] blkiocg async support, Vivek Goyal, (Mon Jul 12, 6:18 am)
Re: [RFC][PATCH 00/11] blkiocg async support, KAMEZAWA Hiroyuki, (Mon Jul 12, 9:36 pm)
Re: [RFC][PATCH 00/11] blkiocg async support, Vivek Goyal, (Wed Jul 14, 7:29 am)
Re: [RFC][PATCH 00/11] blkiocg async support, KAMEZAWA Hiroyuki, (Wed Jul 14, 5:00 pm)
Re: [RFC][PATCH 00/11] blkiocg async support, Vivek Goyal, (Fri Jul 16, 6:43 am)
Re: [RFC][PATCH 00/11] blkiocg async support, Daniel P. Berrange, (Fri Jul 16, 7:15 am)
Re: [RFC][PATCH 00/11] blkiocg async support, Vivek Goyal, (Fri Jul 16, 7:35 am)
Re: [RFC][PATCH 00/11] blkiocg async support, Daniel P. Berrange, (Fri Jul 16, 7:53 am)
Re: [RFC][PATCH 00/11] blkiocg async support, Vivek Goyal, (Fri Jul 16, 8:12 am)
Re: [RFC][PATCH 00/11] blkiocg async support, Greg Thelen, (Thu Jul 22, 12:28 pm)
Re: [RFC][PATCH 00/11] blkiocg async support, KAMEZAWA Hiroyuki, (Thu Jul 22, 4:59 pm)
Re: [RFC][PATCH 00/11] blkiocg async support, Balbir Singh, (Sun Jul 25, 11:41 pm)
Re: [RFC][PATCH 00/11] blkiocg async support, KAMEZAWA Hiroyuki, (Mon Jul 26, 11:39 pm)
Re: [RFC][PATCH 00/11] blkiocg async support, Greg Thelen, (Mon Jul 26, 11:40 pm)
Re: [RFC][PATCH 00/11] blkiocg async support, Daniel P. Berrange, (Tue Jul 27, 3:40 am)
Re: [RFC][PATCH 00/11] blkiocg async support, Vivek Goyal, (Tue Jul 27, 7:03 am)
Re: [RFC][PATCH 00/11] blkiocg async support, Vivek Goyal, (Mon Aug 2, 1:58 pm)
Re: [RFC][PATCH 00/11] blkiocg async support, Munehiro Ikeda, (Tue Aug 3, 7:31 am)
Re: [RFC][PATCH 00/11] blkiocg async support, Nauman Rafique, (Tue Aug 3, 12:24 pm)
Re: [RFC][PATCH 00/11] blkiocg async support, Vivek Goyal, (Tue Aug 3, 1:15 pm)
Re: [RFC][PATCH 00/11] blkiocg async support, Munehiro Ikeda, (Wed Aug 4, 7:32 am)