You've already forked linux-apfs
mirror of
https://github.com/linux-apfs/linux-apfs.git
synced 2026-05-01 15:00:59 -07:00
memory hotplug: rearrange memory hotplug notifier
Current memory notifier has some defects yet. (Fortunately, nothing uses
it.) This patch is to fix and rearrange for them.
- Add information of start_pfn, nr_pages, and node id if node status is
changes from/to memoryless node for callback functions.
Callbacks can't do anything without those information.
- Add notification going-online status.
It is necessary for creating per node structure before the node's
pages are available.
- Move GOING_OFFLINE status notification after page isolation.
It is good place for return memory like cache for callback,
because returned page is not used again.
- Make CANCEL events for rollingback when error occurs.
- Delete MEM_MAPPING_INVALID notification. It will be not used.
- Fix compile error of (un)register_memory_notifier().
Signed-off-by: Yasunori Goto <y-goto@jp.fujitsu.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
committed by
Linus Torvalds
parent
10020ca246
commit
7b78d335ac
@@ -137,7 +137,7 @@ static ssize_t show_mem_state(struct sys_device *dev, char *buf)
|
||||
return len;
|
||||
}
|
||||
|
||||
static inline int memory_notify(unsigned long val, void *v)
|
||||
int memory_notify(unsigned long val, void *v)
|
||||
{
|
||||
return blocking_notifier_call_chain(&memory_chain, val, v);
|
||||
}
|
||||
@@ -183,7 +183,6 @@ memory_block_action(struct memory_block *mem, unsigned long action)
|
||||
break;
|
||||
case MEM_OFFLINE:
|
||||
mem->state = MEM_GOING_OFFLINE;
|
||||
memory_notify(MEM_GOING_OFFLINE, NULL);
|
||||
start_paddr = page_to_pfn(first_page) << PAGE_SHIFT;
|
||||
ret = remove_memory(start_paddr,
|
||||
PAGES_PER_SECTION << PAGE_SHIFT);
|
||||
@@ -191,7 +190,6 @@ memory_block_action(struct memory_block *mem, unsigned long action)
|
||||
mem->state = old_state;
|
||||
break;
|
||||
}
|
||||
memory_notify(MEM_MAPPING_INVALID, NULL);
|
||||
break;
|
||||
default:
|
||||
printk(KERN_WARNING "%s(%p, %ld) unknown action: %ld\n",
|
||||
@@ -199,11 +197,6 @@ memory_block_action(struct memory_block *mem, unsigned long action)
|
||||
WARN_ON(1);
|
||||
ret = -EINVAL;
|
||||
}
|
||||
/*
|
||||
* For now, only notify on successful memory operations
|
||||
*/
|
||||
if (!ret)
|
||||
memory_notify(action, NULL);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user