Skip to contentSkip to conversation

node meminfo Active & Inactive pages to Kbytes

PATCH In review John Blackwood 2 participants 3 messages Jul 3, 2008 – Jul 5, 2008 Driver core

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 node meminfo Active & Inactive pages to Kbytes

Hi Andrew and Andi,

We found a minor bug in the output of /sys/devices/system/node/node[n]/meminfo
where the Active and Inactive values are in pages instead of Kbytes.

Looks like this occurred back in 2.6.20 when the code was changed over to use node_page_state().

Thanks.

drivers/base/node.c +2 -2
@@ -84,8 +84,8 @@ static ssize_t node_read_meminfo(struct
 		       nid, K(i.totalram),
 		       nid, K(i.freeram),
 		       nid, K(i.totalram - i.freeram),
-		       nid, node_page_state(nid, NR_ACTIVE),
-		       nid, node_page_state(nid, NR_INACTIVE),
+		       nid, K(node_page_state(nid, NR_ACTIVE)),
+		       nid, K(node_page_state(nid, NR_INACTIVE)),
 #ifdef CONFIG_HIGHMEM
 		       nid, K(i.totalhigh),
 		       nid, K(i.freehigh),
#1 lore raw
Quoted 14 lines · On Thu, 3 Jul 2008 10:35:57 -0400 John Blackwood <[email protected]>…

Hi Andrew and Andi,

We found a minor bug in the output of /sys/devices/system/node/node[n]/meminfo
where the Active and Inactive values are in pages instead of Kbytes.

Looks like this occurred back in 2.6.20 when the code was changed over to use node_page_state().

Thanks.

drivers/base/node.c static ssize_t node_read_meminfo(struct · line 91

Quoted 10 lines
drivers/base/node.c +2 -2
@@ -84,8 +84,8 @@ static ssize_t node_read_meminfo(struct
  		       nid, K(i.totalram),
  		       nid, K(i.freeram),
  		       nid, K(i.totalram - i.freeram),
-		       nid, node_page_state(nid, NR_ACTIVE),
-		       nid, node_page_state(nid, NR_INACTIVE),
+		       nid, K(node_page_state(nid, NR_ACTIVE)),
+		       nid, K(node_page_state(nid, NR_INACTIVE)),
  #ifdef CONFIG_HIGHMEM
  		       nid, K(i.totalhigh),
  		       nid, K(i.freehigh),

ug. After all that time there might be applications out there which use the existing numbers and work around the kernel bug. Which we'll break if we fix it.

otoh, who the heck cares about the per-node active and inactive page counts?

I guess we just fix this, backport the fix as far as we can and apologise for any fallout. Not that there's likely to be any.

Please do remember to add a Signed-off-by: for kernel patches.

#2 lore raw
Quoted 23 lines · Andrew Morton
Quoted 20 lines · On Thu, 3 Jul 2008 10:35:57 -0400 John Blackwood <[email protected]>…

Hi Andrew and Andi,

We found a minor bug in the output of /sys/devices/system/node/node[n]/meminfo
where the Active and Inactive values are in pages instead of Kbytes.

Looks like this occurred back in 2.6.20 when the code was changed over to use node_page_state().

Thanks.

drivers/base/node.c 2008-07-03 09:25:45.000000000 -0400 renamed from drivers/base/node.c 2008-07-03 09:26:01.000000000 -0400 +1 -2
@@ -84,8 +84,8 @@ static ssize_t node_read_meminfo(struct
                     nid, K(i.totalram),
                     nid, K(i.freeram),
                     nid, K(i.totalram - i.freeram),
-                    nid, node_page_state(nid, NR_ACTIVE),
-                    nid, node_page_state(nid, NR_INACTIVE),
+                    nid, K(node_page_state(nid, NR_ACTIVE)),
Quoted 8 lines

drivers/base/node.c 2008-07-03 09:25:45.000000000 -0400 static ssize_t node_read_meminfo(struct · line 91

Quoted 4 lines
drivers/base/node.c 2008-07-03 09:25:45.000000000 -0400 renamed from drivers/base/node.c 2008-07-03 09:26:01.000000000 -0400 +1 -0
+                    nid, K(node_page_state(nid, NR_INACTIVE)),
  #ifdef CONFIG_HIGHMEM
                     nid, K(i.totalhigh),
                     nid, K(i.freehigh),

ug. After all that time there might be applications out there which use the existing numbers and work around the kernel bug. Which we'll break if we fix it.

true. our tool that looks at these numbers is going to be changed to optionally multiply the values by 4 based on the kernel revision/version number once this change makes it into the main tree.

Quoted 2 lines

otoh, who the heck cares about the per-node active and inactive page counts?

:-)

Quoted 3 lines

I guess we just fix this, backport the fix as far as we can and apologise for any fallout. Not that there's likely to be any.

o.k. Thanks.

Quoted 2 lines

Please do remember to add a Signed-off-by: for kernel patches.

o.k. Sorry about that.