mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Kirill A. Shutemov" <kirill@shutemov.name>
To: Jacob Pan <jacob.jun.pan@linux.intel.com>
Cc: Paul Menage <menage@google.com>, Li Zefan <lizf@cn.fujitsu.com>,
	containers@lists.linux-foundation.org,
	Arjan van de Ven <arjan@linux.intel.com>,
	linux-kernel@vger.kernel.org, Matt Helsley <matthltc@us.ibm.com>,
	"Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
Subject: Re: [PATCH, v3 2/2] cgroups: introduce timer slack subsystem
Date: Mon, 7 Feb 2011 20:32:24 +0200	[thread overview]
Message-ID: <20110207183224.GB14038@shutemov.name> (raw)
In-Reply-To: <20110207092040.2e5c899b@putvin>

On Mon, Feb 07, 2011 at 09:20:40AM -0800, Jacob Pan wrote:
> On Mon, 7 Feb 2011 13:06:03 +0200
> "Kirill A. Shutemov" <kirill@shutemov.name> wrote:
> 
> > On Fri, Feb 04, 2011 at 09:27:55AM -0800, Jacob Pan wrote:
> > > On Fri, 4 Feb 2011 15:34:39 +0200
> > > "Kirill A. Shutemov" <kirill@shutemov.name> wrote:
> > > > What's mean "original timer slack" if you are free to move a task
> > > > between a lot of cgroups and process itself free to change it
> > > > anytime?
> > > > 
> > > 
> > > I need to manage tasks by a management software instead of letting
> > > the task change timer_slack by itself. The goal is to make
> > > management transparent and no modifications to the existing apps.
> > > Therefore, it is desirable to automatically enforce timer_slack
> > > when the apps are in the cgroup while automatically restore it when
> > > it is no longer under cgroup management.
> > 
> > Tasks are always under cgroup management. Root cgroup is still cgroup.
> > 
> > > So the "original timer slack" can be the default 50us or whatever
> > > value chosen by the task itself. But the app itself should not care
> > > or even be aware of which cgroup it is in.
> > > 
> > > So here are two optoins i can think of
> > > 1. add a new variable called cg_timer_slack_ns to struct
> > > task_struct{} cg_timer_slack_ns will be set by cgroup timer_slack
> > > subsystem, then we can retain the original per task value in
> > > timer_slack_ns. timer code will pick max(cg_timer_slack_ns,
> > > timer_slack_ns) if cg_timer_slack_ns is set.
> > > 
> > > 2. leave task_struct unchanged, add a current_timer_slack to the
> > > cgroup. timer_slack cgroup does not modify per task timer_slack_ns.
> > > similar to option #1, let timer code pick the timer_slack to use
> > > based on whether the task is in timer_slack cgroup.
> > > 
> > > Any thoughts?
> > 
> > I think it's over-engineering.
> > 
> We do have a real use case that cannot be solved by the current logic,
> I only want to find a solution.
> > What about configuration like this:
> > 
> >  root_cgroup
> >  |--timer_slack.min_slack_ns = 0
> >  |--timer_slack.max_slack_ns = ULONG_MAX
> >  |--50us
> >  |  |--timer_slack.min_slack_ns = 50000
> >  |  |--timer_slack.max_slack_ns = 50000
> >  |--500us
> >     |--timer_slack.min_slack_ns = 500000
> >     |--timer_slack_max_slack_ns = ULONG_MAX
> > 
> > If you want a task allow to drive its timer_slack, just leave it in
> > root_cgroup.
> > 
> > It you want to drive timer_slack of a task, move it between 50us and
> > 500um based on your policy.
> >  
> I surely agree with the dummy root configuration. But when the
> management software moves task among 50us or 500us cgroups, or back to
> dummy root, the timer slack cannot be automatically changed.
> 
> consider the following scenarios.
> 1. task_A has timer_slack = ts1 = 3us when it is running in the
> foreground by window manager
> 2. then it is moved to 50us cgroup because it is no longer in the
> foreground, so now ts1 = 50us. 
> 3. After a while, the system is running in the low power state, so
> task_A is moved to 500us cgroup, ts1 = 500us. Then the user switch the
> device into normal running state and put task_A in foreground again.
> 4. Management software then moves task_A from 500us cgroup to dummy
> root, but it will not be able to restore the 3us timer slack as needed
> by task_A. Task can surely drive its timer_slack but it breaks the
> cgroup-transparency desired by the management scheme.

Can you use 3us cgroup instead of moving to root cgroup? :)

I understand your use-case, but I can't provide sane interface to
implement this.

> The key is that tasks being managed are not aware of cgroup
> involvement. The management software is the one that moves tasks
> around, but we don't want the management software keeps track of very
> timer slacks value of every tasks. 
> 
> Thanks,
> Jacob

-- 
 Kirill A. Shutemov

  reply	other threads:[~2011-02-07 18:32 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-02 20:47 [PATCH, v3 0/2] Timer slack cgroup subsystem Kirill A. Shutsemov
2011-02-02 20:47 ` [PATCH, v3 1/2] cgroups: export cgroup_iter_{start,next,end} Kirill A. Shutsemov
2011-02-02 21:21   ` Paul Menage
2011-02-02 20:47 ` [PATCH, v3 2/2] cgroups: introduce timer slack subsystem Kirill A. Shutsemov
2011-02-02 22:56   ` jacob pan
2011-02-03  9:22     ` Kirill A. Shutemov
2011-02-03 17:51       ` Jacob Pan
2011-02-03 18:12         ` Paul Menage
2011-02-03 19:57           ` Jacob Pan
2011-02-04 13:34             ` Kirill A. Shutemov
2011-02-04 17:27               ` Jacob Pan
2011-02-07  0:33                 ` Matt Helsley
2011-02-07 11:06                 ` Kirill A. Shutemov
2011-02-07 17:20                   ` Jacob Pan
2011-02-07 18:32                     ` Kirill A. Shutemov [this message]
2011-02-02 23:23   ` Paul Menage
2011-02-03  5:48     ` Matt Helsley
2011-02-03  9:28     ` Kirill A. Shutemov
2011-02-03  5:46   ` Matt Helsley
2011-02-03  9:41     ` Kirill A. Shutemov
2011-02-06  2:49       ` Matt Helsley
2011-02-07  9:48         ` Kirill A. Shutemov

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=20110207183224.GB14038@shutemov.name \
    --to=kirill@shutemov.name \
    --cc=arjan@linux.intel.com \
    --cc=containers@lists.linux-foundation.org \
    --cc=jacob.jun.pan@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lizf@cn.fujitsu.com \
    --cc=matthltc@us.ibm.com \
    --cc=menage@google.com \
    --cc=paulmck@linux.vnet.ibm.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

all inboxes | Powered by JetHome®