Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:hange the enabled child controllers for a cgroup in the default hierarchy

Proto:static ssize_t cgroup_subtree_control_write(struct kernfs_open_file *of, char *buf, size_t nbytes, loff_t off)

Type:ssize_t

Parameter:

TypeParameterName
struct kernfs_open_file *of
char *buf
size_tnbytes
loff_toff
3222  enable = 0 , disable = 0
3232  buf = strstrip(buf)
3233  When tok = strsep - Split a string into tokens*@s: The string to be searched*@ct: The characters to search for* strsep() updates @s to point after the token, ready for the next call.* It returns empty tokens, too, behaving exactly like the libc function cycle
3234  If tok[0] == '\0' Then Continue
3236  Do
3236  If Not CGROUP_SUBSYS_COUNT Then
3236  ssid = 0
3236  Break
3236  ss = cgroup_subsys[ssid]
3241  If tok == '+' Then
3242  enable |= 1 << ssid
3243  disable &= ~(1 << ssid)
3244  Else if tok == '-' Then
3245  disable |= 1 << ssid
3246  enable &= ~(1 << ssid)
3247  Else
3248  Return -EINVAL
3250  Break
3251  When (false) cycle
3252  If ssid == CGROUP_SUBSYS_COUNT Then Return -EINVAL
3256  cgrp = group_kn_lock_live - locking helper for cgroup kernfs methods*@kn: the kernfs_node being serviced*@drain_offline: perform offline draining on the cgroup* This helper is to be used by a cgroup kernfs method currently servicing*@kn
3257  If Not cgrp Then Return -ENODEV
3261  If enable & 1 << ssid Then
3263  enable &= ~(1 << ssid)
3264  Continue
3267  If Not (subsystems visibly enabled on a cgroup & 1 << ssid ) Then
3268  ret = -ENOENT
3269  Go to out_unlock
3271  Else if disable & 1 << ssid Then
3273  disable &= ~(1 << ssid)
3274  Continue
3280  ret = -EBUSY
3281  Go to out_unlock
3287  If Not enable && Not disable Then
3288  ret = 0
3289  Go to out_unlock
3292  ret = cgroup_vet_subtree_control_enable(cgrp, enable)
3293  If ret Then Go to out_unlock
3297  group_save_control - save control masks and dom_cgrp of a subtree*@cgrp: root of the target subtree* Save ->subtree_control, ->subtree_ss_mask and ->dom_cgrp to the* respective old_ prefixed fields for @cgrp's subtree including @cgrp* itself.
3299  * 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 |= enable
3300  * 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 &= ~disable
3302  ret = cgroup_apply_control(cgrp)
3303  cgroup_finalize_control(cgrp, ret)
3304  If ret Then Go to out_unlock
3307  kernfs_activate( cgroup kernfs entry )
3308  out_unlock :
3309  group_kn_unlock - unlocking helper for cgroup kernfs methods*@kn: the kernfs_node being serviced* This helper undoes cgroup_kn_lock_live() and should be invoked before* the method finishes if locking succeeded
3310  Return If ret Else nbytes