[libvirt] [PATCH] Add APIs for killing off processes inside a cgroup

Daniel Veillard veillard at redhat.com
Thu Feb 24 01:22:11 UTC 2011


On Wed, Feb 23, 2011 at 11:27:06AM +0000, Daniel P. Berrange wrote:
> 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 :-)

  okay, okay :-)

Daniel

-- 
Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
daniel at veillard.com  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/




More information about the libvir-list mailing list