Skip to contentSkip to conversation

/proc/vmload memory_pressure meter

PATCH In review Paul Larson 2 participants 2 messages Aug 30, 2001 Proc filesystem

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 /proc/vmload memory_pressure meter

This patch adds /proc/vmload that reports the current value of memory_pressure. The idea came from an enhancement proposed on the linux-mm bugzilla (#3007, but it seems to be down atm).

This patch was made against 2.4.10-pre2.

-Paul Larson

fs/proc/proc_misc.c +10 -0
diff -urN linux-2.4.10-pre2/fs/proc/proc_misc.c linux-2.4.10-pre2-vmload/fs/proc/proc_misc.c
@@ -199,6 +199,15 @@
 #undef K
 }
 
+vmload_read_proc(char *page, char **start, off_t off,
+				 int count, int *eof, void *data) {
+	int len = 0;
+ 
+	len += sprintf(page+len, "%d\n", memory_pressure);
+	*eof = 1;
+	return len;
+}
+
 static int version_read_proc(char *page, char **start, off_t off,
 				 int count, int *eof, void *data)
 {
@@ -518,6 +527,7 @@
 		{"loadavg",     loadavg_read_proc},
 		{"uptime",	uptime_read_proc},
 		{"meminfo",	meminfo_read_proc},
+		{"vmload",	vmload_read_proc},
 		{"version",	version_read_proc},
 		{"cpuinfo",	cpuinfo_read_proc},
 #ifdef CONFIG_PROC_HARDWARE