From 70c26991acfb9ba80fe7106c8041fddc201fd6c3 Mon Sep 17 00:00:00 2001 From: Matthieu Hautreux <matthieu.hautreux@cea.fr> Date: Thu, 13 Oct 2011 17:12:32 +0200 Subject: [PATCH] task/cgroup: correct a regression in cpuset management The addition of the default slurm cg with the cpuset subsystem was incomplete preventing from having a working solution. The contents of cpuset.cpus and cpuset.mems were not replicated from the parent resulting in "No space left on device" errors when trying to add tasks to the step cg. --- src/plugins/task/cgroup/task_cgroup_cpuset.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/plugins/task/cgroup/task_cgroup_cpuset.c b/src/plugins/task/cgroup/task_cgroup_cpuset.c index 3a167399360..78df78aeaf7 100644 --- a/src/plugins/task/cgroup/task_cgroup_cpuset.c +++ b/src/plugins/task/cgroup/task_cgroup_cpuset.c @@ -168,6 +168,7 @@ extern int task_cgroup_cpuset_create(slurmd_job_t *job) size_t cpus_size; char* slurm_cgpath ; + xcgroup_t slurm_cg; /* create slurm root cg in this cg namespace */ slurm_cgpath = task_cgroup_create_slurm_cg(&cpuset_ns); @@ -175,6 +176,25 @@ extern int task_cgroup_cpuset_create(slurmd_job_t *job) return SLURM_ERROR; } + /* check that this cgroup has cpus allowed or initialize them */ + if (xcgroup_load(&cpuset_ns,&slurm_cg,slurm_cgpath) + != XCGROUP_SUCCESS) { + error("task/cgroup: unable to load slurm cpuset xcgroup"); + xfree(slurm_cgpath); + return SLURM_ERROR; + } + rc = xcgroup_get_param(&slurm_cg,"cpuset.cpus",&cpus,&cpus_size); + if (rc != XCGROUP_SUCCESS || cpus_size == 1) { + /* initialize the cpusets as it was inexistant */ + if (_xcgroup_cpuset_init(&slurm_cg) != + XCGROUP_SUCCESS) { + xfree(slurm_cgpath); + xcgroup_destroy(&slurm_cg); + return SLURM_ERROR; + } + } + xfree(cpus); + /* build user cgroup relative path if not set (should not be) */ if (*user_cgroup_path == '\0') { if (snprintf(user_cgroup_path, PATH_MAX, -- GitLab