diff --git a/etc/Makefile.am b/etc/Makefile.am index aa5e898fc4c3292d0985ca6eba4b3f8ed07629c1..1009713b4e62312826daba857bc9b0471aa0325b 100644 --- a/etc/Makefile.am +++ b/etc/Makefile.am @@ -1,4 +1,4 @@ -ETC_FILES = cgroup.release_common.example init.d.slurmdbd init.d.slurm \ +ETC_FILES = init.d.slurmdbd init.d.slurm \ slurmctld.service slurmdbd.service slurmd.service CLEANFILES = $(ETC_FILES) @@ -12,9 +12,6 @@ edit = sed \ noinst_DATA = $(ETC_FILES) -cgroup.release_common.example: Makefile $(srcdir)/cgroup.release_common.example.in - $(edit) $(srcdir)/cgroup.release_common.example.in > cgroup.release_common.example - init.d.slurmdbd: Makefile $(srcdir)/init.d.slurmdbd.in $(edit) $(srcdir)/init.d.slurmdbd.in > init.d.slurmdbd diff --git a/etc/Makefile.in b/etc/Makefile.in index 2a7b37bf7af4e94b23837323112beb32bbd57652..6d10aa52a6506ed4014b1985e379520058447161 100644 --- a/etc/Makefile.in +++ b/etc/Makefile.in @@ -416,7 +416,7 @@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ -ETC_FILES = cgroup.release_common.example init.d.slurmdbd init.d.slurm \ +ETC_FILES = init.d.slurmdbd init.d.slurm \ slurmctld.service slurmdbd.service slurmd.service CLEANFILES = $(ETC_FILES) @@ -621,9 +621,6 @@ uninstall-am: .PRECIOUS: Makefile -cgroup.release_common.example: Makefile $(srcdir)/cgroup.release_common.example.in - $(edit) $(srcdir)/cgroup.release_common.example.in > cgroup.release_common.example - init.d.slurmdbd: Makefile $(srcdir)/init.d.slurmdbd.in $(edit) $(srcdir)/init.d.slurmdbd.in > init.d.slurmdbd diff --git a/etc/cgroup.release_common.example.in b/etc/cgroup.release_common.example.in deleted file mode 100644 index 0e107ab0734534c116eb23b5fe00873735904feb..0000000000000000000000000000000000000000 --- a/etc/cgroup.release_common.example.in +++ /dev/null @@ -1,152 +0,0 @@ -#!/bin/bash -# -# Generic release agent for SLURM cgroup usage -# -# Manage cgroup hierarchy like : -# -# /cgroup/subsystem/uid_%/job_%/step_%/task_% -# -# Automatically sync uid_% cgroups to be coherent -# with remaining job childs when one of them is removed -# by a call to this release agent. -# The synchronisation is made in a flock on the root cgroup -# to ensure coherency of the cgroups contents. -# - -progname=$(basename $0) -subsystem=${progname##*_} - -get_mount_dir() -{ - local lssubsys=$(type -p lssubsys) - if [[ $lssubsys ]]; then - $lssubsys -m $subsystem | awk '{print $2}' - elif X=$(grep -si -m1 "^CgroupMountpoint=" @sysconfdir@/cgroup.conf); then - echo $X | sed "s/.*=\(.*\)/\1\/${subsystem}/" - else - echo "/sys/fs/cgroup/$subsystem" - fi -} - -mountdir=$(get_mount_dir) - -if [[ $# -eq 0 ]] -then - echo "Usage: $(basename $0) [sync] cgroup" - exit 1 -fi - -# build orphan cg path -if [[ $# -eq 1 ]] -then - rmcg=${mountdir}$1 -else - rmcg=${mountdir}$2 -fi -slurmcg=${rmcg%/uid_*} -if [[ ${slurmcg} == ${rmcg} ]] -then - # not a slurm job pattern, perhaps the slurmcg, just remove - # the dir with a lock and exit - flock -x ${mountdir} -c "rmdir ${rmcg}" - exit $? -fi -orphancg=${slurmcg}/orphan - -# make sure orphan cgroup is existing -if [[ ! -d ${orphancg} ]] -then - mkdir ${orphancg} - case ${subsystem} in - cpuset) - cat ${mountdir}/cpuset.cpus > ${orphancg}/cpuset.cpus - cat ${mountdir}/cpuset.mems > ${orphancg}/cpuset.mems - ;; - *) - ;; - esac -fi - -# try to extract the uid cgroup from the input one -# ( extract /uid_% from /uid%/job_*...) -uidcg=${rmcg%/job_*} - -# kernel call -if [[ $# -eq 1 ]] -then - - if [[ ${uidcg} == ${rmcg} ]] - then - # not a slurm job pattern, perhaps the uidcg, just remove - # the dir with a lock and exit - flock -x ${mountdir} -c "rmdir ${rmcg}" - exit $? - fi - - if [[ -d ${mountdir} ]] - then - flock -x ${mountdir} -c "$0 sync $@" - fi - - exit $? - -# sync subcall (called using flock by the kernel hook to be sure -# that no one is manipulating the hierarchy, i.e. PAM, SLURM, ...) -elif [[ $# -eq 2 ]] && [[ $1 == "sync" ]] -then - - # remove this cgroup - if [[ -d ${rmcg} ]] - then - case ${subsystem} in - memory) - # help to correctly remove lazy cleaning memcg - # but still not perfect - sleep 1 - ;; - *) - ;; - esac - rmdir ${rmcg} - fi - if [[ ${uidcg} == ${rmcg} ]] - then - ## not a slurm job pattern exit now do not sync - exit 0 - fi - - # sync the user cgroup based on targeted subsystem - # and the remaining job - if [[ -d ${uidcg} ]] - then - case ${subsystem} in - cpuset) - cpus=$(cat ${uidcg}/job_*/cpuset.cpus 2>/dev/null) - if [[ -n ${cpus} ]] - then - cpus=$(@bindir@/scontrol show hostnames $(echo ${cpus} | tr ' ' ',')) - cpus=$(echo ${cpus} | tr ' ' ',') - echo ${cpus} > ${uidcg}/cpuset.cpus - else - # first move the remaining processes to - # a cgroup reserved for orphaned processes - for t in $(cat ${uidcg}/tasks) - do - echo $t > ${orphancg}/tasks - done - # then remove the remaining cpus from the cgroup - echo "" > ${uidcg}/cpuset.cpus - fi - ;; - *) - ;; - esac - fi - -# error -else - echo "Usage: $(basename $0) [sync] cgroup" - exit 1 -fi - -exit 0 diff --git a/slurm.spec b/slurm.spec index c59971dd7b725c7560961ac78ea32cdd36b0f1a5..bab383e4f5e2302976f241ef22b74be28694233c 100644 --- a/slurm.spec +++ b/slurm.spec @@ -454,10 +454,6 @@ fi install -D -m644 etc/cgroup.conf.example ${RPM_BUILD_ROOT}%{_sysconfdir}/cgroup.conf.example install -D -m644 etc/cgroup_allowed_devices_file.conf.example ${RPM_BUILD_ROOT}%{_sysconfdir}/cgroup_allowed_devices_file.conf.example -install -D -m755 etc/cgroup.release_common.example ${RPM_BUILD_ROOT}%{_sysconfdir}/cgroup.release_common.example -install -D -m755 etc/cgroup.release_common.example ${RPM_BUILD_ROOT}%{_sysconfdir}/cgroup/release_freezer -install -D -m755 etc/cgroup.release_common.example ${RPM_BUILD_ROOT}%{_sysconfdir}/cgroup/release_cpuset -install -D -m755 etc/cgroup.release_common.example ${RPM_BUILD_ROOT}%{_sysconfdir}/cgroup/release_memory install -D -m644 etc/layouts.d.power.conf.example ${RPM_BUILD_ROOT}%{_sysconfdir}/layouts.d/power.conf.example install -D -m644 etc/layouts.d.power_cpufreq.conf.example ${RPM_BUILD_ROOT}%{_sysconfdir}/layouts.d/power_cpufreq.conf.example install -D -m644 etc/layouts.d.unit.conf.example ${RPM_BUILD_ROOT}%{_sysconfdir}/layouts.d/unit.conf.example @@ -766,10 +762,6 @@ rm -rf $RPM_BUILD_ROOT %endif %config %{_sysconfdir}/cgroup.conf.example %config %{_sysconfdir}/cgroup_allowed_devices_file.conf.example -%config %{_sysconfdir}/cgroup.release_common.example -%config %{_sysconfdir}/cgroup/release_freezer -%config %{_sysconfdir}/cgroup/release_cpuset -%config %{_sysconfdir}/cgroup/release_memory %config %{_sysconfdir}/layouts.d/power.conf.example %config %{_sysconfdir}/layouts.d/power_cpufreq.conf.example %config %{_sysconfdir}/layouts.d/unit.conf.example