[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZoQ1937ntIdMNQwL@agluck-desk3.sc.intel.com>
Date: Tue, 2 Jul 2024 10:16:39 -0700
From: Tony Luck <tony.luck@...el.com>
To: Borislav Petkov <bp@...en8.de>
Cc: Fenghua Yu <fenghua.yu@...el.com>,
Reinette Chatre <reinette.chatre@...el.com>,
Maciej Wieczor-Retman <maciej.wieczor-retman@...el.com>,
Peter Newman <peternewman@...gle.com>,
James Morse <james.morse@....com>, Babu Moger <babu.moger@....com>,
Drew Fustini <dfustini@...libre.com>,
Dave Martin <Dave.Martin@....com>, x86@...nel.org,
linux-kernel@...r.kernel.org, patches@...ts.linux.dev
Subject: Re: [PATCH v23 14/19] x86/resctrl: Handle removing directories in
Sub-NUMA Cluster (SNC) mode
On Tue, Jul 02, 2024 at 10:53:37AM +0200, Borislav Petkov wrote:
> On Fri, Jun 28, 2024 at 02:56:14PM -0700, Tony Luck wrote:
...
> ... and this are almost identical hunks.
>
> Why isn't there a helper which gets called here?
A helper will avoid this duplication. Draft below. Is this
what you want? Is the function name OK. I wasn't sure if the
"mon" looked better at the beginning. Or as rmdir_one_mon_subdir()
I've also fixed up part 17 to use msr_clear_bit()
Are you still digging through the patches?
-Tony
static void mon_rmdir_one_subdir(struct kernfs_node *pkn, char *name, char *subname)
{
struct kernfs_node *kn;
kn = kernfs_find_and_get(pkn, name);
if (!kn)
return;
kernfs_put(kn);
if (kn->dir.subdirs <= 1)
kernfs_remove(kn);
else
kernfs_remove_by_name(kn, subname);
}
/*
* Remove all subdirectories of mon_data of ctrl_mon groups
* and monitor groups for the given domain.
* Remove files and directories containing "sum" of domain data
* when last domain being summed is removed.
*/
static void rmdir_mondata_subdir_allrdtgrp(struct rdt_resource *r,
struct rdt_mon_domain *d)
{
struct rdtgroup *prgrp, *crgrp;
char subname[32];
bool snc_mode;
char name[32];
snc_mode = r->mon_scope == RESCTRL_L3_NODE;
sprintf(name, "mon_%s_%02d", r->name, snc_mode ? d->ci->id : d->hdr.id);
if (snc_mode)
sprintf(subname, "mon_sub_%s_%02d", r->name, d->hdr.id);
list_for_each_entry(prgrp, &rdt_all_groups, rdtgroup_list) {
mon_rmdir_one_subdir(prgrp->mon.mon_data_kn, name, subname);
list_for_each_entry(crgrp, &prgrp->mon.crdtgrp_list, mon.crdtgrp_list)
mon_rmdir_one_subdir(crgrp->mon.mon_data_kn, name, subname);
}
}
Powered by blists - more mailing lists