diff options
| author | Oscar Salvador <[email protected]> | 2025-06-16 13:51:46 +0000 |
|---|---|---|
| committer | Andrew Morton <[email protected]> | 2025-07-13 23:38:15 +0000 |
| commit | 67929de108479dbb78496b61af5c24072fc16d8d (patch) | |
| tree | 648c5cd3e8e9c7ef90db58845ee8c4d8b2e8e97d /drivers/base/node.c | |
| parent | mm,memory_hotplug: remove status_change_nid_normal and update documentation (diff) | |
| download | kernel-67929de108479dbb78496b61af5c24072fc16d8d.tar.gz kernel-67929de108479dbb78496b61af5c24072fc16d8d.zip | |
mm,memory_hotplug: implement numa node notifier
There are at least six consumers of hotplug_memory_notifier that what they
really are interested in is whether any numa node changed its state, e.g:
going from having memory to not having memory and vice versa.
Implement a specific notifier for numa nodes when their state gets
changed, which will later be used by those consumers that are only
interested in numa node state changes.
Add documentation as well.
[[email protected]: set failure reason in offline_pages()]
Link: https://lkml.kernel.org/r/[email protected]
Link: https://lkml.kernel.org/r/[email protected]
Signed-off-by: Oscar Salvador <[email protected]>
Signed-off-by: Dan Carpenter <[email protected]>
Reviewed-by: Jonathan Cameron <[email protected]>
Reviewed-by: Harry Yoo <[email protected]>
Reviewed-by: Vlastimil Babka <[email protected]>
Acked-by: David Hildenbrand <[email protected]>
Cc: Hyeonggon Yoo <[email protected]>
Cc: Rakie Kim <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Diffstat (limited to 'drivers/base/node.c')
| -rw-r--r-- | drivers/base/node.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/drivers/base/node.c b/drivers/base/node.c index 6cbeca45c451..6d66382dae65 100644 --- a/drivers/base/node.c +++ b/drivers/base/node.c @@ -112,6 +112,27 @@ static const struct attribute_group *node_access_node_groups[] = { NULL, }; +#ifdef CONFIG_MEMORY_HOTPLUG +static BLOCKING_NOTIFIER_HEAD(node_chain); + +int register_node_notifier(struct notifier_block *nb) +{ + return blocking_notifier_chain_register(&node_chain, nb); +} +EXPORT_SYMBOL(register_node_notifier); + +void unregister_node_notifier(struct notifier_block *nb) +{ + blocking_notifier_chain_unregister(&node_chain, nb); +} +EXPORT_SYMBOL(unregister_node_notifier); + +int node_notify(unsigned long val, void *v) +{ + return blocking_notifier_call_chain(&node_chain, val, v); +} +#endif + static void node_remove_accesses(struct node *node) { struct node_access_nodes *c, *cnext; |
