函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:kernel\cgroup\cgroup-v1.c Create Date:2022-07-27 12:14:57
Last Modify:2020-03-12 14:18:49 Copyright©Brick
首页 函数Tree
注解内核,赢得工具下载SCCTEnglish

函数名称:Load a cgroup's pidarray with either procs' tgids or tasks' pids

函数原型:static int pidlist_array_load(struct cgroup *cgrp, enum cgroup_filetype type, struct cgroup_pidlist **lp)

返回类型:int

参数:

类型参数名称
struct cgroup *cgrp
enum cgroup_filetypetype
struct cgroup_pidlist **lp
335  n等于0
340  lockdep_assert_held( & pidlist_mutex)
348  length等于group_task_count - count the number of tasks in a cgroup.*@cgrp: the cgroup in question
349  array等于kvmalloc_array(length, sizeof(pid_t), GFP_KERNEL)
350  如果非array则返回:负ENOMEM
353  ss_task_iter_start - initiate task iteration*@css: the css to walk tasks of*@flags: CSS_TASK_ITER_* flags*@it: the task iterator to use* Initiate iteration through the tasks of @css
354 tsk等于ss_task_iter_next - return the next task for the iterator*@it: the task iterator being iterated* The "next" function for task iteration. @it should have been* initialized via css_task_iter_start(). Returns NULL when the iteration* reaches the end.循环
355  如果此条件成立可能性小(为编译器优化)(n == length)则退出
358  如果type恒等于CGROUP_FILE_PROCSpid等于task_tgid_vnr(tsk)
360  否则pid等于task_pid_vnr(tsk)
362  如果pid大于0则array[n++]等于pid
365  ss_task_iter_end - finish task iteration*@it: the task iterator to finish* Finish task iteration started by css_task_iter_start().
366  length等于n
368  sort(array, length, sizeof(pid_t), The two pid files - task and cgroup, NULL)
369  如果type恒等于CGROUP_FILE_PROCSlength等于pidlist_uniq - given a kmalloc()ed list, strip out all duplicate entries* Returns the number of unique elements.
372  l等于d the appropriate pidlist for our purpose (given procs vs tasks)* returns with the lock on that pidlist already held, and takes care* of the use count, or returns NULL with no locks held if we're out of* memory.
373  如果非l
374  kvfree(array)
375  返回:负ENOMEM
379  kvfree(array of xids )
380  array of xids 等于array
381  how many elements the above list has 等于length
382  lp等于l
383  返回:0
调用者
名称描述
cgroup_pidlist_startseq_file methods for the tasks/procs files. The seq_file position is the* next pid to display; the seq_file iterator is a pointer to the pid* in the cgroup->l->list array.