﻿# Slurm cgroup plugins: tracking, confinement and accounting are different roles

Trace a Slurm step's child processes through process tracking, resource confinement and accounting instead of assuming one cgroup setting enables every role.

Author: Retrivium team
Updated: 2026-11-06
Canonical URL: https://retrivium.ai/journal/slurm-cgroup-accounting-child-process/
Language: en

A job launches native preprocessing children, and its accounting report appears inconsistent with the observed process tree. An operator says cgroups are enabled, but that statement does not identify which Slurm plugins are tracking, constraining and measuring the work. Establish those roles before changing a resource limit.

## Map processes to a real step

Preserve job and step identities, parent and child processes, and their actual cgroup membership. Do not infer membership solely from a process name or shell ancestry. The [Slurm cgroup overview](https://slurm.schedmd.com/cgroups.html) describes process tracking as a distinct plugin responsibility. Check the running site's configuration and hierarchy rather than treating an example configuration as evidence that every child in the current workload is tracked or included in a particular report.

## Separate tracking from confinement

proctrack/cgroup tracks process membership and supports signalling. task/cgroup provides configured resource confinement. The [cgroup configuration reference](https://slurm.schedmd.com/cgroup.conf.html) defines individual controls, including device and memory-related enforcement settings. A populated process list does not establish that the desired controller is enabled or its limit matches the allocation. Conversely, a resource boundary does not prove the signal policy addresses every application-created child in the way its shutdown protocol expects.

## Identify the accounting definition

jobacct_gather/cgroup collects accounting statistics, while other accounting plugins use different observation methods. The overview warns that their CPU and memory figures need not represent identical quantities. Record plugin, hierarchy, field definition and observation period with the report. Do not compare a cgroup subtree quantity with a selected process's resident memory and immediately label the difference a leak. The [task-count guide](/journal/container-pids-limit-thread-errors/) similarly distinguishes process-only observations from the threads actually counted by a controller.

## Inspect the actual hierarchy integration

The [cgroup integration guide](https://slurm.schedmd.com/cgroup_v2.html) explains how the internal plugin interacts with Slurm components and systemd. Inspect the effective deployment before copying assumptions between hierarchy versions or service managers. An unavailable controller cannot enforce its resource through Slurm merely because a configuration key exists. The [OOM scope guide](/journal/guide-linux-oom-partial-worker-loss/) explains why membership and group behavior must remain explicit when some children die but their supervisor continues.

## Exercise a known parent-child workload

Use a disposable job that creates recognizable children with bounded CPU and memory activity. Observe membership, accounting changes and supported termination behavior under the declared configuration. Preserve surviving processes after the job ends, if any, before concluding cleanup succeeded. Acceptance should connect each intended child to the appropriate tracking, enforcement and measurement scope. This proposed protocol claims no measured accounting accuracy or completed confinement test and does not require altering shared production configuration to obtain evidence.

## Retain the roles with the incident

Save the relevant plugin settings and observed hierarchy alongside the job's report. A later plugin or systemd change can alter the interpretation even when application code is unchanged. The useful outcome is an explained resource record and a tested lifecycle for the chosen child workload. It is not proof that all metrics are interchangeable, every limit is active, every process is protected from OOM or all descendants necessarily stop when the batch shell exits.
