public inbox for cgroups@vger.kernel.org
 help / color / mirror / Atom feed
From: Tejun Heo <tj@kernel.org>
To: Abel Wu <wuyun.abel@bytedance.com>
Cc: Chuyi Zhou <zhouchuyi@bytedance.com>,
	cgroups@vger.kernel.org, longman@redhat.com, tj@kernel.orgv,
	hughd@google.com, hezhongkun.hzk@bytedance.com,
	chenying.kernel@bytedance.com, zhanghaoyu.zhy@bytedance.com
Subject: Re: Re: [problem] Hung task caused by memory migration when cpuset.mems changes
Date: Thu, 28 Mar 2024 07:19:38 -1000	[thread overview]
Message-ID: <ZgWmqmIXwdN43cUl@slm.duckdns.org> (raw)
In-Reply-To: <232747d6-2c39-4e2b-879e-9ac12445d488@bytedance.com>

On Thu, Mar 28, 2024 at 03:53:30PM +0800, Abel Wu wrote:
> > +static int schedule_flush_migrate_mm(void)
> > +{
> > +	struct callback_head *flush_cb;
> > +
> > +	flush_cb = kzalloc(sizeof(*flush_cb), GFP_KERNEL);
> > +	if (!flush_cb)
> > +		return -ENOMEM;
> > +
> > +	flush_cb->func = flush_migrate_mm_task_workfn;
> > +	if (task_work_add(current, flush_cb, TWA_RESUME))
> > +		kfree(flush_cb);
> 
> It seems we will lose track of flush_cb and causes memleak here. Did I miss
> anything?

Oops, yeah, the work item needs to free itself. Thanks for spotting it.

-- 
tejun

      reply	other threads:[~2024-03-28 17:19 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-25 14:46 [problem] Hung task caused by memory migration when cpuset.mems changes Chuyi Zhou
2024-03-26 17:26 ` Tejun Heo
2024-03-27 14:07   ` Chuyi Zhou
2024-03-27 16:13     ` Tejun Heo
2024-03-27 17:14   ` Waiman Long
2024-03-27 21:43     ` Tejun Heo
2024-03-28  7:53   ` Abel Wu
2024-03-28 17:19     ` Tejun Heo [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=ZgWmqmIXwdN43cUl@slm.duckdns.org \
    --to=tj@kernel.org \
    --cc=cgroups@vger.kernel.org \
    --cc=chenying.kernel@bytedance.com \
    --cc=hezhongkun.hzk@bytedance.com \
    --cc=hughd@google.com \
    --cc=longman@redhat.com \
    --cc=tj@kernel.orgv \
    --cc=wuyun.abel@bytedance.com \
    --cc=zhanghaoyu.zhy@bytedance.com \
    --cc=zhouchuyi@bytedance.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