aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/base
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/base')
-rw-r--r--drivers/base/node.c63
1 files changed, 20 insertions, 43 deletions
diff --git a/drivers/base/node.c b/drivers/base/node.c
index eae2bdc183bb..d7de1753e094 100644
--- a/drivers/base/node.c
+++ b/drivers/base/node.c
@@ -40,24 +40,13 @@ static ssize_t node_read_meminfo(struct sys_device * dev, char * buf)
40 int n; 40 int n;
41 int nid = dev->id; 41 int nid = dev->id;
42 struct sysinfo i; 42 struct sysinfo i;
43 struct page_state ps;
44 unsigned long inactive; 43 unsigned long inactive;
45 unsigned long active; 44 unsigned long active;
46 unsigned long free; 45 unsigned long free;
47 46
48 si_meminfo_node(&i, nid); 47 si_meminfo_node(&i, nid);
49 get_page_state_node(&ps, nid);
50 __get_zone_counts(&active, &inactive, &free, NODE_DATA(nid)); 48 __get_zone_counts(&active, &inactive, &free, NODE_DATA(nid));
51 49
52 /* Check for negative values in these approximate counters */
53 if ((long)ps.nr_dirty < 0)
54 ps.nr_dirty = 0;
55 if ((long)ps.nr_writeback < 0)
56 ps.nr_writeback = 0;
57 if ((long)ps.nr_mapped < 0)
58 ps.nr_mapped = 0;
59 if ((long)ps.nr_slab < 0)
60 ps.nr_slab = 0;
61 50
62 n = sprintf(buf, "\n" 51 n = sprintf(buf, "\n"
63 "Node %d MemTotal: %8lu kB\n" 52 "Node %d MemTotal: %8lu kB\n"
@@ -71,7 +60,12 @@ static ssize_t node_read_meminfo(struct sys_device * dev, char * buf)
71 "Node %d LowFree: %8lu kB\n" 60 "Node %d LowFree: %8lu kB\n"
72 "Node %d Dirty: %8lu kB\n" 61 "Node %d Dirty: %8lu kB\n"
73 "Node %d Writeback: %8lu kB\n" 62 "Node %d Writeback: %8lu kB\n"
63 "Node %d FilePages: %8lu kB\n"
74 "Node %d Mapped: %8lu kB\n" 64 "Node %d Mapped: %8lu kB\n"
65 "Node %d AnonPages: %8lu kB\n"
66 "Node %d PageTables: %8lu kB\n"
67 "Node %d NFS Unstable: %8lu kB\n"
68 "Node %d Bounce: %8lu kB\n"
75 "Node %d Slab: %8lu kB\n", 69 "Node %d Slab: %8lu kB\n",
76 nid, K(i.totalram), 70 nid, K(i.totalram),
77 nid, K(i.freeram), 71 nid, K(i.freeram),
@@ -82,10 +76,15 @@ static ssize_t node_read_meminfo(struct sys_device * dev, char * buf)
82 nid, K(i.freehigh), 76 nid, K(i.freehigh),
83 nid, K(i.totalram - i.totalhigh), 77 nid, K(i.totalram - i.totalhigh),
84 nid, K(i.freeram - i.freehigh), 78 nid, K(i.freeram - i.freehigh),
85 nid, K(ps.nr_dirty), 79 nid, K(node_page_state(nid, NR_FILE_DIRTY)),
86 nid, K(ps.nr_writeback), 80 nid, K(node_page_state(nid, NR_WRITEBACK)),
87 nid, K(ps.nr_mapped), 81 nid, K(node_page_state(nid, NR_FILE_PAGES)),
88 nid, K(ps.nr_slab)); 82 nid, K(node_page_state(nid, NR_FILE_MAPPED)),
83 nid, K(node_page_state(nid, NR_ANON_PAGES)),
84 nid, K(node_page_state(nid, NR_PAGETABLE)),
85 nid, K(node_page_state(nid, NR_UNSTABLE_NFS)),
86 nid, K(node_page_state(nid, NR_BOUNCE)),
87 nid, K(node_page_state(nid, NR_SLAB)));
89 n += hugetlb_report_node_meminfo(nid, buf + n); 88 n += hugetlb_report_node_meminfo(nid, buf + n);
90 return n; 89 return n;
91} 90}
@@ -95,28 +94,6 @@ static SYSDEV_ATTR(meminfo, S_IRUGO, node_read_meminfo, NULL);
95 94
96static ssize_t node_read_numastat(struct sys_device * dev, char * buf) 95static ssize_t node_read_numastat(struct sys_device * dev, char * buf)
97{ 96{
98 unsigned long numa_hit, numa_miss, interleave_hit, numa_foreign;
99 unsigned long local_node, other_node;
100 int i, cpu;
101 pg_data_t *pg = NODE_DATA(dev->id);
102 numa_hit = 0;
103 numa_miss = 0;
104 interleave_hit = 0;
105 numa_foreign = 0;
106 local_node = 0;
107 other_node = 0;
108 for (i = 0; i < MAX_NR_ZONES; i++) {
109 struct zone *z = &pg->node_zones[i];
110 for_each_online_cpu(cpu) {
111 struct per_cpu_pageset *ps = zone_pcp(z,cpu);
112 numa_hit += ps->numa_hit;
113 numa_miss += ps->numa_miss;
114 numa_foreign += ps->numa_foreign;
115 interleave_hit += ps->interleave_hit;
116 local_node += ps->local_node;
117 other_node += ps->other_node;
118 }
119 }
120 return sprintf(buf, 97 return sprintf(buf,
121 "numa_hit %lu\n" 98 "numa_hit %lu\n"
122 "numa_miss %lu\n" 99 "numa_miss %lu\n"
@@ -124,12 +101,12 @@ static ssize_t node_read_numastat(struct sys_device * dev, char * buf)
124 "interleave_hit %lu\n" 101 "interleave_hit %lu\n"
125 "local_node %lu\n" 102 "local_node %lu\n"
126 "other_node %lu\n", 103 "other_node %lu\n",
127 numa_hit, 104 node_page_state(dev->id, NUMA_HIT),
128 numa_miss, 105 node_page_state(dev->id, NUMA_MISS),
129 numa_foreign, 106 node_page_state(dev->id, NUMA_FOREIGN),
130 interleave_hit, 107 node_page_state(dev->id, NUMA_INTERLEAVE_HIT),
131 local_node, 108 node_page_state(dev->id, NUMA_LOCAL),
132 other_node); 109 node_page_state(dev->id, NUMA_OTHER));
133} 110}
134static SYSDEV_ATTR(numastat, S_IRUGO, node_read_numastat, NULL); 111static SYSDEV_ATTR(numastat, S_IRUGO, node_read_numastat, NULL);
135 112