Re: [PATCH v4 16/24] x86/resctrl: Make resctrl_mounted checks explicit

From: Reinette Chatre
Date: Thu Jun 15 2023 - 18:23:25 EST


Hi James,

On 5/25/2023 11:02 AM, James Morse wrote:

...

> @@ -3710,8 +3716,11 @@ int resctrl_online_domain(struct rdt_resource *r, struct rdt_domain *d)
> if (is_llc_occupancy_enabled())
> INIT_DELAYED_WORK(&d->cqm_limbo, cqm_handle_limbo);
>
> - /* If resctrl is mounted, add per domain monitor data directories. */
> - if (static_branch_unlikely(&rdt_mon_enable_key))
> + /*
> + * If the filesystem is not mounted, creating directories is deferred
> + * until mount time by rdt_get_tree() calling mkdir_mondata_all().
> + */

I do not think that this new comment captures this work. This code is when a new
domain comes online and directories need to be created in all the existing
resource groups. This includes the default resource group as well as those created
after resctrl was mounted. The new comment states that this is "deferred until mount
time by rdt_get_tree() calling mkdir_mondata_all()" - but I do not think that is
accurate since the reader is point to the directories created just for the default
resource group.
Perhaps something like:

/*
* If the filesystem is not mounted then only the default resource group
* exists. Creation of its directories is deferred until mount time
* by rdt_get_tree() calling mkdir_mondata_all().
*/

I do think that the comment explaining what the code does is helpful though.
Can you please also keep the comment about what is done in the case when resctrl
is indeed mounted?


> + if (resctrl_mounted && static_branch_unlikely(&rdt_mon_enable_key))
> mkdir_mondata_subdir_allrdtgrp(r, d);
>
> return 0;


Reinette