* [PATCH] mm/damon/sysfs: remove repeat container_of() in damon_sysfs_kdamond_release()
@ 2022-03-03 7:53 Xin Hao
2022-03-03 8:42 ` SeongJae Park
0 siblings, 1 reply; 2+ messages in thread
From: Xin Hao @ 2022-03-03 7:53 UTC (permalink / raw)
To: sj; +Cc: xhao, akpm, linux-mm, linux-kernel
In damon_sysfs_kdamond_release(), we have use container_of() to get
"kdamond" pointer, so there no need to get it once again.
Signed-off-by: Xin Hao <xhao@linux.alibaba.com>
---
mm/damon/sysfs.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mm/damon/sysfs.c b/mm/damon/sysfs.c
index a4ad6b473b0a..687e7c7e8dea 100644
--- a/mm/damon/sysfs.c
+++ b/mm/damon/sysfs.c
@@ -2432,7 +2432,7 @@ static void damon_sysfs_kdamond_release(struct kobject *kobj)
if (kdamond->damon_ctx)
damon_destroy_ctx(kdamond->damon_ctx);
- kfree(container_of(kobj, struct damon_sysfs_kdamond, kobj));
+ kfree(kdamond);
}
static struct kobj_attribute damon_sysfs_kdamond_state_attr =
--
2.27.0
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] mm/damon/sysfs: remove repeat container_of() in damon_sysfs_kdamond_release()
2022-03-03 7:53 [PATCH] mm/damon/sysfs: remove repeat container_of() in damon_sysfs_kdamond_release() Xin Hao
@ 2022-03-03 8:42 ` SeongJae Park
0 siblings, 0 replies; 2+ messages in thread
From: SeongJae Park @ 2022-03-03 8:42 UTC (permalink / raw)
To: Xin Hao; +Cc: sj, akpm, linux-mm, linux-kernel
Hi Xin,
On Thu, 3 Mar 2022 15:53:14 +0800 Xin Hao <xhao@linux.alibaba.com> wrote:
> In damon_sysfs_kdamond_release(), we have use container_of() to get
> "kdamond" pointer, so there no need to get it once again.
Good catch! Thank you always :)
>
> Signed-off-by: Xin Hao <xhao@linux.alibaba.com>
Reviewed-by: SeongJae Park <sj@kernel.org>
Thanks,
SJ
> ---
> mm/damon/sysfs.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/mm/damon/sysfs.c b/mm/damon/sysfs.c
> index a4ad6b473b0a..687e7c7e8dea 100644
> --- a/mm/damon/sysfs.c
> +++ b/mm/damon/sysfs.c
> @@ -2432,7 +2432,7 @@ static void damon_sysfs_kdamond_release(struct kobject *kobj)
>
> if (kdamond->damon_ctx)
> damon_destroy_ctx(kdamond->damon_ctx);
> - kfree(container_of(kobj, struct damon_sysfs_kdamond, kobj));
> + kfree(kdamond);
> }
>
> static struct kobj_attribute damon_sysfs_kdamond_state_attr =
> --
> 2.27.0
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-03-03 8:42 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-03 7:53 [PATCH] mm/damon/sysfs: remove repeat container_of() in damon_sysfs_kdamond_release() Xin Hao
2022-03-03 8:42 ` SeongJae Park
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox