aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Zijlstra <a.p.zijlstra@chello.nl>2007-10-17 02:25:47 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-10-17 11:42:45 -0400
commitc9e51e4180696aa67915ec5665e4ec74125565de (patch)
treed66e1427b16e56bc7da0dfb583a6d8edb55a2c3e
parentb2e8fb6efa209c82203c79b491b5bc952d44aa57 (diff)
mm: count reclaimable pages per BDI
Count per BDI reclaimable pages; nr_reclaimable = nr_dirty + nr_unstable. 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>
-rw-r--r--fs/buffer.c2
-rw-r--r--fs/nfs/write.c7
-rw-r--r--include/linux/backing-dev.h1
-rw-r--r--mm/page-writeback.c4
-rw-r--r--mm/truncate.c2
5 files changed, 16 insertions, 0 deletions
diff --git a/fs/buffer.c b/fs/buffer.c
index faceb5eecca9..86e58b1dcd9c 100644
--- a/fs/buffer.c
+++ b/fs/buffer.c
@@ -710,6 +710,8 @@ static int __set_page_dirty(struct page *page,
710 710
711 if (mapping_cap_account_dirty(mapping)) { 711 if (mapping_cap_account_dirty(mapping)) {
712 __inc_zone_page_state(page, NR_FILE_DIRTY); 712 __inc_zone_page_state(page, NR_FILE_DIRTY);
713 __inc_bdi_stat(mapping->backing_dev_info,
714 BDI_RECLAIMABLE);
713 task_io_account_write(PAGE_CACHE_SIZE); 715 task_io_account_write(PAGE_CACHE_SIZE);
714 } 716 }
715 radix_tree_tag_set(&mapping->page_tree, 717 radix_tree_tag_set(&mapping->page_tree,
diff --git a/fs/nfs/write.c b/fs/nfs/write.c
index 82d7ee98c675..0cf9d1cd9bd2 100644
--- a/fs/nfs/write.c
+++ b/fs/nfs/write.c
@@ -447,6 +447,7 @@ nfs_mark_request_commit(struct nfs_page *req)
447 NFS_PAGE_TAG_COMMIT); 447 NFS_PAGE_TAG_COMMIT);
448 spin_unlock(&inode->i_lock); 448 spin_unlock(&inode->i_lock);
449 inc_zone_page_state(req->wb_page, NR_UNSTABLE_NFS); 449 inc_zone_page_state(req->wb_page, NR_UNSTABLE_NFS);
450 inc_bdi_stat(req->wb_page->mapping->backing_dev_info, BDI_RECLAIMABLE);
450 __mark_inode_dirty(inode, I_DIRTY_DATASYNC); 451 __mark_inode_dirty(inode, I_DIRTY_DATASYNC);
451} 452}
452 453
@@ -533,6 +534,8 @@ static void nfs_cancel_commit_list(struct list_head *head)
533 while(!list_empty(head)) { 534 while(!list_empty(head)) {
534 req = nfs_list_entry(head->next); 535 req = nfs_list_entry(head->next);
535 dec_zone_page_state(req->wb_page, NR_UNSTABLE_NFS); 536 dec_zone_page_state(req->wb_page, NR_UNSTABLE_NFS);
537 dec_bdi_stat(req->wb_page->mapping->backing_dev_info,
538 BDI_RECLAIMABLE);
536 nfs_list_remove_request(req); 539 nfs_list_remove_request(req);
537 clear_bit(PG_NEED_COMMIT, &(req)->wb_flags); 540 clear_bit(PG_NEED_COMMIT, &(req)->wb_flags);
538 nfs_inode_remove_request(req); 541 nfs_inode_remove_request(req);
@@ -1193,6 +1196,8 @@ nfs_commit_list(struct inode *inode, struct list_head *head, int how)
1193 nfs_list_remove_request(req); 1196 nfs_list_remove_request(req);
1194 nfs_mark_request_commit(req); 1197 nfs_mark_request_commit(req);
1195 dec_zone_page_state(req->wb_page, NR_UNSTABLE_NFS); 1198 dec_zone_page_state(req->wb_page, NR_UNSTABLE_NFS);
1199 dec_bdi_stat(req->wb_page->mapping->backing_dev_info,
1200 BDI_RECLAIMABLE);
1196 nfs_clear_page_tag_locked(req); 1201 nfs_clear_page_tag_locked(req);
1197 } 1202 }
1198 return -ENOMEM; 1203 return -ENOMEM;
@@ -1218,6 +1223,8 @@ static void nfs_commit_done(struct rpc_task *task, void *calldata)
1218 nfs_list_remove_request(req); 1223 nfs_list_remove_request(req);
1219 clear_bit(PG_NEED_COMMIT, &(req)->wb_flags); 1224 clear_bit(PG_NEED_COMMIT, &(req)->wb_flags);
1220 dec_zone_page_state(req->wb_page, NR_UNSTABLE_NFS); 1225 dec_zone_page_state(req->wb_page, NR_UNSTABLE_NFS);
1226 dec_bdi_stat(req->wb_page->mapping->backing_dev_info,
1227 BDI_RECLAIMABLE);
1221 1228
1222 dprintk("NFS: commit (%s/%Ld %d@%Ld)", 1229 dprintk("NFS: commit (%s/%Ld %d@%Ld)",
1223 req->wb_context->path.dentry->d_inode->i_sb->s_id, 1230 req->wb_context->path.dentry->d_inode->i_sb->s_id,
diff --git a/include/linux/backing-dev.h b/include/linux/backing-dev.h
index f7677ff80cc5..bfae09d2a1eb 100644
--- a/include/linux/backing-dev.h
+++ b/include/linux/backing-dev.h
@@ -27,6 +27,7 @@ enum bdi_state {
27typedef int (congested_fn)(void *, int); 27typedef int (congested_fn)(void *, int);
28 28
29enum bdi_stat_item { 29enum bdi_stat_item {
30 BDI_RECLAIMABLE,
30 NR_BDI_STAT_ITEMS 31 NR_BDI_STAT_ITEMS
31}; 32};
32 33
diff --git a/mm/page-writeback.c b/mm/page-writeback.c
index d821321326e3..9b3c4ee62abf 100644
--- a/mm/page-writeback.c
+++ b/mm/page-writeback.c
@@ -827,6 +827,8 @@ int __set_page_dirty_nobuffers(struct page *page)
827 WARN_ON_ONCE(!PagePrivate(page) && !PageUptodate(page)); 827 WARN_ON_ONCE(!PagePrivate(page) && !PageUptodate(page));
828 if (mapping_cap_account_dirty(mapping)) { 828 if (mapping_cap_account_dirty(mapping)) {
829 __inc_zone_page_state(page, NR_FILE_DIRTY); 829 __inc_zone_page_state(page, NR_FILE_DIRTY);
830 __inc_bdi_stat(mapping->backing_dev_info,
831 BDI_RECLAIMABLE);
830 task_io_account_write(PAGE_CACHE_SIZE); 832 task_io_account_write(PAGE_CACHE_SIZE);
831 } 833 }
832 radix_tree_tag_set(&mapping->page_tree, 834 radix_tree_tag_set(&mapping->page_tree,
@@ -961,6 +963,8 @@ int clear_page_dirty_for_io(struct page *page)
961 */ 963 */
962 if (TestClearPageDirty(page)) { 964 if (TestClearPageDirty(page)) {
963 dec_zone_page_state(page, NR_FILE_DIRTY); 965 dec_zone_page_state(page, NR_FILE_DIRTY);
966 dec_bdi_stat(mapping->backing_dev_info,
967 BDI_RECLAIMABLE);
964 return 1; 968 return 1;
965 } 969 }
966 return 0; 970 return 0;
diff --git a/mm/truncate.c b/mm/truncate.c
index 5cdfbc1a59fd..ff78505453d4 100644
--- a/mm/truncate.c
+++ b/mm/truncate.c
@@ -72,6 +72,8 @@ void cancel_dirty_page(struct page *page, unsigned int account_size)
72 struct address_space *mapping = page->mapping; 72 struct address_space *mapping = page->mapping;
73 if (mapping && mapping_cap_account_dirty(mapping)) { 73 if (mapping && mapping_cap_account_dirty(mapping)) {
74 dec_zone_page_state(page, NR_FILE_DIRTY); 74 dec_zone_page_state(page, NR_FILE_DIRTY);
75 dec_bdi_stat(mapping->backing_dev_info,
76 BDI_RECLAIMABLE);
75 if (account_size) 77 if (account_size)
76 task_io_account_cancelled_write(account_size); 78 task_io_account_cancelled_write(account_size);
77 } 79 }