Skip to contentSkip to conversation

Display 0 in meminfo for Committed_AS when value underflows

PATCH In review Eric B Munson 4 participants 5 messages Apr 27, 2009

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Display 0 in meminfo for Committed_AS when value underflows

Andrew,

Please merge the following patch.

Splitting this patch from the chunk that addresses the cause of the underflow because the solution still requires some discussion.

Dave Hansen reported that under certain cirumstances the Committed_AS value can underflow which causes extremely large numbers to be displayed in meminfo. This patch adds an underflow check to meminfo_proc_show() for the Committed_AS value. Most fields in /proc/meminfo already have an underflow check, this brings Committed_AS into line.

From: KOSAKI Motohiro <[email protected]>

---
 fs/proc/meminfo.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
fs/proc/meminfo.c +3 -1
index 74ea974..facb9fb 100644
@@ -22,7 +22,7 @@ void __attribute__((weak)) arch_report_meminfo(struct seq_file *m)
 static int meminfo_proc_show(struct seq_file *m, void *v)
 {
 	struct sysinfo i;
-	unsigned long committed;
+	long committed;
 	unsigned long allowed;
 	struct vmalloc_info vmi;
 	long cached;
@@ -36,6 +36,8 @@ static int meminfo_proc_show(struct seq_file *m, void *v)
 	si_meminfo(&i);
 	si_swapinfo(&i);
 	committed = atomic_long_read(&vm_committed_space);
+	if (committed < 0)
+		committed = 0;
 	allowed = ((totalram_pages - hugetlb_total_pages())
 		* sysctl_overcommit_ratio / 100) + total_swap_pages;
 
Signature · 7 lines
1.6.1.2

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
#1 lore raw
Quoted 8 lines · Eric B Munson

Splitting this patch from the chunk that addresses the cause of the underflow because the solution still requires some discussion.

Dave Hansen reported that under certain cirumstances the Committed_AS value can underflow which causes extremely large numbers to be displayed in meminfo. This patch adds an underflow check to meminfo_proc_show() for the Committed_AS value. Most fields in /proc/meminfo already have an underflow check, this brings Committed_AS into line.

Yeah, this is the right fix for now until we can iron out the base issues. Eric, I think this may also be a candidate for -stable.

Quoted 21 lines

From: KOSAKI Motohiro <[email protected]>

---
 fs/proc/meminfo.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
fs/proc/meminfo.c +1 -1
index 74ea974..facb9fb 100644
@@ -22,7 +22,7 @@ void __attribute__((weak)) arch_report_meminfo(struct seq_file *m)
 static int meminfo_proc_show(struct seq_file *m, void *v)
 {
 	struct sysinfo i;
-	unsigned long committed;
+	long committed;
 	unsigned long allowed;
 	struct vmalloc_info vmi;
 	long cached;

fs/proc/meminfo.c static int meminfo_proc_show(struct seq_file *m, void *v) · line 43

Quoted 8 lines
fs/proc/meminfo.c +2 -0
@@ -36,6 +36,8 @@ static int meminfo_proc_show(struct seq_file *m, void *v)
 	si_meminfo(&i);
 	si_swapinfo(&i);
 	committed = atomic_long_read(&vm_committed_space);
+	if (committed < 0)
+		committed = 0;
 	allowed = ((totalram_pages - hugetlb_total_pages())
 		* sysctl_overcommit_ratio / 100) + total_swap_pages;
 

-- Dave

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#2 lore raw
Quoted 2 lines · Dave Hansen

Yeah, this is the right fix for now until we can iron out the base issues. Eric, I think this may also be a candidate for -stable.

Is there any way you could use a ZVC there? Those already have the underflow prevention logic. See include/linux/vmstat.h and mm/vmstat.c

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

maintainer
#3 lore raw
In reply to Dave Hansen
Quoted 10 lines · On Mon, 27 Apr 2009 09:15:14 -0700 Dave Hansen <[email protected]> wrote:
Quoted 8 lines · Eric B Munson

Splitting this patch from the chunk that addresses the cause of the underflow because the solution still requires some discussion.

Dave Hansen reported that under certain cirumstances the Committed_AS value can underflow which causes extremely large numbers to be displayed in meminfo. This patch adds an underflow check to meminfo_proc_show() for the Committed_AS value. Most fields in /proc/meminfo already have an underflow check, this brings Committed_AS into line.

Quoted 4 lines

Yeah, this is the right fix for now until we can iron out the base issues. Eric, I think this may also be a candidate for -stable.

I cannot find Eric's original patch anywhere. Did some demented MTA munch it?

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#4 lore raw
Quoted 12 lines · Andrew Morton
Quoted 10 lines · On Mon, 27 Apr 2009 09:15:14 -0700 Dave Hansen <[email protected]> wrote:
Quoted 8 lines · Eric B Munson

Splitting this patch from the chunk that addresses the cause of the underflow because the solution still requires some discussion.

Dave Hansen reported that under certain cirumstances the Committed_AS value can underflow which causes extremely large numbers to be displayed in meminfo. This patch adds an underflow check to meminfo_proc_show() for the Committed_AS value. Most fields in /proc/meminfo already have an underflow check, this brings Committed_AS into line.

Quoted 6 lines
Quoted 4 lines

Yeah, this is the right fix for now until we can iron out the base issues. Eric, I think this may also be a candidate for -stable.

I cannot find Eric's original patch anywhere. Did some demented MTA munch it?

Here's the version that I got. My guess would be that your copy is sitting in some IBM mail server's queue right now. It might show up in a couple of days. :)

---

Andrew,

Please merge the following patch.

Splitting this patch from the chunk that addresses the cause of the underflow because the solution still requires some discussion.

Dave Hansen reported that under certain cirumstances the Committed_AS value can underflow which causes extremely large numbers to be displayed in meminfo. This patch adds an underflow check to meminfo_proc_show() for the Committed_AS value. Most fields in /proc/meminfo already have an underflow check, this brings Committed_AS into line.

From: KOSAKI Motohiro <[email protected]>

---
 fs/proc/meminfo.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
fs/proc/meminfo.c +3 -1
index 74ea974..facb9fb 100644
@@ -22,7 +22,7 @@ void __attribute__((weak)) arch_report_meminfo(struct seq_file *m)
 static int meminfo_proc_show(struct seq_file *m, void *v)
 {
 	struct sysinfo i;
-	unsigned long committed;
+	long committed;
 	unsigned long allowed;
 	struct vmalloc_info vmi;
 	long cached;
@@ -36,6 +36,8 @@ static int meminfo_proc_show(struct seq_file *m, void *v)
 	si_meminfo(&i);
 	si_swapinfo(&i);
 	committed = atomic_long_read(&vm_committed_space);
+	if (committed < 0)
+		committed = 0;
 	allowed = ((totalram_pages - hugetlb_total_pages())
 		* sysctl_overcommit_ratio / 100) + total_swap_pages;
 
Signature · 10 lines
1.6.1.2


-- Dave

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>