aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/cpuset.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2014-06-09 18:03:33 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2014-06-09 18:03:33 -0400
commit14208b0ec56919f5333dd654b1a7d10765d0ad05 (patch)
tree474b46c351efced45925d15dc2e0049c49784716 /kernel/cpuset.c
parent6ea4fa70e4af0da8b133b246458fb789d8cb3985 (diff)
parentc731ae1d0f02a300697a8b1564780ad28a6c2013 (diff)
Merge branch 'for-3.16' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup
Pull cgroup updates from Tejun Heo: "A lot of activities on cgroup side. Heavy restructuring including locking simplification took place to improve the code base and enable implementation of the unified hierarchy, which currently exists behind a __DEVEL__ mount option. The core support is mostly complete but individual controllers need further work. To explain the design and rationales of the the unified hierarchy Documentation/cgroups/unified-hierarchy.txt is added. Another notable change is css (cgroup_subsys_state - what each controller uses to identify and interact with a cgroup) iteration update. This is part of continuing updates on css object lifetime and visibility. cgroup started with reference count draining on removal way back and is now reaching a point where csses behave and are iterated like normal refcnted objects albeit with some complexities to allow distinguishing the state where they're being deleted. The css iteration update isn't taken advantage of yet but is planned to be used to simplify memcg significantly" * 'for-3.16' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup: (77 commits) cgroup: disallow disabled controllers on the default hierarchy cgroup: don't destroy the default root cgroup: disallow debug controller on the default hierarchy cgroup: clean up MAINTAINERS entries cgroup: implement css_tryget() device_cgroup: use css_has_online_children() instead of has_children() cgroup: convert cgroup_has_live_children() into css_has_online_children() cgroup: use CSS_ONLINE instead of CGRP_DEAD cgroup: iterate cgroup_subsys_states directly cgroup: introduce CSS_RELEASED and reduce css iteration fallback window cgroup: move cgroup->serial_nr into cgroup_subsys_state cgroup: link all cgroup_subsys_states in their sibling lists cgroup: move cgroup->sibling and ->children into cgroup_subsys_state cgroup: remove cgroup->parent device_cgroup: remove direct access to cgroup->children memcg: update memcg_has_children() to use css_next_child() memcg: remove tasks/children test from mem_cgroup_force_empty() cgroup: remove css_parent() cgroup: skip refcnting on normal root csses and cgrp_dfl_root self css cgroup: use cgroup->self.refcnt for cgroup refcnting ...
Diffstat (limited to 'kernel/cpuset.c')
-rw-r--r--kernel/cpuset.c46
1 files changed, 23 insertions, 23 deletions
diff --git a/kernel/cpuset.c b/kernel/cpuset.c
index 130017843899..f6b33c696224 100644
--- a/kernel/cpuset.c
+++ b/kernel/cpuset.c
@@ -119,7 +119,7 @@ static inline struct cpuset *task_cs(struct task_struct *task)
119 119
120static inline struct cpuset *parent_cs(struct cpuset *cs) 120static inline struct cpuset *parent_cs(struct cpuset *cs)
121{ 121{
122 return css_cs(css_parent(&cs->css)); 122 return css_cs(cs->css.parent);
123} 123}
124 124
125#ifdef CONFIG_NUMA 125#ifdef CONFIG_NUMA
@@ -691,11 +691,8 @@ restart:
691 if (nslot == ndoms) { 691 if (nslot == ndoms) {
692 static int warnings = 10; 692 static int warnings = 10;
693 if (warnings) { 693 if (warnings) {
694 printk(KERN_WARNING 694 pr_warn("rebuild_sched_domains confused: nslot %d, ndoms %d, csn %d, i %d, apn %d\n",
695 "rebuild_sched_domains confused:" 695 nslot, ndoms, csn, i, apn);
696 " nslot %d, ndoms %d, csn %d, i %d,"
697 " apn %d\n",
698 nslot, ndoms, csn, i, apn);
699 warnings--; 696 warnings--;
700 } 697 }
701 continue; 698 continue;
@@ -870,7 +867,7 @@ static void update_tasks_cpumask_hier(struct cpuset *root_cs, bool update_root)
870 continue; 867 continue;
871 } 868 }
872 } 869 }
873 if (!css_tryget(&cp->css)) 870 if (!css_tryget_online(&cp->css))
874 continue; 871 continue;
875 rcu_read_unlock(); 872 rcu_read_unlock();
876 873
@@ -885,6 +882,7 @@ static void update_tasks_cpumask_hier(struct cpuset *root_cs, bool update_root)
885/** 882/**
886 * update_cpumask - update the cpus_allowed mask of a cpuset and all tasks in it 883 * update_cpumask - update the cpus_allowed mask of a cpuset and all tasks in it
887 * @cs: the cpuset to consider 884 * @cs: the cpuset to consider
885 * @trialcs: trial cpuset
888 * @buf: buffer of cpu numbers written to this cpuset 886 * @buf: buffer of cpu numbers written to this cpuset
889 */ 887 */
890static int update_cpumask(struct cpuset *cs, struct cpuset *trialcs, 888static 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)
1105 continue; 1103 continue;
1106 } 1104 }
1107 } 1105 }
1108 if (!css_tryget(&cp->css)) 1106 if (!css_tryget_online(&cp->css))
1109 continue; 1107 continue;
1110 rcu_read_unlock(); 1108 rcu_read_unlock();
1111 1109
@@ -1600,13 +1598,15 @@ out_unlock:
1600/* 1598/*
1601 * Common handling for a write to a "cpus" or "mems" file. 1599 * Common handling for a write to a "cpus" or "mems" file.
1602 */ 1600 */
1603static int cpuset_write_resmask(struct cgroup_subsys_state *css, 1601static ssize_t cpuset_write_resmask(struct kernfs_open_file *of,
1604 struct cftype *cft, char *buf) 1602 char *buf, size_t nbytes, loff_t off)
1605{ 1603{
1606 struct cpuset *cs = css_cs(css); 1604 struct cpuset *cs = css_cs(of_css(of));
1607 struct cpuset *trialcs; 1605 struct cpuset *trialcs;
1608 int retval = -ENODEV; 1606 int retval = -ENODEV;
1609 1607
1608 buf = strstrip(buf);
1609
1610 /* 1610 /*
1611 * CPU or memory hotunplug may leave @cs w/o any execution 1611 * CPU or memory hotunplug may leave @cs w/o any execution
1612 * resources, in which case the hotplug code asynchronously updates 1612 * resources, in which case the hotplug code asynchronously updates
@@ -1630,7 +1630,7 @@ static int cpuset_write_resmask(struct cgroup_subsys_state *css,
1630 goto out_unlock; 1630 goto out_unlock;
1631 } 1631 }
1632 1632
1633 switch (cft->private) { 1633 switch (of_cft(of)->private) {
1634 case FILE_CPULIST: 1634 case FILE_CPULIST:
1635 retval = update_cpumask(cs, trialcs, buf); 1635 retval = update_cpumask(cs, trialcs, buf);
1636 break; 1636 break;
@@ -1645,7 +1645,7 @@ static int cpuset_write_resmask(struct cgroup_subsys_state *css,
1645 free_trial_cpuset(trialcs); 1645 free_trial_cpuset(trialcs);
1646out_unlock: 1646out_unlock:
1647 mutex_unlock(&cpuset_mutex); 1647 mutex_unlock(&cpuset_mutex);
1648 return retval; 1648 return retval ?: nbytes;
1649} 1649}
1650 1650
1651/* 1651/*
@@ -1747,7 +1747,7 @@ static struct cftype files[] = {
1747 { 1747 {
1748 .name = "cpus", 1748 .name = "cpus",
1749 .seq_show = cpuset_common_seq_show, 1749 .seq_show = cpuset_common_seq_show,
1750 .write_string = cpuset_write_resmask, 1750 .write = cpuset_write_resmask,
1751 .max_write_len = (100U + 6 * NR_CPUS), 1751 .max_write_len = (100U + 6 * NR_CPUS),
1752 .private = FILE_CPULIST, 1752 .private = FILE_CPULIST,
1753 }, 1753 },
@@ -1755,7 +1755,7 @@ static struct cftype files[] = {
1755 { 1755 {
1756 .name = "mems", 1756 .name = "mems",
1757 .seq_show = cpuset_common_seq_show, 1757 .seq_show = cpuset_common_seq_show,
1758 .write_string = cpuset_write_resmask, 1758 .write = cpuset_write_resmask,
1759 .max_write_len = (100U + 6 * MAX_NUMNODES), 1759 .max_write_len = (100U + 6 * MAX_NUMNODES),
1760 .private = FILE_MEMLIST, 1760 .private = FILE_MEMLIST,
1761 }, 1761 },
@@ -2011,7 +2011,7 @@ static void remove_tasks_in_empty_cpuset(struct cpuset *cs)
2011 parent = parent_cs(parent); 2011 parent = parent_cs(parent);
2012 2012
2013 if (cgroup_transfer_tasks(parent->css.cgroup, cs->css.cgroup)) { 2013 if (cgroup_transfer_tasks(parent->css.cgroup, cs->css.cgroup)) {
2014 printk(KERN_ERR "cpuset: failed to transfer tasks out of empty cpuset "); 2014 pr_err("cpuset: failed to transfer tasks out of empty cpuset ");
2015 pr_cont_cgroup_name(cs->css.cgroup); 2015 pr_cont_cgroup_name(cs->css.cgroup);
2016 pr_cont("\n"); 2016 pr_cont("\n");
2017 } 2017 }
@@ -2149,7 +2149,7 @@ static void cpuset_hotplug_workfn(struct work_struct *work)
2149 2149
2150 rcu_read_lock(); 2150 rcu_read_lock();
2151 cpuset_for_each_descendant_pre(cs, pos_css, &top_cpuset) { 2151 cpuset_for_each_descendant_pre(cs, pos_css, &top_cpuset) {
2152 if (cs == &top_cpuset || !css_tryget(&cs->css)) 2152 if (cs == &top_cpuset || !css_tryget_online(&cs->css))
2153 continue; 2153 continue;
2154 rcu_read_unlock(); 2154 rcu_read_unlock();
2155 2155
@@ -2530,7 +2530,7 @@ int cpuset_mems_allowed_intersects(const struct task_struct *tsk1,
2530 2530
2531/** 2531/**
2532 * cpuset_print_task_mems_allowed - prints task's cpuset and mems_allowed 2532 * cpuset_print_task_mems_allowed - prints task's cpuset and mems_allowed
2533 * @task: pointer to task_struct of some task. 2533 * @tsk: pointer to task_struct of some task.
2534 * 2534 *
2535 * Description: Prints @task's name, cpuset name, and cached copy of its 2535 * Description: Prints @task's name, cpuset name, and cached copy of its
2536 * mems_allowed to the kernel log. 2536 * mems_allowed to the kernel log.
@@ -2548,7 +2548,7 @@ void cpuset_print_task_mems_allowed(struct task_struct *tsk)
2548 cgrp = task_cs(tsk)->css.cgroup; 2548 cgrp = task_cs(tsk)->css.cgroup;
2549 nodelist_scnprintf(cpuset_nodelist, CPUSET_NODELIST_LEN, 2549 nodelist_scnprintf(cpuset_nodelist, CPUSET_NODELIST_LEN,
2550 tsk->mems_allowed); 2550 tsk->mems_allowed);
2551 printk(KERN_INFO "%s cpuset=", tsk->comm); 2551 pr_info("%s cpuset=", tsk->comm);
2552 pr_cont_cgroup_name(cgrp); 2552 pr_cont_cgroup_name(cgrp);
2553 pr_cont(" mems_allowed=%s\n", cpuset_nodelist); 2553 pr_cont(" mems_allowed=%s\n", cpuset_nodelist);
2554 2554
@@ -2640,10 +2640,10 @@ out:
2640/* Display task mems_allowed in /proc/<pid>/status file. */ 2640/* Display task mems_allowed in /proc/<pid>/status file. */
2641void cpuset_task_status_allowed(struct seq_file *m, struct task_struct *task) 2641void cpuset_task_status_allowed(struct seq_file *m, struct task_struct *task)
2642{ 2642{
2643 seq_printf(m, "Mems_allowed:\t"); 2643 seq_puts(m, "Mems_allowed:\t");
2644 seq_nodemask(m, &task->mems_allowed); 2644 seq_nodemask(m, &task->mems_allowed);
2645 seq_printf(m, "\n"); 2645 seq_puts(m, "\n");
2646 seq_printf(m, "Mems_allowed_list:\t"); 2646 seq_puts(m, "Mems_allowed_list:\t");
2647 seq_nodemask_list(m, &task->mems_allowed); 2647 seq_nodemask_list(m, &task->mems_allowed);
2648 seq_printf(m, "\n"); 2648 seq_puts(m, "\n");
2649} 2649}