The patch titled zoned vm counters: conversion of nr_dirty to per zone counter has been added to the -mm tree. Its filename is zoned-vm-counters-conversion-of-nr_dirty-to-per-zone-counter.patch See http://www.zip.com.au/~akpm/linux/patches/stuff/added-to-mm.txt to find out what to do about this ------------------------------------------------------ Subject: zoned vm counters: conversion of nr_dirty to per zone counter From: Christoph Lameter <clameter@xxxxxxx> This makes nr_dirty a per zone counter. Looping over all processors is avoided during writeback state determination. The counter aggregation for nr_dirty had to be undone in the NFS layer since we summed up the page counts from multiple zones. Someone more familiar with NFS should probably review what I have done. Signed-off-by: Christoph Lameter <clameter@xxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxx> --- arch/i386/mm/pgtable.c | 2 +- drivers/base/node.c | 4 +--- fs/buffer.c | 2 +- fs/fs-writeback.c | 2 +- fs/nfs/pagelist.c | 1 + fs/nfs/write.c | 3 +-- fs/proc/proc_misc.c | 2 +- include/linux/mmzone.h | 1 + mm/page-writeback.c | 10 +++++----- mm/page_alloc.c | 2 +- mm/vmstat.c | 2 +- 11 files changed, 15 insertions(+), 16 deletions(-) diff -puN arch/i386/mm/pgtable.c~zoned-vm-counters-conversion-of-nr_dirty-to-per-zone-counter arch/i386/mm/pgtable.c --- a/arch/i386/mm/pgtable.c~zoned-vm-counters-conversion-of-nr_dirty-to-per-zone-counter +++ a/arch/i386/mm/pgtable.c @@ -59,7 +59,7 @@ void show_mem(void) printk(KERN_INFO "%d pages swap cached\n", cached); get_page_state(&ps); - printk(KERN_INFO "%lu pages dirty\n", ps.nr_dirty); + printk(KERN_INFO "%lu pages dirty\n", global_page_state(NR_FILE_DIRTY)); printk(KERN_INFO "%lu pages writeback\n", ps.nr_writeback); printk(KERN_INFO "%lu pages mapped\n", global_page_state(NR_FILE_MAPPED)); printk(KERN_INFO "%lu pages slab\n", global_page_state(NR_SLAB)); diff -puN drivers/base/node.c~zoned-vm-counters-conversion-of-nr_dirty-to-per-zone-counter drivers/base/node.c --- a/drivers/base/node.c~zoned-vm-counters-conversion-of-nr_dirty-to-per-zone-counter +++ a/drivers/base/node.c @@ -50,8 +50,6 @@ static ssize_t node_read_meminfo(struct __get_zone_counts(&active, &inactive, &free, NODE_DATA(nid)); /* Check for negative values in these approximate counters */ - if ((long)ps.nr_dirty < 0) - ps.nr_dirty = 0; if ((long)ps.nr_writeback < 0) ps.nr_writeback = 0; @@ -81,7 +79,7 @@ static ssize_t node_read_meminfo(struct nid, K(i.freehigh), nid, K(i.totalram - i.totalhigh), nid, K(i.freeram - i.freehigh), - nid, K(ps.nr_dirty), + nid, K(node_page_state(nid, NR_FILE_DIRTY)), nid, K(ps.nr_writeback), nid, K(node_page_state(nid, NR_FILE_PAGES)), nid, K(node_page_state(nid, NR_FILE_MAPPED)), diff -puN fs/buffer.c~zoned-vm-counters-conversion-of-nr_dirty-to-per-zone-counter fs/buffer.c --- a/fs/buffer.c~zoned-vm-counters-conversion-of-nr_dirty-to-per-zone-counter +++ a/fs/buffer.c @@ -852,7 +852,7 @@ int __set_page_dirty_buffers(struct page write_lock_irq(&mapping->tree_lock); if (page->mapping) { /* Race with truncate? */ if (mapping_cap_account_dirty(mapping)) - inc_page_state(nr_dirty); + __inc_zone_page_state(page, NR_FILE_DIRTY); radix_tree_tag_set(&mapping->page_tree, page_index(page), PAGECACHE_TAG_DIRTY); diff -puN fs/fs-writeback.c~zoned-vm-counters-conversion-of-nr_dirty-to-per-zone-counter fs/fs-writeback.c --- a/fs/fs-writeback.c~zoned-vm-counters-conversion-of-nr_dirty-to-per-zone-counter +++ a/fs/fs-writeback.c @@ -464,7 +464,7 @@ void sync_inodes_sb(struct super_block * .range_start = 0, .range_end = LLONG_MAX, }; - unsigned long nr_dirty = read_page_state(nr_dirty); + unsigned long nr_dirty = global_page_state(NR_FILE_DIRTY); unsigned long nr_unstable = read_page_state(nr_unstable); wbc.nr_to_write = nr_dirty + nr_unstable + diff -puN fs/nfs/pagelist.c~zoned-vm-counters-conversion-of-nr_dirty-to-per-zone-counter fs/nfs/pagelist.c --- a/fs/nfs/pagelist.c~zoned-vm-counters-conversion-of-nr_dirty-to-per-zone-counter +++ a/fs/nfs/pagelist.c @@ -315,6 +315,7 @@ nfs_scan_lock_dirty(struct nfs_inode *nf req->wb_index, NFS_PAGE_TAG_DIRTY); nfs_list_remove_request(req); nfs_list_add_request(req, dst); + dec_zone_page_state(req->wb_page, NR_FILE_DIRTY); res++; } } diff -puN fs/nfs/write.c~zoned-vm-counters-conversion-of-nr_dirty-to-per-zone-counter fs/nfs/write.c --- a/fs/nfs/write.c~zoned-vm-counters-conversion-of-nr_dirty-to-per-zone-counter +++ a/fs/nfs/write.c @@ -497,7 +497,7 @@ nfs_mark_request_dirty(struct nfs_page * nfs_list_add_request(req, &nfsi->dirty); nfsi->ndirty++; spin_unlock(&nfsi->req_lock); - inc_page_state(nr_dirty); + inc_zone_page_state(req->wb_page, NR_FILE_DIRTY); mark_inode_dirty(inode); } @@ -609,7 +609,6 @@ nfs_scan_dirty(struct inode *inode, stru if (nfsi->ndirty != 0) { res = nfs_scan_lock_dirty(nfsi, dst, idx_start, npages); nfsi->ndirty -= res; - sub_page_state(nr_dirty,res); if ((nfsi->ndirty == 0) != list_empty(&nfsi->dirty)) printk(KERN_ERR "NFS: desynchronized value of nfs_i.ndirty.\n"); } diff -puN fs/proc/proc_misc.c~zoned-vm-counters-conversion-of-nr_dirty-to-per-zone-counter fs/proc/proc_misc.c --- a/fs/proc/proc_misc.c~zoned-vm-counters-conversion-of-nr_dirty-to-per-zone-counter +++ a/fs/proc/proc_misc.c @@ -190,7 +190,7 @@ static int meminfo_read_proc(char *page, K(i.freeram-i.freehigh), K(i.totalswap), K(i.freeswap), - K(ps.nr_dirty), + K(global_page_state(NR_FILE_DIRTY)), K(ps.nr_writeback), K(global_page_state(NR_ANON_PAGES)), K(global_page_state(NR_FILE_MAPPED)), diff -puN include/linux/mmzone.h~zoned-vm-counters-conversion-of-nr_dirty-to-per-zone-counter include/linux/mmzone.h --- a/include/linux/mmzone.h~zoned-vm-counters-conversion-of-nr_dirty-to-per-zone-counter +++ a/include/linux/mmzone.h @@ -53,6 +53,7 @@ enum zone_stat_item { NR_FILE_PAGES, NR_SLAB, /* Pages used by slab allocator */ NR_PAGETABLE, /* used for pagetables */ + NR_FILE_DIRTY, NR_VM_ZONE_STAT_ITEMS }; struct per_cpu_pages { diff -puN mm/page_alloc.c~zoned-vm-counters-conversion-of-nr_dirty-to-per-zone-counter mm/page_alloc.c --- a/mm/page_alloc.c~zoned-vm-counters-conversion-of-nr_dirty-to-per-zone-counter +++ a/mm/page_alloc.c @@ -1314,7 +1314,7 @@ void show_free_areas(void) "unstable:%lu free:%u slab:%lu mapped:%lu pagetables:%lu\n", active, inactive, - ps.nr_dirty, + global_page_state(NR_FILE_DIRTY), ps.nr_writeback, ps.nr_unstable, nr_free_pages(), diff -puN mm/page-writeback.c~zoned-vm-counters-conversion-of-nr_dirty-to-per-zone-counter mm/page-writeback.c --- a/mm/page-writeback.c~zoned-vm-counters-conversion-of-nr_dirty-to-per-zone-counter +++ a/mm/page-writeback.c @@ -110,7 +110,7 @@ struct writeback_state static void get_writeback_state(struct writeback_state *wbs) { - wbs->nr_dirty = read_page_state(nr_dirty); + wbs->nr_dirty = global_page_state(NR_FILE_DIRTY); wbs->nr_unstable = read_page_state(nr_unstable); wbs->nr_mapped = global_page_state(NR_FILE_MAPPED) + global_page_state(NR_ANON_PAGES); @@ -652,7 +652,7 @@ int __set_page_dirty_nobuffers(struct pa if (mapping2) { /* Race with truncate? */ BUG_ON(mapping2 != mapping); if (mapping_cap_account_dirty(mapping)) - inc_page_state(nr_dirty); + __inc_zone_page_state(page, NR_FILE_DIRTY); radix_tree_tag_set(&mapping->page_tree, page_index(page), PAGECACHE_TAG_DIRTY); } @@ -739,9 +739,9 @@ int test_clear_page_dirty(struct page *p radix_tree_tag_clear(&mapping->page_tree, page_index(page), PAGECACHE_TAG_DIRTY); - write_unlock_irqrestore(&mapping->tree_lock, flags); if (mapping_cap_account_dirty(mapping)) - dec_page_state(nr_dirty); + __dec_zone_page_state(page, NR_FILE_DIRTY); + write_unlock_irqrestore(&mapping->tree_lock, flags); return 1; } write_unlock_irqrestore(&mapping->tree_lock, flags); @@ -773,7 +773,7 @@ int clear_page_dirty_for_io(struct page if (TestClearPageDirty(page)) { page_mkclean(page); if (mapping_cap_account_dirty(mapping)) - dec_page_state(nr_dirty); + dec_zone_page_state(page, NR_FILE_DIRTY); return 1; } return 0; diff -puN mm/vmstat.c~zoned-vm-counters-conversion-of-nr_dirty-to-per-zone-counter mm/vmstat.c --- a/mm/vmstat.c~zoned-vm-counters-conversion-of-nr_dirty-to-per-zone-counter +++ a/mm/vmstat.c @@ -462,9 +462,9 @@ static char *vmstat_text[] = { "nr_file_pages", "nr_slab", "nr_page_table_pages", + "nr_dirty", /* Page state */ - "nr_dirty", "nr_writeback", "nr_unstable", _ Patches currently in -mm which might be from clameter@xxxxxxx are page-migration-make-do_swap_page-redo-the-fault.patch slab-extract-cache_free_alien-from-__cache_free.patch migration-remove-unnecessary-pageswapcache-checks.patch page-migration-cleanup-rename-ignrefs-to-migration.patch page-migration-cleanup-group-functions.patch page-migration-cleanup-remove-useless-definitions.patch page-migration-cleanup-drop-nr_refs-in-remove_references.patch page-migration-cleanup-extract-try_to_unmap-from-migration-functions.patch page-migration-cleanup-pass-mapping-to-migration-functions.patch page-migration-cleanup-move-fallback-handling-into-special-function.patch swapless-pm-add-r-w-migration-entries.patch swapless-page-migration-rip-out-swap-based-logic.patch swapless-page-migration-modify-core-logic.patch more-page-migration-do-not-inc-dec-rss-counters.patch more-page-migration-use-migration-entries-for-file-pages.patch page-migration-update-documentation.patch mm-remove-vm_locked-before-remap_pfn_range-and-drop-vm_shm.patch page-migration-simplify-migrate_pages.patch page-migration-handle-freeing-of-pages-in-migrate_pages.patch page-migration-use-allocator-function-for-migrate_pages.patch page-migration-support-moving-of-individual-pages.patch page-migration-support-moving-of-individual-pages-x86_64-support.patch page-migration-support-moving-of-individual-pages-x86-support.patch page-migration-support-a-vma-migration-function.patch allow-migration-of-mlocked-pages.patch mm-remove-some-update_mmu_cache-calls.patch zoned-vm-counters-create-vmstatc-h-from-page_allocc-h.patch zoned-vm-counters-basic-zvc-zoned-vm-counter-implementation.patch zoned-vm-counters-basic-zvc-zoned-vm-counter-implementation-tidy.patch zoned-vm-counters-convert-nr_mapped-to-per-zone-counter.patch zoned-vm-counters-conversion-of-nr_pagecache-to-per-zone-counter.patch zoned-vm-counters-remove-nr_file_mapped-from-scan-control-structure.patch zoned-vm-counters-remove-nr_file_mapped-from-scan-control-structure-fix.patch zoned-vm-counters-split-nr_anon_pages-off-from-nr_file_mapped.patch zoned-vm-counters-zone_reclaim-remove-proc-sys-vm-zone_reclaim_interval.patch zoned-vm-counters-conversion-of-nr_slab-to-per-zone-counter.patch zoned-vm-counters-conversion-of-nr_pagetables-to-per-zone-counter.patch zoned-vm-counters-conversion-of-nr_dirty-to-per-zone-counter.patch zoned-vm-counters-conversion-of-nr_writeback-to-per-zone-counter.patch zoned-vm-counters-conversion-of-nr_unstable-to-per-zone-counter.patch zoned-vm-counters-conversion-of-nr_bounce-to-per-zone-counter.patch zoned-vm-counters-remove-useless-struct-wbs.patch selinux-add-task_movememory-hook.patch selinux-add-security_task_movememory-calls-to-mm-code.patch cpuset-remove-extra-cpuset_zone_allowed-check-in-__alloc_pages.patch corrections-to-memory-barrier-doc.patch - To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html