Commit 424450c1dbe72b6e2637e91108417d7d9580c4c3

Authored by Nadia Derbey
Committed by Linus Torvalds
1 parent b6b337ad1c

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>

Showing 1 changed file with 14 additions and 1 deletions Side-by-side Diff

... ... @@ -58,6 +58,14 @@
58 58  
59 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 69 static int ipc_memory_callback(struct notifier_block *self,
62 70 unsigned long action, void *arg)
63 71 {
64 72  
... ... @@ -67,8 +75,13 @@
67 75 /*
68 76 * This is done by invoking the ipcns notifier chain with the
69 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 85 break;
73 86 case MEM_GOING_ONLINE:
74 87 case MEM_GOING_OFFLINE: