Linux Container Development
 help / color / mirror / Atom feed
From: Oren Laadan <orenl-eQaUEPhvms7ENvBUuze7eA@public.gmane.org>
To: Matt Helsley <matthltc-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
Cc: Paul Menage <menage-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>,
	Cedric Le Goater <clg-NmTC/0ZBporQT0dZR+AlfA@public.gmane.org>,
	linux-pm-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org,
	Linux Containers
	<containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org>,
	Linux-Kernel
	<linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Subject: Re: [Devel] [RFC PATCH 0/4] Container Freezer: Reuse Suspend Freezer
Date: Fri, 04 Apr 2008 11:56:43 -0400	[thread overview]
Message-ID: <47F64FBB.2080207@cs.columbia.edu> (raw)
In-Reply-To: <1207278180.30178.94.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>



Matt Helsley wrote:
> On Thu, 2008-04-03 at 16:49 -0700, Paul Menage wrote:
>> On Thu, Apr 3, 2008 at 2:03 PM,  <matthltc-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org> wrote:
>>>    * "freezer.kill"
>>>
>>>      writing <n> will send signal number <n> to all tasks
>>>
>> My first thought (not having looked at the code yet) is that sending a
>> signal doesn't really have anything to do with freezing, so it
>> shouldn't be in the same subsystem. Maybe a separate subsystem called
>> "signal"?
>>
>> And more than that, it's not something that requires any particular
>> per-process state, so there's no reason that the subsystem that
>> provides the "kill" functionality shouldn't be able to be mounted in
>> multiple hierarchies.
>>
>> How about if I added support for stateless subsystems, that could
>> potentially be mounted in multiple hierarchies at once? They wouldn't
>> need an entry in the css set, since they have no state.
> 
> 	This seems reasonable to me. A quick look at Cedric's patches suggests
> there's no need for such cgroup subsystems to be tied together -- the
> signalling is all done internally to the freeze_task(), refrigerator(),
> and thaw_process() functions from what I recall.
> 
>>>  * Usage :
>>>
>>>    # mkdir /containers/freezer
>>>    # mount -t container -ofreezer freezer  /containers/freezer
>>>    # mkdir /containers/freezer/0
>>>    # echo $some_pid > /containers/freezer/0/tasks
>>>
>>>  to get status of the freezer subsystem :
>>>
>>>    # cat /containers/freezer/0/freezer.freeze
>>>    RUNNING
>>>
>>>  to freeze all tasks in the container :
>>>
>>>    # echo 1 > /containers/freezer/0/freezer.freeze
>>>    # cat /containers/freezer/0/freezer.freeze
>>>    FREEZING
>>>    # cat /containers/freezer/0/freezer.freeze
>>>    FROZEN
>> Could we separate this out into two files? One called "freeze" that's
>> a 0/1 for whether we're intending to freeze the subsystem, and one
>> called "frozen" that indicates whether it is frozen? And maybe a
>> "state" file to report the RUNNING/FREEZING/FROZEN distinction in a
>> human-readable way?
> 
> 3 files seems like overkill. I think making them human-readable is good
> and can be done with two files: "state" (read-only) and
> "state-next" (read/write). Transitions between RUNNING and FROZEN are
> obvious when state-next != state. I think the advantages are it's pretty
> human-readable, you don't need separate strings and files for the
> transitions, it's clear what's about to happen (IMHO), and it only
> requires 2 files. Some examples:
> 
> To initiate freezing:
> 
> # cat /containers/freezer/0/freezer.state
> RUNNING
> # echo "FROZEN" > /containers/freezer/0/freezer.state-next
> # cat /containers/freezer/0/freezer.state
> RUNNING
> # cat /containers/freezer/0/freezer.state-next
> FROZEN
> # sleep N
> # cat /containers/freezer/0/freezer.state
> FROZEN
> # cat /containers/freezer/0/freezer.state-next
> FROZEN
> 
> So to cancel freezing you might see something like:
> 
> # cat /containers/freezer/0/freezer.state
> RUNNING
> # cat /containers/freezer/0/freezer.state-next
> FROZEN
> # echo "RUNNING" > /containers/freezer/0/freezer.state-next
> # cat /containers/freezer/0/freezer.state-next
> RUNNING
> 
> If you wanted to know if a group was transitioning:
> 
> # diff /containers/freezer/0/freezer.state /containers/freezer/0/freezer.state-next
> 
> Or:
> # current=`cat /containers/freezer/0/freezer.state`
> # next=`cat /containers/freezer/0/freezer.state-next`
> # [ "$current" != "$next" ] && echo "Transitioning"
> # [ "$current" == "RUNNING" -a "$next" == "FROZEN" ] && echo "Freezing"
> # [ "$current" == "FROZEN" -a "$next" == "RUNNING" ] && echo "Thawing"
> # [ "$current" == "RUNNING" -a "$next" == "RUNNING" ] && echo "No-op"
> # [ "$current" == "FROZEN" -a "$next" == "FROZEN" ] && echo "No-op"

First, I totally agree with Serge's comment (oh well, it's about my
own suggestion, so I must) - for checkpoint/restart we'll need more
states if we are to use the same subsystem.

Second, my gut feeling is that a single, atomic operation to get the
status is preferred over multiple (non-atomic) operations. In other
words, I suggest a single state file instead of two. You can encode
every possible transition in a single state. It's not that the kernel
doesn't know what's going on inside, so it can just as well report it
directly. I don't see the benefit of using two files.

Oren.

> 
> etc.
> 
> Cheers,
> 	-Matt Helsley
> 
> _______________________________________________
> Containers mailing list
> Containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org
> https://lists.linux-foundation.org/mailman/listinfo/containers

  parent reply	other threads:[~2008-04-04 15:56 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-03 21:03 [RFC PATCH 0/4] Container Freezer: Reuse Suspend Freezer matthltc-r/Jw6+rmf7HQT0dZR+AlfA
2008-04-03 21:03 ` [RFC PATCH 1/4] Container Freezer: Add TIF_FREEZE flag to all architectures matthltc-r/Jw6+rmf7HQT0dZR+AlfA
2008-04-03 21:03 ` [RFC PATCH 2/4] Container Freezer: Make refrigerator always available matthltc-r/Jw6+rmf7HQT0dZR+AlfA
2008-04-03 21:03 ` [RFC PATCH 3/4] Container Freezer: Implement freezer cgroup subsystem matthltc-r/Jw6+rmf7HQT0dZR+AlfA
2008-04-03 21:03 ` [RFC PATCH 4/4] Container Freezer: Skip frozen cgroups during power management resume matthltc-r/Jw6+rmf7HQT0dZR+AlfA
     [not found] ` <6599ad830804031649p6bbc60f3s59fb7c25a7260505@mail.gmail.com>
     [not found]   ` <6599ad830804031649p6bbc60f3s59fb7c25a7260505-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2008-04-04  3:03     ` [Devel] [RFC PATCH 0/4] Container Freezer: Reuse Suspend Freezer Matt Helsley
2008-04-04 14:11     ` Serge E. Hallyn
     [not found]   ` <1207278180.30178.94.camel@localhost.localdomain>
     [not found]     ` <1207278180.30178.94.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2008-04-04 15:56       ` Oren Laadan [this message]
     [not found]         ` <47F64FBB.2080207-eQaUEPhvms7ENvBUuze7eA@public.gmane.org>
2008-04-04 22:27           ` Matt Helsley
     [not found]         ` <1207348060.30178.166.camel@localhost.localdomain>
     [not found]           ` <1207348060.30178.166.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2008-04-05  0:30             ` Oren Laadan
     [not found]           ` <47F6C829.4010109@cs.columbia.edu>
     [not found]             ` <47F6C829.4010109-eQaUEPhvms7ENvBUuze7eA@public.gmane.org>
2008-04-05  0:54               ` Matt Helsley
     [not found] ` <20080403210316.397506379-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2008-04-03 23:49   ` Paul Menage
2008-04-11 11:49   ` Pavel Machek
     [not found] ` <20080403210316.659937801@us.ibm.com>
     [not found]   ` <20080403210316.659937801-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2008-04-11 11:49     ` [RFC PATCH 1/4] Container Freezer: Add TIF_FREEZE flag to all architectures Pavel Machek
     [not found] ` <20080403210317.160210906@us.ibm.com>
     [not found]   ` <20080403210317.160210906-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2008-04-11 11:49     ` [RFC PATCH 3/4] Container Freezer: Implement freezer cgroup subsystem Pavel Machek

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=47F64FBB.2080207@cs.columbia.edu \
    --to=orenl-eqauephvms7envbuuze7ea@public.gmane.org \
    --cc=clg-NmTC/0ZBporQT0dZR+AlfA@public.gmane.org \
    --cc=containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-pm-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org \
    --cc=matthltc-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org \
    --cc=menage-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.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