Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:arch\x86\kernel\cpu\resctrl\rdtgroup.c Create Date:2022-07-28 08:12:06
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:mkdir_rdt_prepare

Proto:static int mkdir_rdt_prepare(struct kernfs_node *parent_kn, struct kernfs_node *prgrp_kn, const char *name, umode_t mode, enum rdt_group_type rtype, struct rdtgroup **r)

Type:int

Parameter:

TypeParameterName
struct kernfs_node *parent_kn
struct kernfs_node *prgrp_kn
const char *name
umode_tmode
enum rdt_group_typertype
struct rdtgroup **r
2653  files = 0
2656  prdtgrp = rdtgroup_kn_lock_live(parent_kn)
2657  If Not prdtgrp Then
2658  ret = -ENODEV
2659  Go to out_unlock
2662  If rtype == RDTMON_GROUP && ( mode == RDT_MODE_PSEUDO_LOCKSETUP || mode == RDT_MODE_PSEUDO_LOCKED ) Then
2665  ret = -EINVAL
2666  rdt_last_cmd_puts("Pseudo-locking in progress\n")
2667  Go to out_unlock
2671  rdtgrp = kzalloc - allocate memory. The memory is set to zero.*@size: how many bytes of memory are required.*@flags: the type of memory to allocate (see kmalloc).
2672  If Not rdtgrp Then
2673  ret = -ENOSPC
2674  rdt_last_cmd_puts("Kernel out of memory\n")
2675  Go to out_unlock
2677  r = rdtgrp
2678  parent = prdtgrp
2679  type = rtype
2680  Initialization list head
2683  kn = kernfs_create_dir(parent_kn, name, mode, rdtgrp)
2684  If IS_ERR(kn) Then
2685  ret = PTR_ERR(kn)
2686  rdt_last_cmd_puts("kernfs create error\n")
2687  Go to out_free_rgrp
2689  kn = kn
2697  kernfs_get(kn)
2699  ret = set uid and gid of rdtgroup dirs and files to that of the creator
2700  If ret Then
2701  rdt_last_cmd_puts("kernfs perm error\n")
2702  Go to out_destroy
2705  files = RFTYPE_BASE | BIT(RF_CTRLSHIFT + rtype)
2706  ret = rdtgroup_add_files(kn, files)
2707  If ret Then
2708  rdt_last_cmd_puts("kernfs fill error\n")
2709  Go to out_destroy
2712  If rdt_mon_capable Then
2713  ret = alloc_rmid()
2714  If ret < 0 Then
2715  rdt_last_cmd_puts("Out of RMIDs\n")
2716  Go to out_destroy
2718  rmid = ret
2720  ret = This creates a directory mon_data which contains the monitored data
2721  If ret Then
2722  rdt_last_cmd_puts("kernfs subdir error\n")
2723  Go to out_idfree
2726  kernfs_activate(kn)
2731  Return 0
2733  out_idfree :
2734  free_rmid(rmid)
2735  out_destroy :
2736  kernfs_remove(kn)
2737  out_free_rgrp :
2738  free previously allocated memory
2739  out_unlock :
2740  rdtgroup_kn_unlock(parent_kn)
2741  Return ret
Caller
NameDescribe
rdtgroup_mkdir_monCreate a monitor group under "mon_groups" directory of a control* and monitor group(ctrl_mon). This is a resource group* to monitor a subset of tasks and cpus in its parent ctrl_mon group.
rdtgroup_mkdir_ctrl_monThese are rdtgroups created under the root directory. Can be used* to allocate and monitor resources.