* [PATCH 0/2] x86/resctrl: Optimize some resctrl code
@ 2025-06-11 2:15 Shaopeng Tan
2025-06-11 2:15 ` [PATCH 1/2] x86/resctrl: Remove unnecessary cpumask_nth_andnot() Shaopeng Tan
2025-06-11 2:15 ` [PATCH 2/2] x86/resctrl: Optimize code in rdt_get_tree() Shaopeng Tan
0 siblings, 2 replies; 7+ messages in thread
From: Shaopeng Tan @ 2025-06-11 2:15 UTC (permalink / raw)
To: x86, linux-kernel
Cc: Reinette Chatre, James Morse, Yury Norov, Dave Martin, fenghuay,
peternewman, Babu Moger, Borislav Petkov,
shameerali.kolothum.thodi, bobo.shaobowang, D Scott Phillips OS,
carl, Koba Ko, Shanker Donthineni, Xin Hao, baolin.wang,
lcherian, amitsinght, Ingo Molnar, David Hildenbrand,
H Peter Anvin, Rex Nie, Jamie Iles, dfustini, Thomas Gleixner
Hello Reinette, James, and Yury,
These two patches are just optimizations for the following patches
by James. The behavior has not changed.
https://lore.kernel.org/lkml/aB4jHPsWVNqrSG6W@yury/
https://lore.kernel.org/all/a86e72d1-1a1d-4348-9e2d-34b799571518@arm.com/
Shaopeng Tan (2):
x86/resctrl: Remove unnecessary cpumask_nth_andnot()
x86/resctrl: Optimize code in rdt_get_tree()
fs/resctrl/rdtgroup.c | 6 ++----
include/linux/cpumask.h | 16 ----------------
2 files changed, 2 insertions(+), 20 deletions(-)
--
2.43.5
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 1/2] x86/resctrl: Remove unnecessary cpumask_nth_andnot()
2025-06-11 2:15 [PATCH 0/2] x86/resctrl: Optimize some resctrl code Shaopeng Tan
@ 2025-06-11 2:15 ` Shaopeng Tan
2025-06-12 18:23 ` Reinette Chatre
2025-06-11 2:15 ` [PATCH 2/2] x86/resctrl: Optimize code in rdt_get_tree() Shaopeng Tan
1 sibling, 1 reply; 7+ messages in thread
From: Shaopeng Tan @ 2025-06-11 2:15 UTC (permalink / raw)
To: x86, linux-kernel
Cc: Reinette Chatre, James Morse, Yury Norov, Dave Martin, fenghuay,
peternewman, Babu Moger, Borislav Petkov,
shameerali.kolothum.thodi, bobo.shaobowang, D Scott Phillips OS,
carl, Koba Ko, Shanker Donthineni, Xin Hao, baolin.wang,
lcherian, amitsinght, Ingo Molnar, David Hildenbrand,
H Peter Anvin, Rex Nie, Jamie Iles, dfustini, Thomas Gleixner
In commit 94f753143028("x86/resctrl: Optimize cpumask_any_housekeeping()"),
cpumask_any_andnot_but() replaced cpumask_nth_andnot(),
but left the function cpumask_nth_andnot() unused, delete it.
Signed-off-by: Shaopeng Tan <tan.shaopeng@jp.fujitsu.com>
---
include/linux/cpumask.h | 16 ----------------
1 file changed, 16 deletions(-)
diff --git a/include/linux/cpumask.h b/include/linux/cpumask.h
index 7ae80a7ca81e..498790f74fa8 100644
--- a/include/linux/cpumask.h
+++ b/include/linux/cpumask.h
@@ -546,22 +546,6 @@ unsigned int cpumask_nth_and(unsigned int cpu, const struct cpumask *srcp1,
small_cpumask_bits, cpumask_check(cpu));
}
-/**
- * cpumask_nth_andnot - get the Nth cpu set in 1st cpumask, and clear in 2nd.
- * @srcp1: the cpumask pointer
- * @srcp2: the cpumask pointer
- * @cpu: the Nth cpu to find, starting from 0
- *
- * Return: >= nr_cpu_ids if such cpu doesn't exist.
- */
-static __always_inline
-unsigned int cpumask_nth_andnot(unsigned int cpu, const struct cpumask *srcp1,
- const struct cpumask *srcp2)
-{
- return find_nth_andnot_bit(cpumask_bits(srcp1), cpumask_bits(srcp2),
- small_cpumask_bits, cpumask_check(cpu));
-}
-
/**
* cpumask_nth_and_andnot - get the Nth cpu set in 1st and 2nd cpumask, and clear in 3rd.
* @srcp1: the cpumask pointer
--
2.43.5
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 2/2] x86/resctrl: Optimize code in rdt_get_tree()
2025-06-11 2:15 [PATCH 0/2] x86/resctrl: Optimize some resctrl code Shaopeng Tan
2025-06-11 2:15 ` [PATCH 1/2] x86/resctrl: Remove unnecessary cpumask_nth_andnot() Shaopeng Tan
@ 2025-06-11 2:15 ` Shaopeng Tan
2025-06-11 20:36 ` kernel test robot
2025-06-12 18:23 ` Reinette Chatre
1 sibling, 2 replies; 7+ messages in thread
From: Shaopeng Tan @ 2025-06-11 2:15 UTC (permalink / raw)
To: x86, linux-kernel
Cc: Reinette Chatre, James Morse, Yury Norov, Dave Martin, fenghuay,
peternewman, Babu Moger, Borislav Petkov,
shameerali.kolothum.thodi, bobo.shaobowang, D Scott Phillips OS,
carl, Koba Ko, Shanker Donthineni, Xin Hao, baolin.wang,
lcherian, amitsinght, Ingo Molnar, David Hildenbrand,
H Peter Anvin, Rex Nie, Jamie Iles, dfustini, Thomas Gleixner
Inconsistent context format. Optimize it,
not only save a line and also make it easier to understand.
Signed-off-by: Shaopeng Tan <tan.shaopeng@jp.fujitsu.com>
---
fs/resctrl/rdtgroup.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/fs/resctrl/rdtgroup.c b/fs/resctrl/rdtgroup.c
index 1beb124e25f6..8bf87211eadb 100644
--- a/fs/resctrl/rdtgroup.c
+++ b/fs/resctrl/rdtgroup.c
@@ -2608,10 +2608,8 @@ static int rdt_get_tree(struct fs_context *fc)
goto out_root;
ret = schemata_list_create();
- if (ret) {
- schemata_list_destroy();
- goto out_ctx;
- }
+ if (ret)
+ goto out_schemata_free;
ret = closid_init();
if (ret)
--
2.43.5
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 2/2] x86/resctrl: Optimize code in rdt_get_tree()
2025-06-11 2:15 ` [PATCH 2/2] x86/resctrl: Optimize code in rdt_get_tree() Shaopeng Tan
@ 2025-06-11 20:36 ` kernel test robot
2025-06-12 18:23 ` Reinette Chatre
1 sibling, 0 replies; 7+ messages in thread
From: kernel test robot @ 2025-06-11 20:36 UTC (permalink / raw)
To: Shaopeng Tan, x86, linux-kernel
Cc: oe-kbuild-all, Reinette Chatre, James Morse, Yury Norov,
Dave Martin, fenghuay, peternewman, Babu Moger, Borislav Petkov,
shameerali.kolothum.thodi, bobo.shaobowang, D Scott Phillips OS,
carl, Koba Ko, Shanker Donthineni, Xin Hao, baolin.wang,
lcherian, amitsinght, Ingo Molnar, David Hildenbrand,
H Peter Anvin, Rex Nie, Jamie Iles, dfustini, Thomas Gleixner
Hi Shaopeng,
kernel test robot noticed the following build warnings:
[auto build test WARNING on tip/master]
[also build test WARNING on brauner-vfs/vfs.all linus/master v6.16-rc1 next-20250611]
[cannot apply to tip/auto-latest bp/for-next]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Shaopeng-Tan/x86-resctrl-Remove-unnecessary-cpumask_nth_andnot/20250611-104547
base: tip/master
patch link: https://lore.kernel.org/r/20250611021547.2766889-3-tan.shaopeng%40jp.fujitsu.com
patch subject: [PATCH 2/2] x86/resctrl: Optimize code in rdt_get_tree()
config: x86_64-randconfig-002-20250612 (https://download.01.org/0day-ci/archive/20250612/202506120440.lz9OAoXE-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250612/202506120440.lz9OAoXE-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202506120440.lz9OAoXE-lkp@intel.com/
All warnings (new ones prefixed by >>):
fs/resctrl/rdtgroup.c: In function 'rdt_get_tree':
>> fs/resctrl/rdtgroup.c:2684:1: warning: label 'out_ctx' defined but not used [-Wunused-label]
2684 | out_ctx:
| ^~~~~~~
vim +/out_ctx +2684 fs/resctrl/rdtgroup.c
7168ae330e8105 James Morse 2025-05-15 2583
7168ae330e8105 James Morse 2025-05-15 2584 static int rdt_get_tree(struct fs_context *fc)
7168ae330e8105 James Morse 2025-05-15 2585 {
7168ae330e8105 James Morse 2025-05-15 2586 struct rdt_fs_context *ctx = rdt_fc2context(fc);
7168ae330e8105 James Morse 2025-05-15 2587 unsigned long flags = RFTYPE_CTRL_BASE;
7168ae330e8105 James Morse 2025-05-15 2588 struct rdt_mon_domain *dom;
7168ae330e8105 James Morse 2025-05-15 2589 struct rdt_resource *r;
7168ae330e8105 James Morse 2025-05-15 2590 int ret;
7168ae330e8105 James Morse 2025-05-15 2591
7168ae330e8105 James Morse 2025-05-15 2592 cpus_read_lock();
7168ae330e8105 James Morse 2025-05-15 2593 mutex_lock(&rdtgroup_mutex);
7168ae330e8105 James Morse 2025-05-15 2594 /*
7168ae330e8105 James Morse 2025-05-15 2595 * resctrl file system can only be mounted once.
7168ae330e8105 James Morse 2025-05-15 2596 */
7168ae330e8105 James Morse 2025-05-15 2597 if (resctrl_mounted) {
7168ae330e8105 James Morse 2025-05-15 2598 ret = -EBUSY;
7168ae330e8105 James Morse 2025-05-15 2599 goto out;
7168ae330e8105 James Morse 2025-05-15 2600 }
7168ae330e8105 James Morse 2025-05-15 2601
7168ae330e8105 James Morse 2025-05-15 2602 ret = rdtgroup_setup_root(ctx);
7168ae330e8105 James Morse 2025-05-15 2603 if (ret)
7168ae330e8105 James Morse 2025-05-15 2604 goto out;
7168ae330e8105 James Morse 2025-05-15 2605
7168ae330e8105 James Morse 2025-05-15 2606 ret = rdt_enable_ctx(ctx);
7168ae330e8105 James Morse 2025-05-15 2607 if (ret)
7168ae330e8105 James Morse 2025-05-15 2608 goto out_root;
7168ae330e8105 James Morse 2025-05-15 2609
7168ae330e8105 James Morse 2025-05-15 2610 ret = schemata_list_create();
b67b139e5b652e Shaopeng Tan 2025-06-11 2611 if (ret)
b67b139e5b652e Shaopeng Tan 2025-06-11 2612 goto out_schemata_free;
7168ae330e8105 James Morse 2025-05-15 2613
7168ae330e8105 James Morse 2025-05-15 2614 ret = closid_init();
7168ae330e8105 James Morse 2025-05-15 2615 if (ret)
7168ae330e8105 James Morse 2025-05-15 2616 goto out_schemata_free;
7168ae330e8105 James Morse 2025-05-15 2617
7168ae330e8105 James Morse 2025-05-15 2618 if (resctrl_arch_mon_capable())
7168ae330e8105 James Morse 2025-05-15 2619 flags |= RFTYPE_MON;
7168ae330e8105 James Morse 2025-05-15 2620
7168ae330e8105 James Morse 2025-05-15 2621 ret = rdtgroup_add_files(rdtgroup_default.kn, flags);
7168ae330e8105 James Morse 2025-05-15 2622 if (ret)
7168ae330e8105 James Morse 2025-05-15 2623 goto out_closid_exit;
7168ae330e8105 James Morse 2025-05-15 2624
7168ae330e8105 James Morse 2025-05-15 2625 kernfs_activate(rdtgroup_default.kn);
7168ae330e8105 James Morse 2025-05-15 2626
7168ae330e8105 James Morse 2025-05-15 2627 ret = rdtgroup_create_info_dir(rdtgroup_default.kn);
7168ae330e8105 James Morse 2025-05-15 2628 if (ret < 0)
7168ae330e8105 James Morse 2025-05-15 2629 goto out_closid_exit;
7168ae330e8105 James Morse 2025-05-15 2630
7168ae330e8105 James Morse 2025-05-15 2631 if (resctrl_arch_mon_capable()) {
7168ae330e8105 James Morse 2025-05-15 2632 ret = mongroup_create_dir(rdtgroup_default.kn,
7168ae330e8105 James Morse 2025-05-15 2633 &rdtgroup_default, "mon_groups",
7168ae330e8105 James Morse 2025-05-15 2634 &kn_mongrp);
7168ae330e8105 James Morse 2025-05-15 2635 if (ret < 0)
7168ae330e8105 James Morse 2025-05-15 2636 goto out_info;
7168ae330e8105 James Morse 2025-05-15 2637
7168ae330e8105 James Morse 2025-05-15 2638 ret = mkdir_mondata_all(rdtgroup_default.kn,
7168ae330e8105 James Morse 2025-05-15 2639 &rdtgroup_default, &kn_mondata);
7168ae330e8105 James Morse 2025-05-15 2640 if (ret < 0)
7168ae330e8105 James Morse 2025-05-15 2641 goto out_mongrp;
7168ae330e8105 James Morse 2025-05-15 2642 rdtgroup_default.mon.mon_data_kn = kn_mondata;
7168ae330e8105 James Morse 2025-05-15 2643 }
7168ae330e8105 James Morse 2025-05-15 2644
7168ae330e8105 James Morse 2025-05-15 2645 ret = rdt_pseudo_lock_init();
7168ae330e8105 James Morse 2025-05-15 2646 if (ret)
7168ae330e8105 James Morse 2025-05-15 2647 goto out_mondata;
7168ae330e8105 James Morse 2025-05-15 2648
7168ae330e8105 James Morse 2025-05-15 2649 ret = kernfs_get_tree(fc);
7168ae330e8105 James Morse 2025-05-15 2650 if (ret < 0)
7168ae330e8105 James Morse 2025-05-15 2651 goto out_psl;
7168ae330e8105 James Morse 2025-05-15 2652
7168ae330e8105 James Morse 2025-05-15 2653 if (resctrl_arch_alloc_capable())
7168ae330e8105 James Morse 2025-05-15 2654 resctrl_arch_enable_alloc();
7168ae330e8105 James Morse 2025-05-15 2655 if (resctrl_arch_mon_capable())
7168ae330e8105 James Morse 2025-05-15 2656 resctrl_arch_enable_mon();
7168ae330e8105 James Morse 2025-05-15 2657
7168ae330e8105 James Morse 2025-05-15 2658 if (resctrl_arch_alloc_capable() || resctrl_arch_mon_capable())
7168ae330e8105 James Morse 2025-05-15 2659 resctrl_mounted = true;
7168ae330e8105 James Morse 2025-05-15 2660
7168ae330e8105 James Morse 2025-05-15 2661 if (resctrl_is_mbm_enabled()) {
7168ae330e8105 James Morse 2025-05-15 2662 r = resctrl_arch_get_resource(RDT_RESOURCE_L3);
7168ae330e8105 James Morse 2025-05-15 2663 list_for_each_entry(dom, &r->mon_domains, hdr.list)
7168ae330e8105 James Morse 2025-05-15 2664 mbm_setup_overflow_handler(dom, MBM_OVERFLOW_INTERVAL,
7168ae330e8105 James Morse 2025-05-15 2665 RESCTRL_PICK_ANY_CPU);
7168ae330e8105 James Morse 2025-05-15 2666 }
7168ae330e8105 James Morse 2025-05-15 2667
7168ae330e8105 James Morse 2025-05-15 2668 goto out;
7168ae330e8105 James Morse 2025-05-15 2669
7168ae330e8105 James Morse 2025-05-15 2670 out_psl:
7168ae330e8105 James Morse 2025-05-15 2671 rdt_pseudo_lock_release();
7168ae330e8105 James Morse 2025-05-15 2672 out_mondata:
7168ae330e8105 James Morse 2025-05-15 2673 if (resctrl_arch_mon_capable())
7168ae330e8105 James Morse 2025-05-15 2674 kernfs_remove(kn_mondata);
7168ae330e8105 James Morse 2025-05-15 2675 out_mongrp:
7168ae330e8105 James Morse 2025-05-15 2676 if (resctrl_arch_mon_capable())
7168ae330e8105 James Morse 2025-05-15 2677 kernfs_remove(kn_mongrp);
7168ae330e8105 James Morse 2025-05-15 2678 out_info:
7168ae330e8105 James Morse 2025-05-15 2679 kernfs_remove(kn_info);
7168ae330e8105 James Morse 2025-05-15 2680 out_closid_exit:
7168ae330e8105 James Morse 2025-05-15 2681 closid_exit();
7168ae330e8105 James Morse 2025-05-15 2682 out_schemata_free:
7168ae330e8105 James Morse 2025-05-15 2683 schemata_list_destroy();
7168ae330e8105 James Morse 2025-05-15 @2684 out_ctx:
7168ae330e8105 James Morse 2025-05-15 2685 rdt_disable_ctx();
7168ae330e8105 James Morse 2025-05-15 2686 out_root:
7168ae330e8105 James Morse 2025-05-15 2687 rdtgroup_destroy_root();
7168ae330e8105 James Morse 2025-05-15 2688 out:
7168ae330e8105 James Morse 2025-05-15 2689 rdt_last_cmd_clear();
7168ae330e8105 James Morse 2025-05-15 2690 mutex_unlock(&rdtgroup_mutex);
7168ae330e8105 James Morse 2025-05-15 2691 cpus_read_unlock();
7168ae330e8105 James Morse 2025-05-15 2692 return ret;
7168ae330e8105 James Morse 2025-05-15 2693 }
7168ae330e8105 James Morse 2025-05-15 2694
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] x86/resctrl: Remove unnecessary cpumask_nth_andnot()
2025-06-11 2:15 ` [PATCH 1/2] x86/resctrl: Remove unnecessary cpumask_nth_andnot() Shaopeng Tan
@ 2025-06-12 18:23 ` Reinette Chatre
0 siblings, 0 replies; 7+ messages in thread
From: Reinette Chatre @ 2025-06-12 18:23 UTC (permalink / raw)
To: Shaopeng Tan, x86, linux-kernel
Cc: James Morse, Yury Norov, Dave Martin, fenghuay, peternewman,
Babu Moger, Borislav Petkov, shameerali.kolothum.thodi,
bobo.shaobowang, D Scott Phillips OS, carl, Koba Ko,
Shanker Donthineni, Xin Hao, baolin.wang, lcherian, amitsinght,
Ingo Molnar, David Hildenbrand, H Peter Anvin, Rex Nie,
Jamie Iles, dfustini, Thomas Gleixner
Hi Shaopeng,
The subject contains "x86/resctrl" but the change is actually to
the kernel's bitmap API. Please split this patch from this series and
submit it by itself so that it can be routed correctly (separate from the
resctrl change).
You can use "git log include/linux/cpumask.h" to see how other
patches to the area are formatted. To start it looks like
the subject should have "cpumask:" prefix.
When submitting it upstream it should be routed to:
$ ./scripts/get_maintainer.pl include/linux/cpumask.h
Yury Norov <yury.norov@gmail.com> (maintainer:BITMAP API)
Rasmus Villemoes <linux@rasmusvillemoes.dk> (reviewer:BITMAP API)
linux-kernel@vger.kernel.org (open list)
On 6/10/25 7:15 PM, Shaopeng Tan wrote:
> In commit 94f753143028("x86/resctrl: Optimize cpumask_any_housekeeping()"),
> cpumask_any_andnot_but() replaced cpumask_nth_andnot(),
nit: saying "cpumask_any_andnot_but() replaced cpumask_nth_andnot()" sounds
as though cpumask_any_andnot_but() is a different implementation to accomplish
what cpumask_nth_andnot() does. I do not believe this is the case, for example,
cpumask_any_andnot_but() receives as parameter a CPU to ignore that is not
supported by cpumask_nth_andnot().
I think the main point is that the identified commit switched the only
user of cpumask_nth_andnot() to other cpumask functions, leaving
cpumask_nth_andnot() unused.
> but left the function cpumask_nth_andnot() unused, delete it.
>
> Signed-off-by: Shaopeng Tan <tan.shaopeng@jp.fujitsu.com>
> ---
> include/linux/cpumask.h | 16 ----------------
> 1 file changed, 16 deletions(-)
>
> diff --git a/include/linux/cpumask.h b/include/linux/cpumask.h
> index 7ae80a7ca81e..498790f74fa8 100644
> --- a/include/linux/cpumask.h
> +++ b/include/linux/cpumask.h
> @@ -546,22 +546,6 @@ unsigned int cpumask_nth_and(unsigned int cpu, const struct cpumask *srcp1,
> small_cpumask_bits, cpumask_check(cpu));
> }
>
> -/**
> - * cpumask_nth_andnot - get the Nth cpu set in 1st cpumask, and clear in 2nd.
> - * @srcp1: the cpumask pointer
> - * @srcp2: the cpumask pointer
> - * @cpu: the Nth cpu to find, starting from 0
> - *
> - * Return: >= nr_cpu_ids if such cpu doesn't exist.
> - */
> -static __always_inline
> -unsigned int cpumask_nth_andnot(unsigned int cpu, const struct cpumask *srcp1,
> - const struct cpumask *srcp2)
> -{
> - return find_nth_andnot_bit(cpumask_bits(srcp1), cpumask_bits(srcp2),
> - small_cpumask_bits, cpumask_check(cpu));
> -}
> -
> /**
> * cpumask_nth_and_andnot - get the Nth cpu set in 1st and 2nd cpumask, and clear in 3rd.
> * @srcp1: the cpumask pointer
Patch looks good to me. Thank you.
Reinette
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 2/2] x86/resctrl: Optimize code in rdt_get_tree()
2025-06-11 2:15 ` [PATCH 2/2] x86/resctrl: Optimize code in rdt_get_tree() Shaopeng Tan
2025-06-11 20:36 ` kernel test robot
@ 2025-06-12 18:23 ` Reinette Chatre
2025-06-12 18:26 ` Reinette Chatre
1 sibling, 1 reply; 7+ messages in thread
From: Reinette Chatre @ 2025-06-12 18:23 UTC (permalink / raw)
To: Shaopeng Tan, x86, linux-kernel
Cc: James Morse, Yury Norov, Dave Martin, fenghuay, peternewman,
Babu Moger, Borislav Petkov, shameerali.kolothum.thodi,
bobo.shaobowang, D Scott Phillips OS, carl, Koba Ko,
Shanker Donthineni, Xin Hao, baolin.wang, lcherian, amitsinght,
Ingo Molnar, David Hildenbrand, H Peter Anvin, Rex Nie,
Jamie Iles, dfustini, Thomas Gleixner
Hi Shaopeng,
On 6/10/25 7:15 PM, Shaopeng Tan wrote:
> Inconsistent context format. Optimize it,
What does "Inconsistent context format" mean?
> not only save a line and also make it easier to understand.
The changelog needs to follow rules found in "Changelog"
section of Documentation/process/maintainer-tip.rst.
Here is an example:
schemata_list_destroy() has to be called if
schemata_list_create() fails.
rdt_get_tree() calls schemata_list_destroy() in two different
ways: directly if schemata_list_create() itself fails and on
the exit path via the out_schemata_free goto label.
Remove schemata_list_destroy() call on schemata_list_create()
failure. Use existing out_schemata_free goto label instead.
>
> Signed-off-by: Shaopeng Tan <tan.shaopeng@jp.fujitsu.com>
> ---
> fs/resctrl/rdtgroup.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/fs/resctrl/rdtgroup.c b/fs/resctrl/rdtgroup.c
> index 1beb124e25f6..8bf87211eadb 100644
> --- a/fs/resctrl/rdtgroup.c
> +++ b/fs/resctrl/rdtgroup.c
> @@ -2608,10 +2608,8 @@ static int rdt_get_tree(struct fs_context *fc)
> goto out_root;
>
> ret = schemata_list_create();
> - if (ret) {
> - schemata_list_destroy();
> - goto out_ctx;
> - }
> + if (ret)
> + goto out_schemata_free;
>
> ret = closid_init();
> if (ret)
Please address the issue of now unused "out_ctx" label reported
in [1]. Looks good to me otherwise.
Thank you for the cleanup.
Reinette
[1] https://lore.kernel.org/lkml/202506120440.lz9OAoXE-lkp@intel.com/
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 2/2] x86/resctrl: Optimize code in rdt_get_tree()
2025-06-12 18:23 ` Reinette Chatre
@ 2025-06-12 18:26 ` Reinette Chatre
0 siblings, 0 replies; 7+ messages in thread
From: Reinette Chatre @ 2025-06-12 18:26 UTC (permalink / raw)
To: Shaopeng Tan, x86, linux-kernel
Cc: James Morse, Yury Norov, Dave Martin, fenghuay, peternewman,
Babu Moger, Borislav Petkov, shameerali.kolothum.thodi,
bobo.shaobowang, D Scott Phillips OS, carl, Koba Ko,
Shanker Donthineni, Xin Hao, baolin.wang, lcherian, amitsinght,
Ingo Molnar, David Hildenbrand, H Peter Anvin, Rex Nie,
Jamie Iles, dfustini, Thomas Gleixner
Hi Shaopeng,
One small follow-up ... since this is a resctrl fs change,
could you please switch prefix to be "fs/resctrl"?
Thank you
Reinette
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2025-06-12 18:26 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-06-11 2:15 [PATCH 0/2] x86/resctrl: Optimize some resctrl code Shaopeng Tan
2025-06-11 2:15 ` [PATCH 1/2] x86/resctrl: Remove unnecessary cpumask_nth_andnot() Shaopeng Tan
2025-06-12 18:23 ` Reinette Chatre
2025-06-11 2:15 ` [PATCH 2/2] x86/resctrl: Optimize code in rdt_get_tree() Shaopeng Tan
2025-06-11 20:36 ` kernel test robot
2025-06-12 18:23 ` Reinette Chatre
2025-06-12 18:26 ` Reinette Chatre
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®