Re: [PATCH v6 6/8] x86/resctrl: Move default control group creation during mount
From: Reinette Chatre
Date: Fri Aug 04 2023 - 16:42:27 EST
Hi Babu,
On 7/19/2023 4:22 PM, Babu Moger wrote:
> The resctrl default control group is created during kernel init time. If
> the new files are to be added to the default group during the mount based
> on the mount option, then each file needs to be created separately and
> call kernfs_activate.
>
> This can avoided if all the files are created during the mount and
> destroyed during the umount. Move the root and default group creation
> in rdt_get_tree and removal in rdt_kill_sb.
Please use () to indicate function names.
>
> Suggested-by: Reinette Chatre <reinette.chatre@xxxxxxxxx>
> Signed-off-by: Babu Moger <babu.moger@xxxxxxx>
> ---
...
> @@ -3704,10 +3720,8 @@ static struct kernfs_syscall_ops rdtgroup_kf_syscall_ops = {
> .show_options = rdtgroup_show_options,
> };
>
> -static int __init rdtgroup_setup_root(void)
> +int rdtgroup_setup_root(void)
> {
> - int ret;
> -
> rdt_root = kernfs_create_root(&rdtgroup_kf_syscall_ops,
> KERNFS_ROOT_CREATE_DEACTIVATED |
> KERNFS_ROOT_EXTRA_OPEN_PERM_CHECK,
> @@ -3715,28 +3729,17 @@ static int __init rdtgroup_setup_root(void)
> if (IS_ERR(rdt_root))
> return PTR_ERR(rdt_root);
>
> - mutex_lock(&rdtgroup_mutex);
> -
> rdtgroup_default.closid = 0;
> rdtgroup_default.mon.rmid = 0;
> rdtgroup_default.type = RDTCTRL_GROUP;
> + rdtgroup_default.mode = RDT_MODE_SHAREABLE;
> INIT_LIST_HEAD(&rdtgroup_default.mon.crdtgrp_list);
>
> list_add(&rdtgroup_default.rdtgroup_list, &rdt_all_groups);
>
> - ret = rdtgroup_add_files(kernfs_root_to_node(rdt_root), RFTYPE_CTRL_BASE);
> - if (ret) {
> - kernfs_destroy_root(rdt_root);
> - goto out;
> - }
> -
> rdtgroup_default.kn = kernfs_root_to_node(rdt_root);
> - kernfs_activate(rdtgroup_default.kn);
>
> -out:
> - mutex_unlock(&rdtgroup_mutex);
> -
> - return ret;
> + return 0;
> }
I am missing something here. Why is it now needed to re-initialize
and add default resource group on every mount of resctrl? I expected
only the kernfs related changes to move.
Reinette