Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:The returned cgroup is fully initialized including its control mask, but* it isn't associated with its kernfs_node and doesn't have the control* mask applied.

Proto:static struct cgroup *cgroup_create(struct cgroup *parent, const char *name, umode_t mode)

Type:struct cgroup

Parameter:

TypeParameterName
struct cgroup *parent
const char *name
umode_tmode
5151  root = root
5154  level = * The depth this cgroup is at. The root is at depth zero and each * step down the hierarchy increments the level. This along with * ancestor_ids[] can determine whether a given cgroup is a * descendant of another without traversing the hierarchy. + 1
5158  cgrp = kzalloc - allocate memory. The memory is set to zero.*@size: how many bytes of memory are required.*@flags: the type of memory to allocate (see kmalloc).
5160  If Not cgrp Then Return ERR_PTR( - ENOMEM)
5163  ret = percpu_ref_init - initialize a percpu refcount*@ref: percpu_ref to initialize*@release: function which will be called when refcount hits 0*@flags: PERCPU_REF_INIT_* flags*@gfp: allocation mask to use* Initializes @ref
5164  If ret Then Go to out_free_cgrp
5167  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 Then
5168  ret = stat.c
5169  If ret Then Go to out_cancel_ref
5174  kn = kernfs_create_dir( cgroup kernfs entry , name, mode, cgrp)
5175  If IS_ERR(kn) Then
5176  ret = PTR_ERR(kn)
5177  Go to out_stat_exit
5179  cgroup kernfs entry = kn
5181  init_cgroup_housekeeping(cgrp)
5183  PI: the parent css. Placed here for cache proximity to following* fields of the containing structure. = self css with NULL ->ss, points back to this cgroup
5184  root = root
5185  * The depth this cgroup is at. The root is at depth zero and each * step down the hierarchy increments the level. This along with * ancestor_ids[] can determine whether a given cgroup is a * descendant of another without traversing the hierarchy. = level
5187  ret = psi_cgroup_alloc(cgrp)
5188  If ret Then Go to out_kernfs_remove
5191  ret = cgroup_bpf_inherit(cgrp)
5192  If ret Then Go to out_psi_free
5199  Should the cgroup actually be frozen? = Should the cgroup actually be frozen?
5200  If Should the cgroup actually be frozen? Then
5207  Atomically set a bit in memory
5208  Atomically set a bit in memory
5211  spin_lock_irq( & css_set_lock)
5212  When tcgrp cycle
5213  ids of the ancestors at each level including self [* The depth this cgroup is at. The root is at depth zero and each * step down the hierarchy increments the level. This along with * ancestor_ids[] can determine whether a given cgroup is a * descendant of another without traversing the hierarchy.] = Inline functions.
5215  If tcgrp != cgrp Then
5227  spin_unlock_irq( & css_set_lock)
5229  If notify_on_release(parent) Then Atomically set a bit in memory
5232  If st_bit - Determine whether a bit is set*@nr: bit number to test*@addr: Address to start counting from Then Atomically set a bit in memory
5235  Monotonically increasing unique serial number which defines a* uniform order among all csses. It's guaranteed that all* ->children lists are in the ascending order of ->serial_nr and* used to allow interrupting and resuming iterations. = Assign a monotonically increasing serial number to csses++
5238  list_add_tail_rcu - add a new entry to rcu-protected list*@new: new entry to be added*@head: list head to add it before* Insert a new entry before the specified head
5239  atomic_inc( & Number of cgroups in the hierarchy, used only for /proc/cgroups )
5240  cgroup_get_live(parent)
5246  If Not 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 Then * The bitmask of subsystems enabled on the child cgroups. * ->subtree_control is the one configured through * "cgroup.subtree_control" while ->child_ss_mask is the effective * one which may have more subsystems enabled. Controller knobs * are made availabl = subsystems visibly enabled on a cgroup
5249  group_propagate_control - refresh control masks of a subtree*@cgrp: root of the target subtree* For @cgrp and its subtree, ensure ->subtree_ss_mask matches* ->subtree_control and propagate controller availability through the
5251  Return cgrp
5253  out_psi_free :
5254  psi_cgroup_free(cgrp)
5255  out_kernfs_remove :
5256  kernfs_remove( cgroup kernfs entry )
5257  out_stat_exit :
5258  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 Then cgroup_rstat_exit(cgrp)
5260  out_cancel_ref :
5261  percpu_ref_exit - undo percpu_ref_init()*@ref: percpu_ref to exit* This function exits @ref
5262  out_free_cgrp :
5263  kfree(cgrp)
5264  Return ERR_PTR(ret)
Caller
NameDescribe
cgroup_mkdir