diff options
author | Tejun Heo <tj@kernel.org> | 2013-01-07 11:51:07 -0500 |
---|---|---|
committer | Tejun Heo <tj@kernel.org> | 2013-01-07 11:51:07 -0500 |
commit | efeb77b2f13deb0503e65ad2b243495b6de75173 (patch) | |
tree | 2b0db442e04561e7993301247ae8d8a10855a721 /kernel | |
parent | c8f699bb56aeae951e02fe2a46c9ada022535770 (diff) |
cpuset: introduce CS_ONLINE
Add CS_ONLINE which is set from css_online() and cleared from
css_offline(). This will enable using generic cgroup iterator while
allowing decoupling cpuset from cgroup internal locking.
Signed-off-by: Tejun Heo <tj@kernel.org>
Acked-by: Li Zefan <lizefan@huawei.com>
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/cpuset.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/kernel/cpuset.c b/kernel/cpuset.c index 1d7a611ff771..e857887bd246 100644 --- a/kernel/cpuset.c +++ b/kernel/cpuset.c | |||
@@ -138,6 +138,7 @@ static inline bool task_has_mempolicy(struct task_struct *task) | |||
138 | 138 | ||
139 | /* bits in struct cpuset flags field */ | 139 | /* bits in struct cpuset flags field */ |
140 | typedef enum { | 140 | typedef enum { |
141 | CS_ONLINE, | ||
141 | CS_CPU_EXCLUSIVE, | 142 | CS_CPU_EXCLUSIVE, |
142 | CS_MEM_EXCLUSIVE, | 143 | CS_MEM_EXCLUSIVE, |
143 | CS_MEM_HARDWALL, | 144 | CS_MEM_HARDWALL, |
@@ -154,6 +155,11 @@ enum hotplug_event { | |||
154 | }; | 155 | }; |
155 | 156 | ||
156 | /* convenient tests for these bits */ | 157 | /* convenient tests for these bits */ |
158 | static inline bool is_cpuset_online(const struct cpuset *cs) | ||
159 | { | ||
160 | return test_bit(CS_ONLINE, &cs->flags); | ||
161 | } | ||
162 | |||
157 | static inline int is_cpu_exclusive(const struct cpuset *cs) | 163 | static inline int is_cpu_exclusive(const struct cpuset *cs) |
158 | { | 164 | { |
159 | return test_bit(CS_CPU_EXCLUSIVE, &cs->flags); | 165 | return test_bit(CS_CPU_EXCLUSIVE, &cs->flags); |
@@ -190,7 +196,8 @@ static inline int is_spread_slab(const struct cpuset *cs) | |||
190 | } | 196 | } |
191 | 197 | ||
192 | static struct cpuset top_cpuset = { | 198 | static struct cpuset top_cpuset = { |
193 | .flags = ((1 << CS_CPU_EXCLUSIVE) | (1 << CS_MEM_EXCLUSIVE)), | 199 | .flags = ((1 << CS_ONLINE) | (1 << CS_CPU_EXCLUSIVE) | |
200 | (1 << CS_MEM_EXCLUSIVE)), | ||
194 | }; | 201 | }; |
195 | 202 | ||
196 | /* | 203 | /* |
@@ -1822,6 +1829,7 @@ static int cpuset_css_online(struct cgroup *cgrp) | |||
1822 | if (!parent) | 1829 | if (!parent) |
1823 | return 0; | 1830 | return 0; |
1824 | 1831 | ||
1832 | set_bit(CS_ONLINE, &cs->flags); | ||
1825 | if (is_spread_page(parent)) | 1833 | if (is_spread_page(parent)) |
1826 | set_bit(CS_SPREAD_PAGE, &cs->flags); | 1834 | set_bit(CS_SPREAD_PAGE, &cs->flags); |
1827 | if (is_spread_slab(parent)) | 1835 | if (is_spread_slab(parent)) |
@@ -1871,6 +1879,7 @@ static void cpuset_css_offline(struct cgroup *cgrp) | |||
1871 | update_flag(CS_SCHED_LOAD_BALANCE, cs, 0); | 1879 | update_flag(CS_SCHED_LOAD_BALANCE, cs, 0); |
1872 | 1880 | ||
1873 | number_of_cpusets--; | 1881 | number_of_cpusets--; |
1882 | clear_bit(CS_ONLINE, &cs->flags); | ||
1874 | 1883 | ||
1875 | cgroup_unlock(); | 1884 | cgroup_unlock(); |
1876 | } | 1885 | } |