Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:rdmacg_resource_set_max

Proto:static ssize_t rdmacg_resource_set_max(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
428  cg = css_rdmacg(of_css(of))
432  options = strstrip(buf)
434  enables = 0
435  i = 0 , ret = 0
438  dev_name = 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
439  If Not dev_name Then
440  ret = -EINVAL
441  Go to err
444  new_limits = kcalloc - allocate memory for an array. The memory is set to zero.*@n: number of elements.*@size: element size.*@flags: the type of memory to allocate (see kmalloc).
445  If Not new_limits Then
446  ret = -ENOMEM
447  Go to err
450  ret = rdmacg_parse_limits(options, new_limits, & enables)
451  If ret Then Go to parse_err
455  mutex_lock( & Protects list of resource pools maintained on per cgroup basis* and rdma device list.)
457  device = rdmacg_get_device_locked(dev_name)
458  If Not device Then
459  ret = -ENODEV
460  Go to dev_err
463  rpool = get_cg_rpool_locked(cg, device)
464  If IS_ERR(rpool) Then
465  ret = PTR_ERR(rpool)
466  Go to dev_err
470  for_each_set_bit(i, & enables, RDMACG_RESOURCE_MAX)
471  set_resource_limit(rpool, i, new_limits[i])
473  If count active user tasks of this pool == 0 && al number counts which are set to max == RDMACG_RESOURCE_MAX Then
479  free_cg_rpool_locked(rpool)
482  dev_err :
483  mutex_unlock - release the mutex*@lock: the mutex to be released* Unlock a mutex that has been locked by this task previously.* This function must not be used in interrupt context. Unlocking* of a not locked mutex is not allowed.
485  parse_err :
486  kfree(new_limits)
488  err :
489  Return If ret Else nbytes