Skip to content

Commit

Permalink
ipc: invoke the ipcns notifier chain as a work item
Browse files Browse the repository at this point in the history
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 <[email protected]>
Cc: Yasunori Goto <[email protected]>
Cc: Matt Helsley <[email protected]>
Cc: Mingming Cao <[email protected]>
Cc: Pierre Peiffer <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Nadia Derbey authored and torvalds committed Apr 29, 2008
1 parent b6b337a commit 424450c
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion ipc/util.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand All @@ -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:
Expand Down

0 comments on commit 424450c

Please sign in to comment.