diff options
author | Nadia Derbey <Nadia.Derbey@bull.net> | 2008-04-29 04:00:43 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-04-29 11:06:12 -0400 |
commit | 424450c1dbe72b6e2637e91108417d7d9580c4c3 (patch) | |
tree | 472fd07a519cdfd594a15da5d2167d8de937e95e /ipc | |
parent | b6b337ad1c1d6fe11b09b35d75464b84b3e11f07 (diff) |
ipc: invoke the ipcns notifier chain as a work item
Make the memory hotplug chain's mutex held for a shorter time: when memory is
offlined or onlined a work item is added to the global workqueue. When the
work item is run, it notifies the ipcns notifier chain with the
IPCNS_MEMCHANGED event.
Signed-off-by: Nadia Derbey <Nadia.Derbey@bull.net>
Cc: Yasunori Goto <y-goto@jp.fujitsu.com>
Cc: Matt Helsley <matthltc@us.ibm.com>
Cc: Mingming Cao <cmm@us.ibm.com>
Cc: Pierre Peiffer <pierre.peiffer@bull.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'ipc')
-rw-r--r-- | ipc/util.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/ipc/util.c b/ipc/util.c index 2d545d7144a7..7a5d5e393c4b 100644 --- a/ipc/util.c +++ b/ipc/util.c | |||
@@ -58,6 +58,14 @@ atomic_t nr_ipc_ns = ATOMIC_INIT(1); | |||
58 | 58 | ||
59 | #ifdef CONFIG_MEMORY_HOTPLUG | 59 | #ifdef CONFIG_MEMORY_HOTPLUG |
60 | 60 | ||
61 | static void ipc_memory_notifier(struct work_struct *work) | ||
62 | { | ||
63 | ipcns_notify(IPCNS_MEMCHANGED); | ||
64 | } | ||
65 | |||
66 | static DECLARE_WORK(ipc_memory_wq, ipc_memory_notifier); | ||
67 | |||
68 | |||
61 | static int ipc_memory_callback(struct notifier_block *self, | 69 | static int ipc_memory_callback(struct notifier_block *self, |
62 | unsigned long action, void *arg) | 70 | unsigned long action, void *arg) |
63 | { | 71 | { |
@@ -67,8 +75,13 @@ static int ipc_memory_callback(struct notifier_block *self, | |||
67 | /* | 75 | /* |
68 | * This is done by invoking the ipcns notifier chain with the | 76 | * This is done by invoking the ipcns notifier chain with the |
69 | * IPC_MEMCHANGED event. | 77 | * IPC_MEMCHANGED event. |
78 | * In order not to keep the lock on the hotplug memory chain | ||
79 | * for too long, queue a work item that will, when waken up, | ||
80 | * activate the ipcns notification chain. | ||
81 | * No need to keep several ipc work items on the queue. | ||
70 | */ | 82 | */ |
71 | ipcns_notify(IPCNS_MEMCHANGED); | 83 | if (!work_pending(&ipc_memory_wq)) |
84 | schedule_work(&ipc_memory_wq); | ||
72 | break; | 85 | break; |
73 | case MEM_GOING_ONLINE: | 86 | case MEM_GOING_ONLINE: |
74 | case MEM_GOING_OFFLINE: | 87 | case MEM_GOING_OFFLINE: |