Commit 69cb51d18c1ed593009d9a620cac49d0dcf15dc8
Committed by
Linus Torvalds
1 parent
c9e51e4180
Exists in
master
and in
20 other branches
mm: count writeback pages per BDI
Count per BDI writeback pages. Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Showing 2 changed files with 11 additions and 2 deletions Side-by-side Diff
include/linux/backing-dev.h
mm/page-writeback.c
... | ... | @@ -979,14 +979,18 @@ |
979 | 979 | int ret; |
980 | 980 | |
981 | 981 | if (mapping) { |
982 | + struct backing_dev_info *bdi = mapping->backing_dev_info; | |
982 | 983 | unsigned long flags; |
983 | 984 | |
984 | 985 | write_lock_irqsave(&mapping->tree_lock, flags); |
985 | 986 | ret = TestClearPageWriteback(page); |
986 | - if (ret) | |
987 | + if (ret) { | |
987 | 988 | radix_tree_tag_clear(&mapping->page_tree, |
988 | 989 | page_index(page), |
989 | 990 | PAGECACHE_TAG_WRITEBACK); |
991 | + if (bdi_cap_writeback_dirty(bdi)) | |
992 | + __dec_bdi_stat(bdi, BDI_WRITEBACK); | |
993 | + } | |
990 | 994 | write_unlock_irqrestore(&mapping->tree_lock, flags); |
991 | 995 | } else { |
992 | 996 | ret = TestClearPageWriteback(page); |
993 | 997 | |
994 | 998 | |
... | ... | @@ -1002,14 +1006,18 @@ |
1002 | 1006 | int ret; |
1003 | 1007 | |
1004 | 1008 | if (mapping) { |
1009 | + struct backing_dev_info *bdi = mapping->backing_dev_info; | |
1005 | 1010 | unsigned long flags; |
1006 | 1011 | |
1007 | 1012 | write_lock_irqsave(&mapping->tree_lock, flags); |
1008 | 1013 | ret = TestSetPageWriteback(page); |
1009 | - if (!ret) | |
1014 | + if (!ret) { | |
1010 | 1015 | radix_tree_tag_set(&mapping->page_tree, |
1011 | 1016 | page_index(page), |
1012 | 1017 | PAGECACHE_TAG_WRITEBACK); |
1018 | + if (bdi_cap_writeback_dirty(bdi)) | |
1019 | + __inc_bdi_stat(bdi, BDI_WRITEBACK); | |
1020 | + } | |
1013 | 1021 | if (!PageDirty(page)) |
1014 | 1022 | radix_tree_tag_clear(&mapping->page_tree, |
1015 | 1023 | page_index(page), |