Skip to content
Snippets Groups Projects
  • Mark A. Grondona's avatar
    aa912e4a
    xcgroup: add xcgroup_move_process helper function · aa912e4a
    Mark A. Grondona authored
    This patch adds a helper function to common/xcgroup.c to aid
    in moving processes between cgroups. If the cgroups.procs file
    is writable then writing the PID to that file is used, as this
    method moves all threads in a process atomically.
    
    If cgroups.procs is not writable, then each thread must be moved
    individually by walking the /proc/PID/task/ directory and writing
    each taskid individually to the 'tasks' file in the cgroup. The
    second method is racy if a process is concurrently creating
    threads, but it is better than the current method of just moving
    one of the process's threads.
    aa912e4a
    History
    xcgroup: add xcgroup_move_process helper function
    Mark A. Grondona authored
    This patch adds a helper function to common/xcgroup.c to aid
    in moving processes between cgroups. If the cgroups.procs file
    is writable then writing the PID to that file is used, as this
    method moves all threads in a process atomically.
    
    If cgroups.procs is not writable, then each thread must be moved
    individually by walking the /proc/PID/task/ directory and writing
    each taskid individually to the 'tasks' file in the cgroup. The
    second method is racy if a process is concurrently creating
    threads, but it is better than the current method of just moving
    one of the process's threads.