From: Tejun Heo <tj@kernel.org>
To: Waiman Long <longman@redhat.com>
Cc: Chuyi Zhou <zhouchuyi@bytedance.com>,
cgroups@vger.kernel.org, hughd@google.com,
wuyun.abel@bytedance.com, hezhongkun.hzk@bytedance.com,
chenying.kernel@bytedance.com, zhanghaoyu.zhy@bytedance.com
Subject: Re: [problem] Hung task caused by memory migration when cpuset.mems changes
Date: Wed, 27 Mar 2024 11:43:13 -1000 [thread overview]
Message-ID: <ZgSS8eKks9jZx4mc@slm.duckdns.org> (raw)
In-Reply-To: <d8e8b000-7d09-4747-82ec-bf99a73607ee@redhat.com>
Hello,
On Wed, Mar 27, 2024 at 01:14:49PM -0400, Waiman Long wrote:
...
> > @@ -2718,11 +2739,6 @@ static void cpuset_migrate_mm(struct mm_struct *mm, const nodemask_t *from,
> > }
> > }
> > -static void cpuset_post_attach(void)
> > -{
> > - flush_workqueue(cpuset_migrate_mm_wq);
> > -}
> > -
> > /*
> > * cpuset_change_task_nodemask - change task's mems_allowed and mempolicy
> > * @tsk: the task to change
> > @@ -3276,6 +3292,10 @@ static int cpuset_can_attach(struct cgroup_taskset *tset)
> > bool cpus_updated, mems_updated;
> > int ret;
> > + ret = schedule_flush_migrate_mm();
> > + if (ret)
> > + return ret;
> > +
>
> It may be too early to initiate the task_work at cpuset_can_attach() as no
> mm migration may happen. My suggestion is to do it at cpuset_attach() with
> at least one cpuset_migrate_mm() call.
Yeah, we can do that too. The downside is that we lose the ability to return
-ENOMEM unless we separate out allocation and queueing. Given that
flush_workqueue() when migration is not in progress is really cheap and the
existing code always flushes from post_attach(), I don't think it's too bad
but yeah it widens the scope of unnecessary waits. So, yeah, what you're
suggesting sounds good too especially given that migration is best effort
anyway and already depends on memory allocation.
Let's see whether this works for Chuyi and I'll post an update version
later.
Thanks.
--
tejun
next prev parent reply other threads:[~2024-03-27 21:43 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 [this message]
2024-03-28 7:53 ` Abel Wu
2024-03-28 17:19 ` Tejun Heo
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=ZgSS8eKks9jZx4mc@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=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