From: Tejun Heo <tj@kernel.org>
To: Vipin Sharma <vipinsh@google.com>
Cc: "Paolo Bonzini" <pbonzini@redhat.com>,
"Michal Koutný" <mkoutny@suse.com>,
seanjc@google.com, lizefan.x@bytedance.com, hannes@cmpxchg.org,
dmatlack@google.com, jiangshanlai@gmail.com, kvm@vger.kernel.org,
cgroups@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] KVM: Move VM's worker kthreads back to the original cgroups before exiting.
Date: Wed, 19 Jan 2022 09:05:05 -1000 [thread overview]
Message-ID: <Yehg4doAwoUTBHLX@slm.duckdns.org> (raw)
In-Reply-To: <CAHVum0fqhMQd2uFic5_7RN=Ah6TTH2G2qLNZuxnQXSazR57m6g@mail.gmail.com>
On Wed, Jan 19, 2022 at 10:49:57AM -0800, Vipin Sharma wrote:
> Sean suggested that we can use the real_parent of the kthread task
> which will always be kthreadd_task, this will also not require any
> changes in the cgroup API. I like that approach, I will give it a try.
> This will avoid changes in cgroup APIs completely.
Yeah, that's better than the original but still not great in that it's still
a workaround and just pushes up the problem. You can get the same race if
the cgroups are nested. e.g. if you have a kvm instance under a/b and when
kvm exits, the management software removes b and then realizes that a is
empty too and then tries to delete that too.
It'd be great if we can make kthread_stop actually wait for what most others
consider thread exit but if we're just gonna work around them, just doing it
in userspace might be better - e.g. after kvm exits, wait for !populated
event (this is a pollable event) on the cgroup and then clean up.
Thanks.
--
tejun
next prev parent reply other threads:[~2022-01-19 19:05 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-22 22:53 [PATCH v2] KVM: Move VM's worker kthreads back to the original cgroups before exiting Vipin Sharma
2021-12-28 17:17 ` Sean Christopherson
2022-01-18 19:53 ` Vipin Sharma
2022-01-05 18:04 ` Michal Koutný
2022-01-18 20:25 ` Vipin Sharma
2022-01-18 20:39 ` Tejun Heo
2022-01-19 18:02 ` Paolo Bonzini
2022-01-19 18:30 ` Tejun Heo
2022-01-19 18:49 ` Vipin Sharma
2022-01-19 19:05 ` Tejun Heo [this message]
2022-01-20 15:05 ` Michal Koutný
2022-02-16 17:37 ` Vipin Sharma
2022-02-16 19:48 ` Paolo Bonzini
2022-02-25 17:37 ` Michal Koutný
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=Yehg4doAwoUTBHLX@slm.duckdns.org \
--to=tj@kernel.org \
--cc=cgroups@vger.kernel.org \
--cc=dmatlack@google.com \
--cc=hannes@cmpxchg.org \
--cc=jiangshanlai@gmail.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lizefan.x@bytedance.com \
--cc=mkoutny@suse.com \
--cc=pbonzini@redhat.com \
--cc=seanjc@google.com \
--cc=vipinsh@google.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