* [PATCH v2] refperf: Remove redundant kfree() after torture_stop_kthread()
@ 2025-09-10 15:14 Kaushlendra Kumar
2025-09-10 16:05 ` Paul E. McKenney
0 siblings, 1 reply; 2+ messages in thread
From: Kaushlendra Kumar @ 2025-09-10 15:14 UTC (permalink / raw)
To: dave, paulmck, josh, frederic, neeraj.upadhyay, rostedt
Cc: linux-kernel, rcu, Kaushlendra Kumar
Remove unnecessary kfree(main_task) call in ref_scale_cleanup() as
torture_stop_kthread() already handles the memory cleanup for the
task structure internally.
The additional kfree(main_task) call after torture_stop_kthread()
is redundant and confusing since torture_stop_kthread() sets the
pointer to NULL, making this a no-op.
This pattern is consistent with other torture test modules where
torture_stop_kthread() is called without explicit kfree() of the
task pointer, as the torture framework manages the task lifecycle
internally.
Signed-off-by: Kaushlendra Kumar <kaushlendra.kumar@intel.com>
---
Changes in v2:
- Corrected commit message based on review feedback
kernel/rcu/refscale.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/kernel/rcu/refscale.c b/kernel/rcu/refscale.c
index 2c2648a3ad30..2bfa987f4ba9 100644
--- a/kernel/rcu/refscale.c
+++ b/kernel/rcu/refscale.c
@@ -1050,7 +1050,6 @@ ref_scale_cleanup(void)
kfree(reader_tasks);
torture_stop_kthread("main_task", main_task);
- kfree(main_task);
// Do scale-type-specific cleanup operations.
if (cur_ops->cleanup != NULL)
--
2.34.1
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH v2] refperf: Remove redundant kfree() after torture_stop_kthread()
2025-09-10 15:14 [PATCH v2] refperf: Remove redundant kfree() after torture_stop_kthread() Kaushlendra Kumar
@ 2025-09-10 16:05 ` Paul E. McKenney
0 siblings, 0 replies; 2+ messages in thread
From: Paul E. McKenney @ 2025-09-10 16:05 UTC (permalink / raw)
To: Kaushlendra Kumar
Cc: dave, josh, frederic, neeraj.upadhyay, rostedt, linux-kernel, rcu
On Wed, Sep 10, 2025 at 08:44:19PM +0530, Kaushlendra Kumar wrote:
> Remove unnecessary kfree(main_task) call in ref_scale_cleanup() as
> torture_stop_kthread() already handles the memory cleanup for the
> task structure internally.
>
> The additional kfree(main_task) call after torture_stop_kthread()
> is redundant and confusing since torture_stop_kthread() sets the
> pointer to NULL, making this a no-op.
>
> This pattern is consistent with other torture test modules where
> torture_stop_kthread() is called without explicit kfree() of the
> task pointer, as the torture framework manages the task lifecycle
> internally.
>
> Signed-off-by: Kaushlendra Kumar <kaushlendra.kumar@intel.com>
Queued for further review and testing, thank you!
Thanx, Paul
> ---
> Changes in v2:
> - Corrected commit message based on review feedback
>
> kernel/rcu/refscale.c | 1 -
> 1 file changed, 1 deletion(-)
>
> diff --git a/kernel/rcu/refscale.c b/kernel/rcu/refscale.c
> index 2c2648a3ad30..2bfa987f4ba9 100644
> --- a/kernel/rcu/refscale.c
> +++ b/kernel/rcu/refscale.c
> @@ -1050,7 +1050,6 @@ ref_scale_cleanup(void)
> kfree(reader_tasks);
>
> torture_stop_kthread("main_task", main_task);
> - kfree(main_task);
>
> // Do scale-type-specific cleanup operations.
> if (cur_ops->cleanup != NULL)
> --
> 2.34.1
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-09-10 16:05 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-09-10 15:14 [PATCH v2] refperf: Remove redundant kfree() after torture_stop_kthread() Kaushlendra Kumar
2025-09-10 16:05 ` Paul E. McKenney
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®