Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:add_del_listener

Proto:static int add_del_listener(pid_t pid, const struct cpumask *mask, int isadd)

Type:int

Parameter:

TypeParameterName
pid_tpid
const struct cpumask *mask
intisadd
283  ret = 0
285  If Not pumask_subset - (*src1p & ~*src2p) == 0*@src1p: the first input*@src2p: the second input* Returns 1 if *@src1p is a subset of *@src2p, else returns 0 Then Return -EINVAL
288  If current_user_ns() != userns count is 1 for root user, 1 for init_uts_ns,* and 1 for... ? Then Return -EINVAL
291  If task_active_pid_ns(current process) != PID-map pages start out as NULL, they get allocated upon* first use and are never deallocated. This way a low pid_max* value does not cause lots of bitmaps to be allocated, but* the scheme scales to up to 4 million PIDs, runtime. Then Return -EINVAL
294  If isadd == REGISTER Then
296  s = kmalloc_node(sizeof(structlistener), GFP_KERNEL, cpu_to_node(cpu))
298  If Not s Then
299  ret = -ENOMEM
300  Go to cleanup
302  pid = pid
303  valid = 1
305  listeners = per_cpu(listener_array, cpu)
306  lock for writing
308  If pid == pid && valid Then Go to exists
311  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.
312  s = NULL
313  exists :
314  lease a write lock
315  kfree(s)
317  Return 0
321  cleanup :
323  listeners = per_cpu(listener_array, cpu)
324  lock for writing
326  If pid == pid Then
327  deletes entry from list
328  kfree(s)
329  Break
332  lease a write lock
334  Return ret
Caller
NameDescribe
cmd_attr_register_cpumask
cmd_attr_deregister_cpumask