[RFC:Patch: 007/008](memory hotplug) callback routine for mempolicy

From: Yasunori Goto
Date: Thu Jul 31 2008 - 08:04:51 EST



This patch is very incomplete (includes dummy code),
but I would like to show what mempolicy has to do when node is removed.

Basically, user should change policy before removing node
which is used mempolicy. However, user may not know
mempolicy is used due to automatic setting by software.
The kernel must guarantee removed node will be not used.

There is callback when memory offlining, mempolicy can change
each task's policies.

There are some issues.
- If nodes_weight(pol->v.nodes) will be 0 due to node removing,
Kernel will not be able to allocate any pages.
What does kernel should do? Kill its process?
- If preffered node is removing, then which node should be next
preffered node?

Signed-off-by: Yasunori Goto <y-goto@xxxxxxxxxxxxxx>

---
mm/mempolicy.c | 32 ++++++++++++++++++++++++++++++++
1 file changed, 32 insertions(+)

Index: current/mm/mempolicy.c
===================================================================
--- current.orig/mm/mempolicy.c 2008-07-29 22:17:25.000000000 +0900
+++ current/mm/mempolicy.c 2008-07-29 22:17:29.000000000 +0900
@@ -2345,3 +2345,35 @@ out:
m->version = (vma != priv->tail_vma) ? vma->vm_start : 0;
return 0;
}
+
+#ifdef CONFIG_MEMORY_HOTPLUG
+static int mempolicy_mem_offline_callback(void *arg)
+{
+ int offline_node;
+ struct memory_notify *marg = arg;
+
+ offline_node = marg->status_change_nid;
+
+ /*
+ * If the node still has available memory, we keep policies.
+ */
+ if (offline_node < 0)
+ return 0;
+
+ /*
+ * Disable all offline node's bit for each node mask.
+ */
+ for_each_policy(pol) {
+ switch (pol->mode) {
+ case MPOL_BIND:
+ case MPOL_INTERLEAVE:
+ /* Force disable node bit */
+ node_clear(offline_node, pol->v.nodes);
+ break;
+ case MPOL_PREFFERED:
+ /* TBD */
+ default:
+ break;
+ }
+}
+#endif

--
Yasunori Goto


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/