Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:cgroup_setup_root

Proto:int cgroup_setup_root(struct cgroup_root *root, u16 ss_mask)

Type:int

Parameter:

TypeParameterName
struct cgroup_root *root
u16ss_mask
1929  LIST_HEAD(tmp_links)
1930  root_cgrp = The root cgroup. Root is destroyed on its release.
1935  lockdep_assert_held( & cgroup_mutex is the master lock)
1937  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
1939  If ret Then Go to out
1949  ret = allocate_cgrp_cset_links - allocate cgrp_cset_links*@count: the number of links to allocate*@tmp_links: list_head the allocated links are put on* Allocate @count cgrp_cset_link structures and chain them on @tmp_links* through ->cset_link
1950  If ret Then Go to cancel_ref
1953  ret = cgroup_init_root_id(root)
1954  If ret Then Go to cancel_ref
1957  kf_sops = 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 A task must hold cgroup_mutex to modify cgroups.* Any task can increment and decrement the count field without lock.* So in general, code holding cgroup_mutex can't rely on the count* field not changing. However, if the count goes to zero, then only Else cgroup1_kf_syscall_ops
1960  kf_root = kernfs_create_root(kf_sops, KERNFS_ROOT_CREATE_DEACTIVATED | KERNFS_ROOT_SUPPORT_EXPORTOP, root_cgrp)
1964  If IS_ERR(kf_root) Then
1965  ret = PTR_ERR(kf_root)
1966  Go to exit_root_id
1968  cgroup kernfs entry = published fields
1969  WARN_ON_ONCE(rns ino associated with a cgroup != 1)
1970  ids of the ancestors at each level including self [0] = Inline functions.
1972  ret = ss_populate_dir - create subsys files in a cgroup directory*@css: target css* On failure, no file is added.
1973  If ret Then Go to destroy_root
1976  ret = rebind_subsystems(root, ss_mask)
1977  If ret Then Go to destroy_root
1980  ret = cgroup_bpf_inherit(root_cgrp)
1981  WARN_ON_ONCE(ret)
1983  trace_cgroup_setup_root(root)
1990  list_add - add a new entry*@new: new entry to be added*@head: list head to add it after* Insert a new entry after the specified head.* This is good for implementing stacks.
1991  cgroup_root_count++
1997  spin_lock_irq( & css_set_lock)
1999  link_css_set - a helper function to link a css_set to a cgroup*@tmp_links: cgrp_cset_link objects allocated by allocate_cgrp_cset_links()*@cset: the css_set to be linked*@cgrp: the destination cgroup
2000  If ss_set_populated - does a css_set contain any tasks?*@cset: target css_set* css_set_populated() should be the same as !!cset->nr_tasks at steady* state Then group_update_populated - update the populated count of a cgroup*@cgrp: the target cgroup*@populated: inc or dec populated count* One of the css_sets associated with @cgrp is either getting its first* task or losing the last
2003  spin_unlock_irq( & css_set_lock)
2005  BUG_ON(!list_empty - tests whether a list is empty*@head: the list to test.)
2006  BUG_ON(atomic_read( & Number of cgroups in the hierarchy, used only for /proc/cgroups ) != 1)
2008  kernfs_activate( cgroup kernfs entry )
2009  ret = 0
2010  Go to out
2012  destroy_root :
2013  kernfs_destroy_root(kf_root)
2014  kf_root = NULL
2015  exit_root_id :
2016  cgroup_exit_root_id(root)
2017  cancel_ref :
2018  percpu_ref_exit - undo percpu_ref_init()*@ref: percpu_ref to exit* This function exits @ref
2019  out :
2020  free_cgrp_cset_links( & tmp_links)
2021  Return ret
Caller
NameDescribe
cgroup_initgroup_init - cgroup initialization* Register cgroup filesystem and /proc file, and initialize* any subsystems that didn't request early init.
cgroup1_root_to_useThe guts of cgroup1 mount - find or create cgroup_root to use