* [PATCH] cpumask: Remove unnecessary cpumask_nth_andnot()
@ 2025-06-13 7:37 Shaopeng Tan
2025-06-13 7:37 ` [PATCH] fs/resctrl: Optimize code in rdt_get_tree() Shaopeng Tan
2025-06-21 14:40 ` [PATCH] cpumask: Remove unnecessary cpumask_nth_andnot() Yury Norov
0 siblings, 2 replies; 5+ messages in thread
From: Shaopeng Tan @ 2025-06-13 7:37 UTC (permalink / raw)
To: linux-kernel, Yury Norov, Rasmus Villemoes
Cc: Reinette Chatre, James Morse, Dave Martin, fenghuay
Commit 94f753143028("x86/resctrl: Optimize cpumask_any_housekeeping()")
switched the only user of cpumask_nth_andnot() to other cpumask functions,
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 related [flat|nested] 5+ messages in thread* [PATCH] fs/resctrl: Optimize code in rdt_get_tree() 2025-06-13 7:37 [PATCH] cpumask: Remove unnecessary cpumask_nth_andnot() Shaopeng Tan @ 2025-06-13 7:37 ` Shaopeng Tan 2025-06-13 16:57 ` James Morse 2025-06-13 18:01 ` Reinette Chatre 2025-06-21 14:40 ` [PATCH] cpumask: Remove unnecessary cpumask_nth_andnot() Yury Norov 1 sibling, 2 replies; 5+ messages in thread From: Shaopeng Tan @ 2025-06-13 7:37 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 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 | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/fs/resctrl/rdtgroup.c b/fs/resctrl/rdtgroup.c index 1beb124e25f6..592d4f69fce9 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) @@ -2683,7 +2681,6 @@ static int rdt_get_tree(struct fs_context *fc) closid_exit(); out_schemata_free: schemata_list_destroy(); -out_ctx: rdt_disable_ctx(); out_root: rdtgroup_destroy_root(); -- 2.43.5 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] fs/resctrl: Optimize code in rdt_get_tree() 2025-06-13 7:37 ` [PATCH] fs/resctrl: Optimize code in rdt_get_tree() Shaopeng Tan @ 2025-06-13 16:57 ` James Morse 2025-06-13 18:01 ` Reinette Chatre 1 sibling, 0 replies; 5+ messages in thread From: James Morse @ 2025-06-13 16:57 UTC (permalink / raw) To: Shaopeng Tan, x86, linux-kernel Cc: Reinette Chatre, 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! On 13/06/2025 08:37, Shaopeng Tan wrote: > 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. Reviewed-by: James Morse <james.morse@arm.com> Thanks, James ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] fs/resctrl: Optimize code in rdt_get_tree() 2025-06-13 7:37 ` [PATCH] fs/resctrl: Optimize code in rdt_get_tree() Shaopeng Tan 2025-06-13 16:57 ` James Morse @ 2025-06-13 18:01 ` Reinette Chatre 1 sibling, 0 replies; 5+ messages in thread From: Reinette Chatre @ 2025-06-13 18:01 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/13/25 12:37 AM, Shaopeng Tan wrote: > 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 | 7 ++----- > 1 file changed, 2 insertions(+), 5 deletions(-) > > diff --git a/fs/resctrl/rdtgroup.c b/fs/resctrl/rdtgroup.c > index 1beb124e25f6..592d4f69fce9 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) > @@ -2683,7 +2681,6 @@ static int rdt_get_tree(struct fs_context *fc) > closid_exit(); > out_schemata_free: > schemata_list_destroy(); > -out_ctx: > rdt_disable_ctx(); > out_root: > rdtgroup_destroy_root(); Could you please resubmit this independently? That is, not in an email thread with the cpumask patch? With that: | Reviewed-by: Reinette Chatre <reinette.chatre@intel.com> Thank you very much. Reinette ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] cpumask: Remove unnecessary cpumask_nth_andnot() 2025-06-13 7:37 [PATCH] cpumask: Remove unnecessary cpumask_nth_andnot() Shaopeng Tan 2025-06-13 7:37 ` [PATCH] fs/resctrl: Optimize code in rdt_get_tree() Shaopeng Tan @ 2025-06-21 14:40 ` Yury Norov 1 sibling, 0 replies; 5+ messages in thread From: Yury Norov @ 2025-06-21 14:40 UTC (permalink / raw) To: Shaopeng Tan Cc: linux-kernel, Rasmus Villemoes, Reinette Chatre, James Morse, Dave Martin, fenghuay On Fri, Jun 13, 2025 at 04:37:30PM +0900, Shaopeng Tan wrote: > Commit 94f753143028("x86/resctrl: Optimize cpumask_any_housekeeping()") > switched the only user of cpumask_nth_andnot() to other cpumask functions, > but left the function cpumask_nth_andnot() unused, delete it. > > Signed-off-by: Shaopeng Tan <tan.shaopeng@jp.fujitsu.com> This makes find_nth_andnot_bit() unused as well. Can you send a v2 that removes both? Also, the following patch in the series doesn't look relevant. Can you send it separately? Thanks, Yury > --- > 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] 5+ messages in thread
end of thread, other threads:[~2025-06-21 14:40 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2025-06-13 7:37 [PATCH] cpumask: Remove unnecessary cpumask_nth_andnot() Shaopeng Tan 2025-06-13 7:37 ` [PATCH] fs/resctrl: Optimize code in rdt_get_tree() Shaopeng Tan 2025-06-13 16:57 ` James Morse 2025-06-13 18:01 ` Reinette Chatre 2025-06-21 14:40 ` [PATCH] cpumask: Remove unnecessary cpumask_nth_andnot() Yury Norov
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.