Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:kernel\cgroup\cgroup.c Create Date:2022-07-28 11:11:19
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:proc_cgroup_show()* - Print task's cgroup paths into seq_file, one line for each hierarchy* - Used for /proc/<pid>/cgroup.

Proto:int proc_cgroup_show(struct seq_file *m, struct pid_namespace *ns, struct pid *pid, struct task_struct *tsk)

Type:int

Parameter:

TypeParameterName
struct seq_file *m
struct pid_namespace *ns
struct pid *pid
struct task_struct *tsk
5788  retval = -ENOMEM
5789  buf = Allocation memory
5790  If Not buf Then Go to out
5793  mutex_lock( & cgroup_mutex is the master lock)
5794  spin_lock_irq( & css_set_lock)
5796  rate across the hierarchies (root)
5799  count = 0
5801  If root == The default hierarchy, reserved for the subsystems that are otherwise* unattached - it never has more than a single cgroup, and all tasks are* part of that cgroup. && Not The default hierarchy always exists but is hidden until mounted for the* first time. This is for backward compatibility. Then Continue
5804  seq_printf(m, "%d:", Unique id for this hierarchy. )
5805  If root != The default hierarchy, reserved for the subsystems that are otherwise* unattached - it never has more than a single cgroup, and all tasks are* part of that cgroup. Then r_each_subsys - iterate all enabled cgroup subsystems*@ss: the iteration cursor*@ssid: the index of @ss, CGROUP_SUBSYS_COUNT after reaching the end(ss, ssid)
5807  If The bitmask of subsystems attached to this hierarchy & 1 << ssid Then seq_printf(m, "%s%s", count++ ? "," : "", optional, initialized automatically during boot if not set )
5810  If strlen - Find the length of a string*@s: The string to be sized Then seq_printf(m, "%sname=%s", count ? "," : "", The name for this hierarchy - may be empty )
5813  seq_putc(m, ':')
5815  cgrp = Return the cgroup for "task" from the given hierarchy. Must be* called with cgroup_mutex and css_set_lock held.
5831  If retval < 0 Then Go to out_unlock
5834  seq_puts(m, buf)
5835  Else
5836  seq_puts(m, "/")
5839  If group_on_dfl - test whether a cgroup is on the default hierarchy*@cgrp: the cgroup of interest* The default hierarchy is the v2 interface of cgroup and this function* can be used to test whether a cgroup is on the default hierarchy for* cases where a && cgroup_is_dead(cgrp) Then seq_puts(m, " (deleted)\n")
5841  Else seq_putc(m, '\n')
5845  retval = 0
5846  out_unlock :
5847  spin_unlock_irq( & css_set_lock)
5848  mutex_unlock - release the mutex*@lock: the mutex to be released* Unlock a mutex that has been locked by this task previously.* This function must not be used in interrupt context. Unlocking* of a not locked mutex is not allowed.
5849  kfree(buf)
5850  out :
5851  Return retval