summaryrefslogtreecommitdiffstats
path: root/kernel/cgroup/cpuset.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/cgroup/cpuset.c')
-rw-r--r--kernel/cgroup/cpuset.c61
1 files changed, 1 insertions, 60 deletions
diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c
index 863e434a6020..5aa37531ce76 100644
--- a/kernel/cgroup/cpuset.c
+++ b/kernel/cgroup/cpuset.c
@@ -356,59 +356,6 @@ static inline bool is_in_v2_mode(void)
356} 356}
357 357
358/* 358/*
359 * This is ugly, but preserves the userspace API for existing cpuset
360 * users. If someone tries to mount the "cpuset" filesystem, we
361 * silently switch it to mount "cgroup" instead
362 */
363static int cpuset_get_tree(struct fs_context *fc)
364{
365 struct file_system_type *cgroup_fs;
366 struct fs_context *new_fc;
367 int ret;
368
369 cgroup_fs = get_fs_type("cgroup");
370 if (!cgroup_fs)
371 return -ENODEV;
372
373 new_fc = fs_context_for_mount(cgroup_fs, fc->sb_flags);
374 if (IS_ERR(new_fc)) {
375 ret = PTR_ERR(new_fc);
376 } else {
377 static const char agent_path[] = "/sbin/cpuset_release_agent";
378 ret = vfs_parse_fs_string(new_fc, "cpuset", NULL, 0);
379 if (!ret)
380 ret = vfs_parse_fs_string(new_fc, "noprefix", NULL, 0);
381 if (!ret)
382 ret = vfs_parse_fs_string(new_fc, "release_agent",
383 agent_path, sizeof(agent_path) - 1);
384 if (!ret)
385 ret = vfs_get_tree(new_fc);
386 if (!ret) { /* steal the result */
387 fc->root = new_fc->root;
388 new_fc->root = NULL;
389 }
390 put_fs_context(new_fc);
391 }
392 put_filesystem(cgroup_fs);
393 return ret;
394}
395
396static const struct fs_context_operations cpuset_fs_context_ops = {
397 .get_tree = cpuset_get_tree,
398};
399
400static int cpuset_init_fs_context(struct fs_context *fc)
401{
402 fc->ops = &cpuset_fs_context_ops;
403 return 0;
404}
405
406static struct file_system_type cpuset_fs_type = {
407 .name = "cpuset",
408 .init_fs_context = cpuset_init_fs_context,
409};
410
411/*
412 * Return in pmask the portion of a cpusets's cpus_allowed that 359 * Return in pmask the portion of a cpusets's cpus_allowed that
413 * are online. If none are online, walk up the cpuset hierarchy 360 * are online. If none are online, walk up the cpuset hierarchy
414 * until we find one that does have some online cpus. 361 * until we find one that does have some online cpus.
@@ -2853,13 +2800,11 @@ struct cgroup_subsys cpuset_cgrp_subsys = {
2853/** 2800/**
2854 * cpuset_init - initialize cpusets at system boot 2801 * cpuset_init - initialize cpusets at system boot
2855 * 2802 *
2856 * Description: Initialize top_cpuset and the cpuset internal file system, 2803 * Description: Initialize top_cpuset
2857 **/ 2804 **/
2858 2805
2859int __init cpuset_init(void) 2806int __init cpuset_init(void)
2860{ 2807{
2861 int err = 0;
2862
2863 BUG_ON(!alloc_cpumask_var(&top_cpuset.cpus_allowed, GFP_KERNEL)); 2808 BUG_ON(!alloc_cpumask_var(&top_cpuset.cpus_allowed, GFP_KERNEL));
2864 BUG_ON(!alloc_cpumask_var(&top_cpuset.effective_cpus, GFP_KERNEL)); 2809 BUG_ON(!alloc_cpumask_var(&top_cpuset.effective_cpus, GFP_KERNEL));
2865 BUG_ON(!zalloc_cpumask_var(&top_cpuset.subparts_cpus, GFP_KERNEL)); 2810 BUG_ON(!zalloc_cpumask_var(&top_cpuset.subparts_cpus, GFP_KERNEL));
@@ -2873,10 +2818,6 @@ int __init cpuset_init(void)
2873 set_bit(CS_SCHED_LOAD_BALANCE, &top_cpuset.flags); 2818 set_bit(CS_SCHED_LOAD_BALANCE, &top_cpuset.flags);
2874 top_cpuset.relax_domain_level = -1; 2819 top_cpuset.relax_domain_level = -1;
2875 2820
2876 err = register_filesystem(&cpuset_fs_type);
2877 if (err < 0)
2878 return err;
2879
2880 BUG_ON(!alloc_cpumask_var(&cpus_attach, GFP_KERNEL)); 2821 BUG_ON(!alloc_cpumask_var(&cpus_attach, GFP_KERNEL));
2881 2822
2882 return 0; 2823 return 0;