linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: SeongJae Park <sj@kernel.org>
To: Xin Hao <xhao@linux.alibaba.com>
Cc: sj@kernel.org, akpm@linux-foundation.org, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mm/damon/sysfs: remove repeat container_of() in damon_sysfs_kdamond_release()
Date: Thu,  3 Mar 2022 08:42:35 +0000	[thread overview]
Message-ID: <20220303084235.356-1-sj@kernel.org> (raw)
In-Reply-To: <20220303075314.22502-1-xhao@linux.alibaba.com>

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


      reply	other threads:[~2022-03-03  8:42 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-03  7:53 Xin Hao
2022-03-03  8:42 ` SeongJae Park [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220303084235.356-1-sj@kernel.org \
    --to=sj@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=xhao@linux.alibaba.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox