Add a dirty map to address spaces In a NUMA system it is helpful to know where the dirty pages of a mapping are located. That way we will be able to implement writeout for applications that are constrained to a portion of the memory of the system (like f.e. done through cpusets). Signed-off-by; Christoph Lameter Index: linux-2.6.20-rc3/fs/fs-writeback.c =================================================================== --- linux-2.6.20-rc3.orig/fs/fs-writeback.c 2007-01-03 10:32:32.000000000 -0800 +++ linux-2.6.20-rc3/fs/fs-writeback.c 2007-01-03 11:23:20.000000000 -0800 @@ -223,11 +223,17 @@ /* * The inode is clean, inuse */ +#ifdef CONFIG_NUMA + inode->i_mapping->dirty_map = NODE_MASK_NONE; +#endif list_move(&inode->i_list, &inode_in_use); } else { /* * The inode is clean, unused */ +#ifdef CONFIG_NUMA + inode->i_mapping->dirty_map = NODE_MASK_NONE; +#endif list_move(&inode->i_list, &inode_unused); } } Index: linux-2.6.20-rc3/fs/inode.c =================================================================== --- linux-2.6.20-rc3.orig/fs/inode.c 2007-01-03 10:32:32.000000000 -0800 +++ linux-2.6.20-rc3/fs/inode.c 2007-01-03 10:41:42.000000000 -0800 @@ -147,6 +147,9 @@ mapping->flags = 0; mapping_set_gfp_mask(mapping, GFP_HIGHUSER); mapping->assoc_mapping = NULL; +#ifdef CONFIG_NUMA + mapping->dirty_map = NODE_MASK_NONE; +#endif mapping->backing_dev_info = &default_backing_dev_info; /* Index: linux-2.6.20-rc3/include/linux/fs.h =================================================================== --- linux-2.6.20-rc3.orig/include/linux/fs.h 2007-01-03 10:32:32.000000000 -0800 +++ linux-2.6.20-rc3/include/linux/fs.h 2007-01-03 10:41:42.000000000 -0800 @@ -446,6 +446,9 @@ spinlock_t private_lock; /* for use by the address_space */ struct list_head private_list; /* ditto */ struct address_space *assoc_mapping; /* ditto */ +#ifdef CONFIG_NUMA + nodemask_t dirty_map; /* Map of nodes with dirty pages */ +#endif } __attribute__((aligned(sizeof(long)))); /* * On most architectures that alignment is already the case; but Index: linux-2.6.20-rc3/mm/page-writeback.c =================================================================== --- linux-2.6.20-rc3.orig/mm/page-writeback.c 2007-01-03 10:32:32.000000000 -0800 +++ linux-2.6.20-rc3/mm/page-writeback.c 2007-01-03 11:21:40.000000000 -0800 @@ -813,6 +813,9 @@ if (!spd) spd = __set_page_dirty_buffers; #endif +#ifdef CONFIG_NUMA + node_set(page_to_nid(page), mapping->dirty_map); +#endif return (*spd)(page); } if (!PageDirty(page)) {