mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Matt Helsley <matthltc@us.ibm.com>
To: Cedric Le Goater <clg@fr.ibm.com>
Cc: Linux-Kernel <linux-kernel@vger.kernel.org>,
	Linux Containers <containers@lists.linux-foundation.org>,
	Pavel Machek <pavel@ucw.cz>, Paul Menage <menage@google.com>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	linux-pm@lists.linux-foundation.org
Subject: Re: [RFC][PATCH 5/5] Add a Signal Control Group Subsystem
Date: Wed, 30 Apr 2008 11:44:57 -0700	[thread overview]
Message-ID: <1209581097.29759.30.camel@localhost.localdomain> (raw)
In-Reply-To: <4811C37D.9050706@fr.ibm.com>


On Fri, 2008-04-25 at 13:41 +0200, Cedric Le Goater wrote:
> Matt Helsley wrote:
> > Add a signal control group subsystem that allows us to send signals to all tasks
> > in the control group by writing the desired signal(7) number to the kill file.
> > 
> > NOTE: We don't really need per-cgroup state, but control groups doesn't support
> > stateless subsystems yet.
> > 
> > Signed-off-by: Matt Helsley <matthltc@us.ibm.com>
> > ---
> >  include/linux/cgroup_signal.h |   28 +++++++++
> >  include/linux/cgroup_subsys.h |    6 +
> >  init/Kconfig                  |    6 +
> >  kernel/Makefile               |    1 
> >  kernel/cgroup_signal.c        |  129 ++++++++++++++++++++++++++++++++++++++++++
> >  5 files changed, 170 insertions(+)
> > 
> > Index: linux-2.6.25-mm1/include/linux/cgroup_signal.h
> > ===================================================================
> > --- /dev/null
> > +++ linux-2.6.25-mm1/include/linux/cgroup_signal.h
> > @@ -0,0 +1,28 @@
> > +#ifndef _LINUX_CGROUP_SIGNAL_H
> > +#define _LINUX_CGROUP_SIGNAL_H
> > +/*
> > + * cgroup_signal.h -  control group freezer subsystem interface
> 
> s/freezer/signal/ 
> 
> > + *
> > + * Copyright IBM Corp. 2007
> > + *
> > + * Author : Cedric Le Goater <clg@fr.ibm.com>
> > + * Author : Matt Helsley <matthltc@us.ibm.com>
> > + */
> > +
> > +#include <linux/cgroup.h>
> > +
> > +#ifdef CONFIG_CGROUP_SIGNAL
> > +
> > +struct stateless {
> > +	struct cgroup_subsys_state css;
> > +};
> 
> I'm not sure this is correct to say so. Imagine you want to send 
> a SIGKILL to a cgroup, you would expect all tasks to die and the
> cgroup to become empty. right ? 
> 
> but if a task is doing clone() while it's being killed by this cgroup
> signal subsystem, we can miss the child. This is because there's a 
> small window in copy_process() where the child is in the cgroup and 
> not visible yet.
> 
>     copy_process()
> 	cgroup_fork()
> 		do stuff
> 	cgroup_fork_callbacks()
> 		
> 	cgroup_post_fork()
> 		put new task in the list.
> 
> ( I didn't dig too much the code, though. So I might be missing 
>   something )
> 
> So if we want to send the signal to all tasks in the cgroup, we need
> to track the new tasks with a fork callback, just like the freezer :
> 
> static void signal_fork(struct cgroup_subsys *ss, struct task_struct *task)
> {
> 
> }
> 
> and, of course, we need to keep somewhere the signal number we need to
> send. 
> 
> 
> All this depends on how we want the cgroup signal subsystem to behave.
> It could be brainless of course, but it seems to me that the biggest 
> benefit of such a subsystem is to use the cgroup capability to track
> new tasks coming in.
> 
> Cheers,
> 
> C.

Assuming we did this, isn't it still possible to send SIGSTOP to every
task in the cgroup yet still appear to have not stopped every task in
the cgroup:

	Task A						Task B
echo 19 > signal.send
	record signal
	return -EBUSY from can_attach
	send signals to all the tasks
	return 0 from write syscall
						echo newpid > tasks
cat tasks
<Uh oh, not all tasks are stopped...>

Cheers,
	-Matt Helsley


  reply	other threads:[~2008-04-30 21:29 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-24  6:47 [RFC][PATCH 0/5] Container Freezer: Reuse Suspend Freezer Matt Helsley
2008-04-24  6:47 ` [RFC][PATCH 1/5] Container Freezer: Add TIF_FREEZE flag to all architectures Matt Helsley
2008-04-24  8:09   ` Pavel Machek
2008-04-24  6:47 ` [RFC][PATCH 2/5] Container Freezer: Make refrigerator always available Matt Helsley
2008-04-25 11:04   ` Pavel Machek
2008-04-25 12:07     ` Cedric Le Goater
2008-04-26 13:02       ` Rafael J. Wysocki
2008-04-26 23:32         ` [RFC][PATCH] Freezer: NOSIG flag (was: Re: [RFC][PATCH 2/5] Container Freezer: Make refrigerator always available) Rafael J. Wysocki
2008-04-30  9:08     ` [RFC][PATCH 2/5] Container Freezer: Make refrigerator always available Matt Helsley
2008-04-24  6:47 ` [RFC][PATCH 3/5] Container Freezer: Implement freezer cgroup subsystem Matt Helsley
2008-04-25  5:51   ` Paul Menage
2008-04-28  4:03     ` Serge E. Hallyn
2008-04-30 10:39     ` Matt Helsley
2008-04-30 21:28   ` Matt Helsley
2008-04-30 22:30     ` Matt Helsley
2008-04-24  6:48 ` [RFC][PATCH 4/5] Container Freezer: Skip frozen cgroups during power management resume Matt Helsley
2008-04-24  6:48 ` [RFC][PATCH 5/5] Add a Signal Control Group Subsystem Matt Helsley
2008-04-24 19:30   ` Paul Jackson
2008-04-30  7:48     ` Matt Helsley
2008-04-30  8:18       ` Paul Jackson
2008-04-25  6:01   ` Paul Menage
2008-04-30  8:29     ` Matt Helsley
2008-04-25 11:41   ` Cedric Le Goater
2008-04-30 18:44     ` Matt Helsley [this message]
     [not found] <20080423142517.062433911@us.ibm.com>
     [not found] ` <20080423142518.703428301@us.ibm.com>
2008-04-23 15:17   ` [RFC PATCH " Cedric Le Goater
2008-04-23 15:37     ` Paul Menage
2008-04-24  7:00       ` Matt Helsley

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=1209581097.29759.30.camel@localhost.localdomain \
    --to=matthltc@us.ibm.com \
    --cc=clg@fr.ibm.com \
    --cc=containers@lists.linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@lists.linux-foundation.org \
    --cc=menage@google.com \
    --cc=pavel@ucw.cz \
    --cc=torvalds@linux-foundation.org \
    /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

Powered by JetHome