Re: [PATCH v11 20/31] fs/resctrl: Refactor Sub-NUMA Cluster (SNC) in mkdir/rmdir code flow

From: Luck, Tony
Date: Thu Oct 09 2025 - 13:45:59 EST


On Wed, Oct 08, 2025 at 07:16:07PM -0700, Reinette Chatre wrote:
> Understood. This is not about correctness but making the code easier to understand.
> What I am aiming for is consistency in the code where the pattern
> in existing flows use the resource ID as check to direct code flow to resource
> specific code. In the above flow it uses the monitoring scope. This works of course,
> but it is an implicit check because the L3 resource is the only one that currently
> supports the "node" scope and does so when SNC is enabled.
> My preference is for the code to be consistent in patterns used and find doing so
> makes the code easier to read and understand.
>
Reinette,

Should I address this "only one that currently" issue now? Maybe by
adding a bool "rdt_resource:snc_mode" so the implicit

if (r->mon_scope == RESCTRL_L3_NODE)

changes to:

if (r->snc_mode)

There are only two places where SNC mode is checked in this way. The
others rely on seeing that mon_data::sum is set, or that rr->hdr is
NULL. So it seems like a very small improvement.

If we ever add a node scoped resource that isn't related to SNC, it
would be needed at that point. But I'm not sure why hardware would
ever do that.

-Tony