[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240702085337.GAZoPAEaEBtT18iD3V@fat_crate.local>
Date: Tue, 2 Jul 2024 10:53:37 +0200
From: Borislav Petkov <bp@...en8.de>
To: Tony Luck <tony.luck@...el.com>
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 Fri, Jun 28, 2024 at 02:56:14PM -0700, Tony Luck wrote:
> list_for_each_entry(prgrp, &rdt_all_groups, rdtgroup_list) {
> - sprintf(name, "mon_%s_%02d", r->name, dom_id);
> - kernfs_remove_by_name(prgrp->mon.mon_data_kn, name);
> + kn = kernfs_find_and_get(prgrp->mon.mon_data_kn, name);
> + if (!kn)
> + continue;
> + kernfs_put(kn);
> +
> + if (kn->dir.subdirs <= 1)
> + kernfs_remove(kn);
> + else
> + kernfs_remove_by_name(kn, subname);
This...
>
> - list_for_each_entry(crgrp, &prgrp->mon.crdtgrp_list, mon.crdtgrp_list)
> - kernfs_remove_by_name(crgrp->mon.mon_data_kn, name);
> + list_for_each_entry(crgrp, &prgrp->mon.crdtgrp_list, mon.crdtgrp_list) {
> + kn = kernfs_find_and_get(crgrp->mon.mon_data_kn, name);
> + if (!kn)
> + continue;
> + kernfs_put(kn);
> +
> + if (kn->dir.subdirs <= 1)
> + kernfs_remove(kn);
> + else
> + kernfs_remove_by_name(kn, subname);
> + }
... and this are almost identical hunks.
Why isn't there a helper which gets called here?
--
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette
Powered by blists - more mailing lists