diff options
Diffstat (limited to 'mm/vmstat.c')
| -rw-r--r-- | mm/vmstat.c | 44 |
1 files changed, 30 insertions, 14 deletions
diff --git a/mm/vmstat.c b/mm/vmstat.c index 355a9e669aaa..cd2e42be7b68 100644 --- a/mm/vmstat.c +++ b/mm/vmstat.c | |||
| @@ -17,6 +17,8 @@ | |||
| 17 | #include <linux/vmstat.h> | 17 | #include <linux/vmstat.h> |
| 18 | #include <linux/sched.h> | 18 | #include <linux/sched.h> |
| 19 | #include <linux/math64.h> | 19 | #include <linux/math64.h> |
| 20 | #include <linux/writeback.h> | ||
| 21 | #include <linux/compaction.h> | ||
| 20 | 22 | ||
| 21 | #ifdef CONFIG_VM_EVENT_COUNTERS | 23 | #ifdef CONFIG_VM_EVENT_COUNTERS |
| 22 | DEFINE_PER_CPU(struct vm_event_state, vm_event_states) = {{0}}; | 24 | DEFINE_PER_CPU(struct vm_event_state, vm_event_states) = {{0}}; |
| @@ -394,6 +396,7 @@ void zone_statistics(struct zone *preferred_zone, struct zone *z) | |||
| 394 | #endif | 396 | #endif |
| 395 | 397 | ||
| 396 | #ifdef CONFIG_COMPACTION | 398 | #ifdef CONFIG_COMPACTION |
| 399 | |||
| 397 | struct contig_page_info { | 400 | struct contig_page_info { |
| 398 | unsigned long free_pages; | 401 | unsigned long free_pages; |
| 399 | unsigned long free_blocks_total; | 402 | unsigned long free_blocks_total; |
| @@ -745,6 +748,11 @@ static const char * const vmstat_text[] = { | |||
| 745 | "nr_isolated_anon", | 748 | "nr_isolated_anon", |
| 746 | "nr_isolated_file", | 749 | "nr_isolated_file", |
| 747 | "nr_shmem", | 750 | "nr_shmem", |
| 751 | "nr_dirtied", | ||
| 752 | "nr_written", | ||
| 753 | "nr_dirty_threshold", | ||
| 754 | "nr_dirty_background_threshold", | ||
| 755 | |||
| 748 | #ifdef CONFIG_NUMA | 756 | #ifdef CONFIG_NUMA |
| 749 | "numa_hit", | 757 | "numa_hit", |
| 750 | "numa_miss", | 758 | "numa_miss", |
| @@ -904,36 +912,44 @@ static const struct file_operations proc_zoneinfo_file_operations = { | |||
| 904 | .release = seq_release, | 912 | .release = seq_release, |
| 905 | }; | 913 | }; |
| 906 | 914 | ||
| 915 | enum writeback_stat_item { | ||
| 916 | NR_DIRTY_THRESHOLD, | ||
| 917 | NR_DIRTY_BG_THRESHOLD, | ||
| 918 | NR_VM_WRITEBACK_STAT_ITEMS, | ||
| 919 | }; | ||
| 920 | |||
| 907 | static void *vmstat_start(struct seq_file *m, loff_t *pos) | 921 | static void *vmstat_start(struct seq_file *m, loff_t *pos) |
| 908 | { | 922 | { |
| 909 | unsigned long *v; | 923 | unsigned long *v; |
| 910 | #ifdef CONFIG_VM_EVENT_COUNTERS | 924 | int i, stat_items_size; |
| 911 | unsigned long *e; | ||
| 912 | #endif | ||
| 913 | int i; | ||
| 914 | 925 | ||
| 915 | if (*pos >= ARRAY_SIZE(vmstat_text)) | 926 | if (*pos >= ARRAY_SIZE(vmstat_text)) |
| 916 | return NULL; | 927 | return NULL; |
| 928 | stat_items_size = NR_VM_ZONE_STAT_ITEMS * sizeof(unsigned long) + | ||
| 929 | NR_VM_WRITEBACK_STAT_ITEMS * sizeof(unsigned long); | ||
| 917 | 930 | ||
| 918 | #ifdef CONFIG_VM_EVENT_COUNTERS | 931 | #ifdef CONFIG_VM_EVENT_COUNTERS |
| 919 | v = kmalloc(NR_VM_ZONE_STAT_ITEMS * sizeof(unsigned long) | 932 | stat_items_size += sizeof(struct vm_event_state); |
| 920 | + sizeof(struct vm_event_state), GFP_KERNEL); | ||
| 921 | #else | ||
| 922 | v = kmalloc(NR_VM_ZONE_STAT_ITEMS * sizeof(unsigned long), | ||
| 923 | GFP_KERNEL); | ||
| 924 | #endif | 933 | #endif |
| 934 | |||
| 935 | v = kmalloc(stat_items_size, GFP_KERNEL); | ||
| 925 | m->private = v; | 936 | m->private = v; |
| 926 | if (!v) | 937 | if (!v) |
| 927 | return ERR_PTR(-ENOMEM); | 938 | return ERR_PTR(-ENOMEM); |
| 928 | for (i = 0; i < NR_VM_ZONE_STAT_ITEMS; i++) | 939 | for (i = 0; i < NR_VM_ZONE_STAT_ITEMS; i++) |
| 929 | v[i] = global_page_state(i); | 940 | v[i] = global_page_state(i); |
| 941 | v += NR_VM_ZONE_STAT_ITEMS; | ||
| 942 | |||
| 943 | global_dirty_limits(v + NR_DIRTY_BG_THRESHOLD, | ||
| 944 | v + NR_DIRTY_THRESHOLD); | ||
| 945 | v += NR_VM_WRITEBACK_STAT_ITEMS; | ||
| 946 | |||
| 930 | #ifdef CONFIG_VM_EVENT_COUNTERS | 947 | #ifdef CONFIG_VM_EVENT_COUNTERS |
| 931 | e = v + NR_VM_ZONE_STAT_ITEMS; | 948 | all_vm_events(v); |
| 932 | all_vm_events(e); | 949 | v[PGPGIN] /= 2; /* sectors -> kbytes */ |
| 933 | e[PGPGIN] /= 2; /* sectors -> kbytes */ | 950 | v[PGPGOUT] /= 2; |
| 934 | e[PGPGOUT] /= 2; | ||
| 935 | #endif | 951 | #endif |
| 936 | return v + *pos; | 952 | return m->private + *pos; |
| 937 | } | 953 | } |
| 938 | 954 | ||
| 939 | static void *vmstat_next(struct seq_file *m, void *arg, loff_t *pos) | 955 | static void *vmstat_next(struct seq_file *m, void *arg, loff_t *pos) |
