aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMel Gorman <mgorman@suse.de>2014-06-04 19:10:34 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2014-06-04 19:54:10 -0400
commit888cf2db475a256fb0cda042140f73d7881f81fe (patch)
treeecdbfa22cb2278c5dc97ab6217bcb468f642d527
parentd8846374a85f4290a473a4e2a64c1ba046c4a0e1 (diff)
mm: avoid unnecessary atomic operations during end_page_writeback()
If a page is marked for immediate reclaim then it is moved to the tail of the LRU list. This occurs when the system is under enough memory pressure for pages under writeback to reach the end of the LRU but we test for this using atomic operations on every writeback. This patch uses an optimistic non-atomic test first. It'll miss some pages in rare cases but the consequences are not severe enough to warrant such a penalty. While the function does not dominate profiles during a simple dd test the cost of it is reduced. 73048 0.7428 vmlinux-3.15.0-rc5-mmotm-20140513 end_page_writeback 23740 0.2409 vmlinux-3.15.0-rc5-lessatomic end_page_writeback Signed-off-by: Mel Gorman <mgorman@suse.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--mm/filemap.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/mm/filemap.c b/mm/filemap.c
index 0fcd792103f3..7fadf1c62838 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -753,8 +753,17 @@ EXPORT_SYMBOL(unlock_page);
753 */ 753 */
754void end_page_writeback(struct page *page) 754void end_page_writeback(struct page *page)
755{ 755{
756 if (TestClearPageReclaim(page)) 756 /*
757 * TestClearPageReclaim could be used here but it is an atomic
758 * operation and overkill in this particular case. Failing to
759 * shuffle a page marked for immediate reclaim is too mild to
760 * justify taking an atomic operation penalty at the end of
761 * ever page writeback.
762 */
763 if (PageReclaim(page)) {
764 ClearPageReclaim(page);
757 rotate_reclaimable_page(page); 765 rotate_reclaimable_page(page);
766 }
758 767
759 if (!test_clear_page_writeback(page)) 768 if (!test_clear_page_writeback(page))
760 BUG(); 769 BUG();