public inbox for cgroups@vger.kernel.org
 help / color / mirror / Atom feed
From: Tejun Heo <tj@kernel.org>
To: "T.J. Mercier" <tjmercier@google.com>
Cc: "Michal Koutný" <mkoutny@suse.com>,
	cgroups@vger.kernel.org, "Zefan Li" <lizefan.x@bytedance.com>,
	"Johannes Weiner" <hannes@cmpxchg.org>,
	"Suren Baghdasaryan" <surenb@google.com>
Subject: Re: [Bug Report] EBUSY for cgroup rmdir after cgroup.procs empty
Date: Tue, 10 Oct 2023 08:41:15 -1000	[thread overview]
Message-ID: <ZSWay-22Gh9opIC_@slm.duckdns.org> (raw)
In-Reply-To: <CABdmKX0Aiu7Run9YCYXVAX4o3-eP6nKcnzyWh_yuhVKVXTPQkA@mail.gmail.com>

Hello,

On Tue, Oct 10, 2023 at 10:14:26AM -0700, T.J. Mercier wrote:
> > BTW is there any fundamental reason the apps cannot use the
> > notifications via cgroup.events as recommended by Tejun?
> >
> This would require that we read both cgroup.procs and cgroup.events,
> since we'd still want to know which processes to signal. I assumed
> this would increase lock contention but there's no synchronization on
> cgroup_is_populated so it looks like not. I had already identified
> this as a workaround, but I'd prefer to depend on just one file to do
> everything.

I don't think we can guarantee that. There's a reason why we have
[!]populated events. Maybe we can find this particular situation better but
there isn't going to be a guarantee that a cgroup is removable if its
cgroup.procs file is seen empty.

Note that cgroup.events file is pollable. You can just poll the file and
then respond to them. I don't understand the part of having to read
cgroup.procs, which btw is an a lot more expensive operation. You said
"which processes to signal". If this is to kill all processes in the cgroup,
you can use cgroup.kill which sends signal atomically to all member tasks.

It feels like the use case is just trying to do things in an unsupported way
when there's no actual benefit to doing so. Is there something preventing
you guys from doing how it's supposed to be used?

Thanks.

-- 
tejun

  reply	other threads:[~2023-10-10 18:41 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-03 17:40 [Bug Report] EBUSY for cgroup rmdir after cgroup.procs empty T.J. Mercier
2023-10-03 18:01 ` T.J. Mercier
2023-10-04 18:54   ` Tejun Heo
2023-10-06 16:58   ` Michal Koutný
2023-10-06 18:37     ` T.J. Mercier
2023-10-10 16:31       ` Michal Koutný
2023-10-10 17:14         ` T.J. Mercier
2023-10-10 18:41           ` Tejun Heo [this message]
2023-10-10 20:22             ` T.J. Mercier
2023-10-11 23:57           ` T.J. Mercier
2023-10-24 23:10             ` T.J. Mercier
2023-10-25 13:30               ` Michal Koutný
2023-10-25 18:29                 ` T.J. Mercier
2023-11-01 15:29                   ` Michal Koutný
2023-11-01 17:32                     ` T.J. Mercier

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=ZSWay-22Gh9opIC_@slm.duckdns.org \
    --to=tj@kernel.org \
    --cc=cgroups@vger.kernel.org \
    --cc=hannes@cmpxchg.org \
    --cc=lizefan.x@bytedance.com \
    --cc=mkoutny@suse.com \
    --cc=surenb@google.com \
    --cc=tjmercier@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