函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

函数名称:DO NOT USE IN NEW FILES.* Parse input and register new cgroup event handler.* Input must be in format '<event_fd> <control_fd> <args>'.* Interpretation of args is defined by control file implementation.

函数原型:static ssize_t memcg_write_event_control(struct kernfs_open_file *of, char *buf, size_t nbytes, loff_t off)

返回类型:ssize_t

参数:

类型参数名称
struct kernfs_open_file *of
char *buf
size_tnbytes
loff_toff
4504  css等于of_css(of)
4505  memcg等于mem_cgroup_from_css(css)
4515  buf等于strstrip(buf)
4517  efd等于转换字符串为无符号整形
4518  如果endp不等于' '则返回:负EINVAL
4520  buf等于endp加1
4522  cfd等于转换字符串为无符号整形
4523  如果endp不等于' '且endp不等于'\0'则返回:负EINVAL
4525  buf等于endp加1
4527  event等于分配内存并置零
4528  如果非event则返回:负ENOMEM
4531  memcg which the event belongs to.等于memcg
4532  初始化链表头
4533  init_poll_funcptr( & All fields below needed to unregister event when* userspace closes eventfd., memcg_event_ptable_queue_proc)
4534  init_waitqueue_func_entry( & wait, Gets called on EPOLLHUP on eventfd when user closes it.* Called with wqh->lock held and interrupts disabled.)
4535  INIT_WORK( & remove, Unregister event and free resources.* Gets called from workqueue.)
4537  efile等于fdget(efd)
4538  如果非file
4539  ret等于负EBADF
4540  转到:out_kfree
4543  ventfd to signal userspace about the event.等于eventfd_ctx_fileget(file)
4544  如果是错误
4545  ret等于错误
4546  转到:out_put_efile
4549  cfile等于fdget(cfd)
4550  如果非file
4551  ret等于负EBADF
4552  转到:out_put_eventfd
4557  ret等于inode_permission(file_inode(file), MAY_READ)
4558  如果ret小于0则转到:out_put_cfile
4569  name等于name
4571  如果非字符串比较
4572  register_event等于mem_cgroup_usage_register_event
4573  unregister_event等于mem_cgroup_usage_unregister_event
4574  否则如果非字符串比较
4575  register_event等于mem_cgroup_oom_register_event
4576  unregister_event等于mem_cgroup_oom_unregister_event
4577  否则如果非字符串比较
4578  register_event等于vmpressure_register_event() - Bind vmpressure notifications to an eventfd*@memcg: memcg that is interested in vmpressure notifications*@eventfd: eventfd context to link notifications with*@args: event arguments (pressure level threshold, optional mode)*
4579  unregister_event等于vmpressure_unregister_event() - Unbind eventfd from vmpressure*@memcg: memcg handle*@eventfd: eventfd context that was used to link vmpressure with the @cg* This function does internal manipulations to detach the @eventfd from* the vmpressure
4580  否则如果非字符串比较
4581  register_event等于memsw_cgroup_usage_register_event
4582  unregister_event等于memsw_cgroup_usage_unregister_event
4583  否则
4584  ret等于负EINVAL
4585  转到:out_put_cfile
4593  cfile_css等于ss_tryget_online_from_dir - get corresponding css from a cgroup dentry*@dentry: directory dentry of interest*@ss: subsystem of interest* If @dentry is a directory for a cgroup which has @ss enabled on it, try* to get the corresponding css and return it
4595  ret等于负EINVAL
4596  如果是错误则转到:out_put_cfile
4598  如果cfile_css不等于css
4599  设置一个css引用
4600  转到:out_put_cfile
4603  ret等于register_event(memcg, ventfd to signal userspace about the event., buf)
4604  如果ret则转到:out_put_css
4607  vfs_poll(file, & All fields below needed to unregister event when* userspace closes eventfd.)
4609  加自旋锁
4610  添加链表项
4611  自旋锁解锁
4613  fdput(cfile)
4614  fdput(efile)
4616  返回:nbytes
4618  out_put_css :
4619  设置一个css引用
4620  out_put_cfile :
4621  fdput(cfile)
4622  out_put_eventfd :
4623  eventfd_ctx_put(ventfd to signal userspace about the event.)
4624  out_put_efile :
4625  fdput(efile)
4626  out_kfree :
4627  释放内存
4629  返回:ret