[PATCH 1/2] add tunable_notifier function ,take2

Previous thread: [bug] mm/slab.c boot crash in -git, "kernel BUG at mm/slab.c:2103!" by Ingo Molnar on Friday, April 11, 2008 - 12:41 am. (95 messages)

Next thread: [PATCH 0/2] add new notifier function ,take3 by Takenori Nagano on Friday, April 11, 2008 - 12:53 am. (10 messages)
From: Takenori Nagano
Date: Friday, April 11, 2008 - 12:53 am

This patch adds new notifier function tunable_notifier_chain. Its base is
atomic_notifier_chain.

Thanks,

---

Signed-off-by: Takenori Nagano <t-nagano@ah.jp.nec.com>

---
diff -uprN linux-2.6.25-rc8-mm1.orig/include/linux/notifier.h linux-2.6.25-rc8-mm1/include/linux/notifier.h
--- linux-2.6.25-rc8-mm1.orig/include/linux/notifier.h	2008-04-08 16:37:43.700000000 +0900
+++ linux-2.6.25-rc8-mm1/include/linux/notifier.h	2008-04-09 20:01:10.328000000 +0900
@@ -13,6 +13,7 @@
 #include <linux/mutex.h>
 #include <linux/rwsem.h>
 #include <linux/srcu.h>
+#include <linux/kobject.h>
 
 /*
  * Notifier chains are of four types:
@@ -53,6 +54,13 @@ struct notifier_block {
 	int priority;
 };
 
+struct tunable_atomic_notifier_block {
+	struct notifier_block *nb;
+	struct tunable_atomic_notifier_head *head;
+	struct kobject kobj;
+	char *desc;
+};
+
 struct atomic_notifier_head {
 	spinlock_t lock;
 	struct notifier_block *head;
@@ -63,6 +71,13 @@ struct blocking_notifier_head {
 	struct notifier_block *head;
 };
 
+struct tunable_atomic_notifier_head {
+	spinlock_t lock;
+	struct notifier_block *head;
+	char *name;
+	struct kset *notifier_sub_kset;
+};
+
 struct raw_notifier_head {
 	struct notifier_block *head;
 };
@@ -73,6 +88,13 @@ struct srcu_notifier_head {
 	struct notifier_block *head;
 };
 
+struct control_file_info {
+	struct tunable_atomic_notifier_head *nh;
+	struct tunable_atomic_notifier_block *n;
+	char *name;
+	struct control_file_info *next;
+};
+
 #define ATOMIC_INIT_NOTIFIER_HEAD(name) do {	\
 		spin_lock_init(&(name)->lock);	\
 		(name)->head = NULL;		\
@@ -81,6 +103,12 @@ struct srcu_notifier_head {
 		init_rwsem(&(name)->rwsem);	\
 		(name)->head = NULL;		\
 	} while (0)
+#define TUNABLE_ATOMIC_INIT_NOTIFIER(val1, val2) do {		\
+		spin_lock_init(&(val1)->lock);			\
+		(val1)->head = NULL;				\
+		(val1)->name = val2;				\
+		(val1)->notifier_sub_kset = NULL;		\
+	} while (0)
 #define RAW_INIT_NOTIFIER_HEAD(name) do {	\
 ...
From: Greg KH
Date: Friday, April 11, 2008 - 12:55 pm

You are adding sysfs files, not debugfs files, please change your
announcement text.

Also, as you are adding new sysfs files, we need some documentation to
be added to Documentation/ABI/ describing what these files are, what are
in them, and how to use them.

thanks,

greg k-h
--

Previous thread: [bug] mm/slab.c boot crash in -git, "kernel BUG at mm/slab.c:2103!" by Ingo Molnar on Friday, April 11, 2008 - 12:41 am. (95 messages)

Next thread: [PATCH 0/2] add new notifier function ,take3 by Takenori Nagano on Friday, April 11, 2008 - 12:53 am. (10 messages)