summaryrefslogtreecommitdiffstats
path: root/ipc/util.c
diff options
context:
space:
mode:
Diffstat (limited to 'ipc/util.c')
-rw-r--r--ipc/util.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/ipc/util.c b/ipc/util.c
index 2d545d71..7a5d5e3 100644
--- a/ipc/util.c
+++ b/ipc/util.c
@@ -58,6 +58,14 @@ atomic_t nr_ipc_ns = ATOMIC_INIT(1);
#ifdef CONFIG_MEMORY_HOTPLUG
+static void ipc_memory_notifier(struct work_struct *work)
+{
+ ipcns_notify(IPCNS_MEMCHANGED);
+}
+
+static DECLARE_WORK(ipc_memory_wq, ipc_memory_notifier);
+
+
static int ipc_memory_callback(struct notifier_block *self,
unsigned long action, void *arg)
{
@@ -67,8 +75,13 @@ static int ipc_memory_callback(struct notifier_block *self,
/*
* This is done by invoking the ipcns notifier chain with the
* IPC_MEMCHANGED event.
+ * In order not to keep the lock on the hotplug memory chain
+ * for too long, queue a work item that will, when waken up,
+ * activate the ipcns notification chain.
+ * No need to keep several ipc work items on the queue.
*/
- ipcns_notify(IPCNS_MEMCHANGED);
+ if (!work_pending(&ipc_memory_wq))
+ schedule_work(&ipc_memory_wq);
break;
case MEM_GOING_ONLINE:
case MEM_GOING_OFFLINE:
OpenPOWER on IntegriCloud