[libvirt] [PATCH] Add APIs for killing off processes inside a cgroup
Daniel P. Berrange
berrange at redhat.com
Wed Feb 23 11:27:06 UTC 2011
On Wed, Feb 23, 2011 at 03:26:30PM +0800, Daniel Veillard wrote:
> On Tue, Feb 22, 2011 at 11:17:05AM -0700, Eric Blake wrote:
> > On 02/22/2011 10:55 AM, Daniel P. Berrange wrote:
> > > The virCgroupKill method kills all PIDs found in a cgroup
> > >
> > > The virCgroupKillRecursively method does this recursively
> > > for child cgroups.
> > >
> > > The virCgroupKillPainfully method does a recursive kill
> > > several times in a row until everything has really died
> >
> > Do we really need three APIs, or can we just have:
> >
> > virCgroupKill(..., VIR_CGROUP_KILL_RECURSIVE | VIR_CGROUP_KILL_PAINFUL)
> >
> > I haven't reviewed the body of the patch, yet.
>
> Agreed, I was surpized by this at first.
>
> Went though the patch my only remarks are
> rc = killedAny ? 1 : 0;
> is overkill since killedAny values seems only 0 or 1 anyway
> and the loop for virCgroupKillPainfully looks a bit arbitrary,
> sending 15 signals to all looks a lot, and the delay for the loop
> a bit short, if there is like a hundred processes in that group that
> could be a bit heavy, isn't it ?
The apporach & timings I'm following here are the same as that used
in systemd, and the only way a process could not die after the
SIGKILL is if the kernel had it in an uninterruptable sleep. So I
think this is sufficient for our needs - it certainly is dramatically
more reliable than the code it is replacing in LXC :-)
Daniel
--
|: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org -o- http://virt-manager.org :|
|: http://autobuild.org -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|
More information about the libvir-list
mailing list