cpumask: documentation for cpumask_var_t
[pandora-kernel.git] / kernel / cpuset.c
index 81fc679..39c1a4c 100644 (file)
@@ -36,6 +36,7 @@
 #include <linux/list.h>
 #include <linux/mempolicy.h>
 #include <linux/mm.h>
+#include <linux/memory.h>
 #include <linux/module.h>
 #include <linux/mount.h>
 #include <linux/namei.h>
@@ -584,7 +585,7 @@ static int generate_sched_domains(cpumask_t **domains,
        int i, j, k;            /* indices for partition finding loops */
        cpumask_t *doms;        /* resulting partition; i.e. sched domains */
        struct sched_domain_attr *dattr;  /* attributes for custom domains */
-       int ndoms;              /* number of sched domains in result */
+       int ndoms = 0;          /* number of sched domains in result */
        int nslot;              /* next empty doms[] cpumask_t slot */
 
        doms = NULL;
@@ -895,7 +896,7 @@ static int update_cpumask(struct cpuset *cs, const char *buf)
        if (!*buf) {
                cpus_clear(trialcs.cpus_allowed);
        } else {
-               retval = cpulist_parse(buf, trialcs.cpus_allowed);
+               retval = cpulist_parse(buf, &trialcs.cpus_allowed);
                if (retval < 0)
                        return retval;
 
@@ -1481,7 +1482,7 @@ static int cpuset_sprintf_cpulist(char *page, struct cpuset *cs)
        mask = cs->cpus_allowed;
        mutex_unlock(&callback_mutex);
 
-       return cpulist_scnprintf(page, PAGE_SIZE, mask);
+       return cpulist_scnprintf(page, PAGE_SIZE, &mask);
 }
 
 static int cpuset_sprintf_memlist(char *page, struct cpuset *cs)
@@ -2015,12 +2016,23 @@ static int cpuset_track_online_cpus(struct notifier_block *unused_nb,
  * Call this routine anytime after node_states[N_HIGH_MEMORY] changes.
  * See also the previous routine cpuset_track_online_cpus().
  */
-void cpuset_track_online_nodes(void)
+static int cpuset_track_online_nodes(struct notifier_block *self,
+                               unsigned long action, void *arg)
 {
        cgroup_lock();
-       top_cpuset.mems_allowed = node_states[N_HIGH_MEMORY];
-       scan_for_empty_cpusets(&top_cpuset);
+       switch (action) {
+       case MEM_ONLINE:
+               top_cpuset.mems_allowed = node_states[N_HIGH_MEMORY];
+               break;
+       case MEM_OFFLINE:
+               top_cpuset.mems_allowed = node_states[N_HIGH_MEMORY];
+               scan_for_empty_cpusets(&top_cpuset);
+               break;
+       default:
+               break;
+       }
        cgroup_unlock();
+       return NOTIFY_OK;
 }
 #endif
 
@@ -2036,6 +2048,7 @@ void __init cpuset_init_smp(void)
        top_cpuset.mems_allowed = node_states[N_HIGH_MEMORY];
 
        hotcpu_notifier(cpuset_track_online_cpus, 0);
+       hotplug_memory_notifier(cpuset_track_online_nodes, 10);
 }
 
 /**