+
+/*
+ * Handle per node hstate attribute [un]registration on transistions
+ * to/from memoryless state.
+ */
+
+static int node_memory_callback(struct notifier_block *self,
+ unsigned long action, void *arg)
+{
+ struct memory_notify *mnb = arg;
+ int nid = mnb->status_change_nid;
+
+ switch (action) {
+ case MEM_ONLINE: /* memory successfully brought online */
+ if (nid != NUMA_NO_NODE)
+ hugetlb_register_node(&node_devices[nid]);
+ break;
+ case MEM_OFFLINE: /* or offline */
+ if (nid != NUMA_NO_NODE)
+ hugetlb_unregister_node(&node_devices[nid]);
+ break;
+ case MEM_GOING_ONLINE:
+ case MEM_GOING_OFFLINE:
+ case MEM_CANCEL_ONLINE:
+ case MEM_CANCEL_OFFLINE:
+ default:
+ break;
+ }
+
+ return NOTIFY_OK;
+}