From: Peter Zijlstra Date: Wed, 17 Oct 2007 06:25:48 +0000 (-0700) Subject: mm: count writeback pages per BDI X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=69cb51d18c1ed593009d9a620cac49d0dcf15dc8;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git mm: count writeback pages per BDI Count per BDI writeback pages. Signed-off-by: Peter Zijlstra Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/include/linux/backing-dev.h b/include/linux/backing-dev.h index bfae09d2a1eb..4d9222c2f222 100644 --- a/include/linux/backing-dev.h +++ b/include/linux/backing-dev.h @@ -28,6 +28,7 @@ typedef int (congested_fn)(void *, int); enum bdi_stat_item { BDI_RECLAIMABLE, + BDI_WRITEBACK, NR_BDI_STAT_ITEMS }; diff --git a/mm/page-writeback.c b/mm/page-writeback.c index 9b3c4ee62abf..f1d201fdcf9c 100644 --- a/mm/page-writeback.c +++ b/mm/page-writeback.c @@ -979,14 +979,18 @@ int test_clear_page_writeback(struct page *page) int ret; if (mapping) { + struct backing_dev_info *bdi = mapping->backing_dev_info; unsigned long flags; write_lock_irqsave(&mapping->tree_lock, flags); ret = TestClearPageWriteback(page); - if (ret) + if (ret) { radix_tree_tag_clear(&mapping->page_tree, page_index(page), PAGECACHE_TAG_WRITEBACK); + if (bdi_cap_writeback_dirty(bdi)) + __dec_bdi_stat(bdi, BDI_WRITEBACK); + } write_unlock_irqrestore(&mapping->tree_lock, flags); } else { ret = TestClearPageWriteback(page); @@ -1002,14 +1006,18 @@ int test_set_page_writeback(struct page *page) int ret; if (mapping) { + struct backing_dev_info *bdi = mapping->backing_dev_info; unsigned long flags; write_lock_irqsave(&mapping->tree_lock, flags); ret = TestSetPageWriteback(page); - if (!ret) + if (!ret) { radix_tree_tag_set(&mapping->page_tree, page_index(page), PAGECACHE_TAG_WRITEBACK); + if (bdi_cap_writeback_dirty(bdi)) + __inc_bdi_stat(bdi, BDI_WRITEBACK); + } if (!PageDirty(page)) radix_tree_tag_clear(&mapping->page_tree, page_index(page),