writeback: add /sys/devices/system/node/<node>/vmstat
For NUMA node systems it is important to have visibility in memory characteristics. Two of the /proc/vmstat values "nr_written" and "nr_dirtied" are added here. # cat /sys/devices/system/node/node20/vmstat nr_written 0 nr_dirtied 0 Signed-off-by: Michael Rubin <mrubin@google.com> Reviewed-by: Wu Fengguang <fengguang.wu@intel.com> Cc: Dave Chinner <david@fromorbit.com> Cc: Jens Axboe <axboe@kernel.dk> Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com> Cc: Nick Piggin <nickpiggin@yahoo.com.au> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
		
							parent
							
								
									ea941f0e2a
								
							
						
					
					
						commit
						2ac390370a
					
				| @ -160,6 +160,18 @@ static ssize_t node_read_numastat(struct sys_device * dev, | |||||||
| } | } | ||||||
| static SYSDEV_ATTR(numastat, S_IRUGO, node_read_numastat, NULL); | static SYSDEV_ATTR(numastat, S_IRUGO, node_read_numastat, NULL); | ||||||
| 
 | 
 | ||||||
|  | static ssize_t node_read_vmstat(struct sys_device *dev, | ||||||
|  | 				struct sysdev_attribute *attr, char *buf) | ||||||
|  | { | ||||||
|  | 	int nid = dev->id; | ||||||
|  | 	return sprintf(buf, | ||||||
|  | 		"nr_written %lu\n" | ||||||
|  | 		"nr_dirtied %lu\n", | ||||||
|  | 		node_page_state(nid, NR_WRITTEN), | ||||||
|  | 		node_page_state(nid, NR_DIRTIED)); | ||||||
|  | } | ||||||
|  | static SYSDEV_ATTR(vmstat, S_IRUGO, node_read_vmstat, NULL); | ||||||
|  | 
 | ||||||
| static ssize_t node_read_distance(struct sys_device * dev, | static ssize_t node_read_distance(struct sys_device * dev, | ||||||
| 			struct sysdev_attribute *attr, char * buf) | 			struct sysdev_attribute *attr, char * buf) | ||||||
| { | { | ||||||
| @ -243,6 +255,7 @@ int register_node(struct node *node, int num, struct node *parent) | |||||||
| 		sysdev_create_file(&node->sysdev, &attr_meminfo); | 		sysdev_create_file(&node->sysdev, &attr_meminfo); | ||||||
| 		sysdev_create_file(&node->sysdev, &attr_numastat); | 		sysdev_create_file(&node->sysdev, &attr_numastat); | ||||||
| 		sysdev_create_file(&node->sysdev, &attr_distance); | 		sysdev_create_file(&node->sysdev, &attr_distance); | ||||||
|  | 		sysdev_create_file(&node->sysdev, &attr_vmstat); | ||||||
| 
 | 
 | ||||||
| 		scan_unevictable_register_node(node); | 		scan_unevictable_register_node(node); | ||||||
| 
 | 
 | ||||||
| @ -267,6 +280,7 @@ void unregister_node(struct node *node) | |||||||
| 	sysdev_remove_file(&node->sysdev, &attr_meminfo); | 	sysdev_remove_file(&node->sysdev, &attr_meminfo); | ||||||
| 	sysdev_remove_file(&node->sysdev, &attr_numastat); | 	sysdev_remove_file(&node->sysdev, &attr_numastat); | ||||||
| 	sysdev_remove_file(&node->sysdev, &attr_distance); | 	sysdev_remove_file(&node->sysdev, &attr_distance); | ||||||
|  | 	sysdev_remove_file(&node->sysdev, &attr_vmstat); | ||||||
| 
 | 
 | ||||||
| 	scan_unevictable_unregister_node(node); | 	scan_unevictable_unregister_node(node); | ||||||
| 	hugetlb_unregister_node(node);		/* no-op, if memoryless node */ | 	hugetlb_unregister_node(node);		/* no-op, if memoryless node */ | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user