[PATCH 16/17] mm: create /vm/dirty_pressure in debugfs

From: Wu Fengguang
Date: Sun Sep 12 2010 - 11:58:10 EST


Create /debug/vm/ -- a convenient place for kernel hackers to play with
VM variables.

The first exported is vm_dirty_pressure for avoiding excessive pageout()s.
It ranges from 0 to 1024, the lower value, the lower dirty limit.

Signed-off-by: Wu Fengguang <fengguang.wu@xxxxxxxxx>
---
mm/vmstat.c | 29 +++++++++++++++++++++++++++--
1 file changed, 27 insertions(+), 2 deletions(-)

--- linux-next.orig/mm/vmstat.c 2010-09-12 09:50:57.000000000 +0800
+++ linux-next/mm/vmstat.c 2010-09-12 13:27:44.000000000 +0800
@@ -1045,9 +1045,33 @@ static int __init setup_vmstat(void)
}
module_init(setup_vmstat)

-#if defined(CONFIG_DEBUG_FS) && defined(CONFIG_COMPACTION)
+#if defined(CONFIG_DEBUG_FS)
#include <linux/debugfs.h>
+#include <linux/writeback.h>

+static struct dentry *vm_debug_root;
+
+static int __init vm_debug_init(void)
+{
+ struct dentry *dentry;
+
+ vm_debug_root = debugfs_create_dir("vm", NULL);
+ if (!vm_debug_root)
+ goto fail;
+
+ dentry = debugfs_create_u32("dirty_pressure", 0644,
+ vm_debug_root, &vm_dirty_pressure);
+ if (!dentry)
+ goto fail;
+
+ return 0;
+fail:
+ return -ENOMEM;
+}
+
+module_init(vm_debug_init);
+
+#if defined(CONFIG_COMPACTION)
static struct dentry *extfrag_debug_root;

/*
@@ -1202,4 +1226,5 @@ static int __init extfrag_debug_init(voi
}

module_init(extfrag_debug_init);
-#endif
+#endif /* CONFIG_COMPACTION */
+#endif /* CONFIG_DEBUG_FS */


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/