Merge branch 'for-3.16' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup
[pandora-kernel.git] / kernel / cpuset.c
index 1300178..f6b33c6 100644 (file)
@@ -119,7 +119,7 @@ static inline struct cpuset *task_cs(struct task_struct *task)
 
 static inline struct cpuset *parent_cs(struct cpuset *cs)
 {
-       return css_cs(css_parent(&cs->css));
+       return css_cs(cs->css.parent);
 }
 
 #ifdef CONFIG_NUMA
@@ -691,11 +691,8 @@ restart:
                if (nslot == ndoms) {
                        static int warnings = 10;
                        if (warnings) {
-                               printk(KERN_WARNING
-                                "rebuild_sched_domains confused:"
-                                 " nslot %d, ndoms %d, csn %d, i %d,"
-                                 " apn %d\n",
-                                 nslot, ndoms, csn, i, apn);
+                               pr_warn("rebuild_sched_domains confused: nslot %d, ndoms %d, csn %d, i %d, apn %d\n",
+                                       nslot, ndoms, csn, i, apn);
                                warnings--;
                        }
                        continue;
@@ -870,7 +867,7 @@ static void update_tasks_cpumask_hier(struct cpuset *root_cs, bool update_root)
                                continue;
                        }
                }
-               if (!css_tryget(&cp->css))
+               if (!css_tryget_online(&cp->css))
                        continue;
                rcu_read_unlock();
 
@@ -885,6 +882,7 @@ static void update_tasks_cpumask_hier(struct cpuset *root_cs, bool update_root)
 /**
  * update_cpumask - update the cpus_allowed mask of a cpuset and all tasks in it
  * @cs: the cpuset to consider
+ * @trialcs: trial cpuset
  * @buf: buffer of cpu numbers written to this cpuset
  */
 static int update_cpumask(struct cpuset *cs, struct cpuset *trialcs,
@@ -1105,7 +1103,7 @@ static void update_tasks_nodemask_hier(struct cpuset *root_cs, bool update_root)
                                continue;
                        }
                }
-               if (!css_tryget(&cp->css))
+               if (!css_tryget_online(&cp->css))
                        continue;
                rcu_read_unlock();
 
@@ -1600,13 +1598,15 @@ out_unlock:
 /*
  * Common handling for a write to a "cpus" or "mems" file.
  */
-static int cpuset_write_resmask(struct cgroup_subsys_state *css,
-                               struct cftype *cft, char *buf)
+static ssize_t cpuset_write_resmask(struct kernfs_open_file *of,
+                                   char *buf, size_t nbytes, loff_t off)
 {
-       struct cpuset *cs = css_cs(css);
+       struct cpuset *cs = css_cs(of_css(of));
        struct cpuset *trialcs;
        int retval = -ENODEV;
 
+       buf = strstrip(buf);
+
        /*
         * CPU or memory hotunplug may leave @cs w/o any execution
         * resources, in which case the hotplug code asynchronously updates
@@ -1630,7 +1630,7 @@ static int cpuset_write_resmask(struct cgroup_subsys_state *css,
                goto out_unlock;
        }
 
-       switch (cft->private) {
+       switch (of_cft(of)->private) {
        case FILE_CPULIST:
                retval = update_cpumask(cs, trialcs, buf);
                break;
@@ -1645,7 +1645,7 @@ static int cpuset_write_resmask(struct cgroup_subsys_state *css,
        free_trial_cpuset(trialcs);
 out_unlock:
        mutex_unlock(&cpuset_mutex);
-       return retval;
+       return retval ?: nbytes;
 }
 
 /*
@@ -1747,7 +1747,7 @@ static struct cftype files[] = {
        {
                .name = "cpus",
                .seq_show = cpuset_common_seq_show,
-               .write_string = cpuset_write_resmask,
+               .write = cpuset_write_resmask,
                .max_write_len = (100U + 6 * NR_CPUS),
                .private = FILE_CPULIST,
        },
@@ -1755,7 +1755,7 @@ static struct cftype files[] = {
        {
                .name = "mems",
                .seq_show = cpuset_common_seq_show,
-               .write_string = cpuset_write_resmask,
+               .write = cpuset_write_resmask,
                .max_write_len = (100U + 6 * MAX_NUMNODES),
                .private = FILE_MEMLIST,
        },
@@ -2011,7 +2011,7 @@ static void remove_tasks_in_empty_cpuset(struct cpuset *cs)
                parent = parent_cs(parent);
 
        if (cgroup_transfer_tasks(parent->css.cgroup, cs->css.cgroup)) {
-               printk(KERN_ERR "cpuset: failed to transfer tasks out of empty cpuset ");
+               pr_err("cpuset: failed to transfer tasks out of empty cpuset ");
                pr_cont_cgroup_name(cs->css.cgroup);
                pr_cont("\n");
        }
@@ -2149,7 +2149,7 @@ static void cpuset_hotplug_workfn(struct work_struct *work)
 
                rcu_read_lock();
                cpuset_for_each_descendant_pre(cs, pos_css, &top_cpuset) {
-                       if (cs == &top_cpuset || !css_tryget(&cs->css))
+                       if (cs == &top_cpuset || !css_tryget_online(&cs->css))
                                continue;
                        rcu_read_unlock();
 
@@ -2530,7 +2530,7 @@ int cpuset_mems_allowed_intersects(const struct task_struct *tsk1,
 
 /**
  * cpuset_print_task_mems_allowed - prints task's cpuset and mems_allowed
- * @task: pointer to task_struct of some task.
+ * @tsk: pointer to task_struct of some task.
  *
  * Description: Prints @task's name, cpuset name, and cached copy of its
  * mems_allowed to the kernel log.
@@ -2548,7 +2548,7 @@ void cpuset_print_task_mems_allowed(struct task_struct *tsk)
        cgrp = task_cs(tsk)->css.cgroup;
        nodelist_scnprintf(cpuset_nodelist, CPUSET_NODELIST_LEN,
                           tsk->mems_allowed);
-       printk(KERN_INFO "%s cpuset=", tsk->comm);
+       pr_info("%s cpuset=", tsk->comm);
        pr_cont_cgroup_name(cgrp);
        pr_cont(" mems_allowed=%s\n", cpuset_nodelist);
 
@@ -2640,10 +2640,10 @@ out:
 /* Display task mems_allowed in /proc/<pid>/status file. */
 void cpuset_task_status_allowed(struct seq_file *m, struct task_struct *task)
 {
-       seq_printf(m, "Mems_allowed:\t");
+       seq_puts(m, "Mems_allowed:\t");
        seq_nodemask(m, &task->mems_allowed);
-       seq_printf(m, "\n");
-       seq_printf(m, "Mems_allowed_list:\t");
+       seq_puts(m, "\n");
+       seq_puts(m, "Mems_allowed_list:\t");
        seq_nodemask_list(m, &task->mems_allowed);
-       seq_printf(m, "\n");
+       seq_puts(m, "\n");
 }