* [PATCH v2] fs/resctrl: Optimize code in rdt_get_tree()
@ 2025-06-23 7:50 Shaopeng Tan
2025-06-24 3:51 ` Koba Ko
2025-08-18 9:50 ` [tip: x86/cache] " tip-bot2 for Shaopeng Tan
0 siblings, 2 replies; 6+ messages in thread
From: Shaopeng Tan @ 2025-06-23 7:50 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>
Reviewed-by: Reinette Chatre <reinette.chatre@intel.com>
Reviewed-by: James Morse <james.morse@arm.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 77d08229d855..5f0b7cfa1cc2 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 [flat|nested] 6+ messages in thread
* Re: [PATCH v2] fs/resctrl: Optimize code in rdt_get_tree()
2025-06-23 7:50 [PATCH v2] fs/resctrl: Optimize code in rdt_get_tree() Shaopeng Tan
@ 2025-06-24 3:51 ` Koba Ko
2025-07-18 5:54 ` Shaopeng Tan (Fujitsu)
2025-08-18 9:50 ` [tip: x86/cache] " tip-bot2 for Shaopeng Tan
1 sibling, 1 reply; 6+ messages in thread
From: Koba Ko @ 2025-06-24 3:51 UTC (permalink / raw)
To: Shaopeng Tan, 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, Shanker Donthineni, Xin Hao, baolin.wang, lcherian,
amitsinght, Ingo Molnar, David Hildenbrand, H Peter Anvin,
Rex Nie, Jamie Iles, dfustini, Thomas Gleixner
Thanks
Reviewed-by: Koba Ko <kobak@nvidia.com>
On 6/23/25 15:50, Shaopeng Tan wrote:
> External email: Use caution opening links or attachments
>
>
> 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>
> Reviewed-by: Reinette Chatre <reinette.chatre@intel.com>
> Reviewed-by: James Morse <james.morse@arm.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 77d08229d855..5f0b7cfa1cc2 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 [flat|nested] 6+ messages in thread
* RE: [PATCH v2] fs/resctrl: Optimize code in rdt_get_tree()
2025-06-24 3:51 ` Koba Ko
@ 2025-07-18 5:54 ` Shaopeng Tan (Fujitsu)
0 siblings, 0 replies; 6+ messages in thread
From: Shaopeng Tan (Fujitsu) @ 2025-07-18 5:54 UTC (permalink / raw)
To: 'Koba Ko', 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, Shanker Donthineni, Xin Hao, baolin.wang, lcherian,
amitsinght, Ingo Molnar, David Hildenbrand, H Peter Anvin,
Rex Nie, Jamie Iles, dfustini, Thomas Gleixner
Hello Koba Ko,
>
> Thanks
> Reviewed-by: Koba Ko <kobak@nvidia.com>
Thanks for your review.
> On 6/23/25 15:50, Shaopeng Tan wrote:
> > External email: Use caution opening links or attachments
> >
> >
> > 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>
> > Reviewed-by: Reinette Chatre <reinette.chatre@intel.com>
> > Reviewed-by: James Morse <james.morse@arm.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
> > 77d08229d855..5f0b7cfa1cc2 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 [flat|nested] 6+ messages in thread
* [tip: x86/cache] fs/resctrl: Optimize code in rdt_get_tree()
2025-06-23 7:50 [PATCH v2] fs/resctrl: Optimize code in rdt_get_tree() Shaopeng Tan
2025-06-24 3:51 ` Koba Ko
@ 2025-08-18 9:50 ` tip-bot2 for Shaopeng Tan
1 sibling, 0 replies; 6+ messages in thread
From: tip-bot2 for Shaopeng Tan @ 2025-08-18 9:50 UTC (permalink / raw)
To: linux-tip-commits
Cc: Shaopeng Tan, Borislav Petkov (AMD),
Reinette Chatre, James Morse, Koba Ko, x86, linux-kernel
The following commit has been merged into the x86/cache branch of tip:
Commit-ID: b470929e21393f37cae51a922ef319a753273719
Gitweb: https://git.kernel.org/tip/b470929e21393f37cae51a922ef319a753273719
Author: Shaopeng Tan <tan.shaopeng@jp.fujitsu.com>
AuthorDate: Mon, 23 Jun 2025 16:50:50 +09:00
Committer: Borislav Petkov (AMD) <bp@alien8.de>
CommitterDate: Mon, 18 Aug 2025 11:34:29 +02:00
fs/resctrl: Optimize code in rdt_get_tree()
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>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Reviewed-by: Reinette Chatre <reinette.chatre@intel.com>
Reviewed-by: James Morse <james.morse@arm.com>
Reviewed-by: Koba Ko <kobak@nvidia.com>
Link: https://lore.kernel.org/20250623075051.3610592-1-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 77d0822..5f0b7cf 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 @@ out_closid_exit:
closid_exit();
out_schemata_free:
schemata_list_destroy();
-out_ctx:
rdt_disable_ctx();
out_root:
rdtgroup_destroy_root();
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2] fs/resctrl: Optimize code in rdt_get_tree()
2025-07-18 5:55 ` [PATCH v2] " Shaopeng Tan (Fujitsu)
@ 2025-07-18 15:48 ` Reinette Chatre
0 siblings, 0 replies; 6+ messages in thread
From: Reinette Chatre @ 2025-07-18 15:48 UTC (permalink / raw)
To: Shaopeng Tan (Fujitsu), 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, Shanker Donthineni,
Xin Hao, baolin.wang, lcherian, amitsinght, Ingo Molnar,
David Hildenbrand, H Peter Anvin, Rex Nie, Jamie Iles, dfustini,
Thomas Gleixner, 'Koba Ko'
Hi Shaopeng,
On 7/17/25 10:55 PM, Shaopeng Tan (Fujitsu) wrote:
> Hello Reinette,
>
> Do you have any other comments?
>
No other comments from my side. I expect that you are wondering why this
has not been merged yet. It does take some effort from multiple folks to
get a patch upstream. At this time this is the only pending resctrl change
that is ready for inclusion via tip. When I considered its impact on
resctrl together with effort to get it merged I decided to hold it back
to be included with other resctrl changes that are being polished at the
moment. Please let me know if I missed something and this work should
actually be handled with more urgency.
Reinette
^ permalink raw reply [flat|nested] 6+ messages in thread
* RE: [PATCH v2] fs/resctrl: Optimize code in rdt_get_tree()
[not found] <20250623073154.3320458-1-tan.shaopeng@jp.fujitsu.com>
@ 2025-07-18 5:55 ` Shaopeng Tan (Fujitsu)
2025-07-18 15:48 ` Reinette Chatre
0 siblings, 1 reply; 6+ messages in thread
From: Shaopeng Tan (Fujitsu) @ 2025-07-18 5:55 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, Shanker Donthineni, Xin Hao, baolin.wang, lcherian,
amitsinght, Ingo Molnar, David Hildenbrand, H Peter Anvin,
Rex Nie, Jamie Iles, dfustini, Thomas Gleixner, 'Koba Ko',
x86, linux-kernel
Hello Reinette,
Do you have any other comments?
> 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>
> Reviewed-by: Reinette Chatre <reinette.chatre@intel.com>
> Reviewed-by: James Morse <james.morse@arm.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
> 77d08229d855..5f0b7cfa1cc2 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 [flat|nested] 6+ messages in thread
end of thread, other threads:[~2025-08-18 9:50 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-06-23 7:50 [PATCH v2] fs/resctrl: Optimize code in rdt_get_tree() Shaopeng Tan
2025-06-24 3:51 ` Koba Ko
2025-07-18 5:54 ` Shaopeng Tan (Fujitsu)
2025-08-18 9:50 ` [tip: x86/cache] " tip-bot2 for Shaopeng Tan
[not found] <20250623073154.3320458-1-tan.shaopeng@jp.fujitsu.com>
2025-07-18 5:55 ` [PATCH v2] " Shaopeng Tan (Fujitsu)
2025-07-18 15:48 ` 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®