Linux s390 Architecture development
 help / color / mirror / Atom feed
From: Michael Holzheu <holzheu@linux.vnet.ibm.com>
To: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Shailabh Nagar <nagar1234@in.ibm.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Venkatesh Pallipadi <venki@google.com>,
	Suresh Siddha <suresh.b.siddha@intel.com>,
	Ingo Molnar <mingo@elte.hu>, Oleg Nesterov <oleg@redhat.com>,
	John stultz <johnstul@us.ibm.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Balbir Singh <balbir@linux.vnet.ibm.com>,
	Martin Schwidefsky <schwidefsky@de.ibm.com>,
	Heiko Carstens <heiko.carstens@de.ibm.com>,
	Roland McGrath <roland@redhat.com>,
	linux-kernel@vger.kernel.org, linux-s390@vger.kernel.org
Subject: Re: [RFC][PATCH v2 1/7] taskstats: Add new taskstats command TASKSTATS_CMD_ATTR_PIDS
Date: Mon, 15 Nov 2010 18:09:28 +0100	[thread overview]
Message-ID: <1289840968.1916.85.camel@holzheu-laptop> (raw)
In-Reply-To: <1289837178.2109.504.camel@laptop>

Hello Peter,

On Mon, 2010-11-15 at 17:06 +0100, Peter Zijlstra wrote:
> On Mon, 2010-11-15 at 16:53 +0100, Michael Holzheu wrote:
> > Hello Peter,
> > 
> > On Sat, 2010-11-13 at 20:20 +0100, Peter Zijlstra wrote:
> > > On Thu, 2010-11-11 at 18:03 +0100, Michael Holzheu wrote:
> > > > As clock for 'now' and 'time' the sched_clock() function is used and the patch
> > > 
> > > > +       preempt_disable();
> > > > +       stats->time_ns = sched_clock();
> > > > +       preempt_enable();
> > > 
> > > > +       task_snap_time = sched_clock();
> > > 
> > > That's just plain broken...
> > 
> > What exactly do you mean? Do you mean that we should not use
> > sched_clock() in general or that it is called twice?
> 
> That you should not use sched_clock(),

What should we use instead?

> and if you do (you really
> shouldn't) you should have disabled IRQs around it.
> 
> > > 
> > > 
> > > > +       t->sched_info.last_depart = task_rq(t)->clock;
> > > 
> > > Are you sure you don't mean task_rq(t)->clock_task ?
> > 
> > Maybe... I want to save in "last_depart" a sched_clock() timestamp that
> > is as precise as possible.
> > 
> > We use "last_depart" for the TASKSTATS_CMD_ATTR_PIDS command to find out
> > which tasks have been running on a CPU since the last taskstats
> > snapshot. We return all tasks where last_depart > MIN(stats->time_ns for
> > all tasks of last snapshot).
> 
> What does last departed mean? That is what timeline are you counting in?
> Do you want time as tasks see it, or time as your wallclock sees it?

"last_depart" should be the time stamp, where the task has left a CPU
the last time.

We assume that we can compare "last_depart" with "time_ns" in the
taskstats structure, if we use task_rq(t)->clock for last_depart and
sched_clock() for stats->time_ns. We also assume that we get wallclock
intervals in nanoseconds, if we look at two sched_clock() timestamps.

"stats->time_ns" is used as timestamp for the next snapshot query and
for calculation of the snapshot interval time. So there are three
important timestamps:
* struct task_struct:
  sched_info.last_depart: Last time task has left CPU
* struct taskstats:
  time_ns: Timestamp where taskstats data is generated
* sturuct cmd_pids:
  time_ns: Timestamp for TASKSTATS_CMD_ATTR_PIDS command. 

Example:
1. Get initial snapshot with cmd_pids->time_ns=0:
   - All tasks are returned.
    snapshot_time = MIN(stats->time_ns) for all received taskstats
2. Get second snapshot with cmd_pids->time_ns = snapshot_time
   - Only tasks that were active after "snapshot_time" are returned.

Michael

  reply	other threads:[~2010-11-15 17:09 UTC|newest]

Thread overview: 52+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-11 17:03 [RFC][PATCH v2 0/7] taskstats: Enhancements for precise process accounting (version 2) Michael Holzheu
2010-11-11 17:03 ` [RFC][PATCH v2 1/7] taskstats: Add new taskstats command TASKSTATS_CMD_ATTR_PIDS Michael Holzheu
2010-11-13 19:20   ` Peter Zijlstra
2010-11-15 15:53     ` Michael Holzheu
2010-11-15 16:06       ` Peter Zijlstra
2010-11-15 17:09         ` Michael Holzheu [this message]
2010-11-15 17:21           ` Peter Zijlstra
2010-11-16 12:16             ` Michael Holzheu
2010-11-16 12:36               ` Peter Zijlstra
2010-11-13 19:39   ` Peter Zijlstra
2010-11-13 20:00     ` Balbir Singh
2010-11-15 14:50     ` Michael Holzheu
2010-11-11 17:03 ` [RFC][PATCH v2 2/7] taskstats: Add "/proc/taskstats" Michael Holzheu
2010-11-11 17:03 ` [RFC][PATCH v2 3/7] taskstats: Add thread group ID to taskstats structure Michael Holzheu
2010-11-11 17:03 ` [RFC][PATCH v2 4/7] taskstats: Add per task steal time accounting Michael Holzheu
2010-11-13 19:38   ` Peter Zijlstra
2010-11-15 14:50     ` Martin Schwidefsky
2010-11-15 15:11       ` Peter Zijlstra
2010-11-15 17:42         ` Martin Schwidefsky
2010-11-15 17:45           ` Peter Zijlstra
2010-11-15 17:47           ` Peter Zijlstra
2010-11-15 17:48           ` Peter Zijlstra
2010-11-15 17:50           ` Peter Zijlstra
2010-11-15 17:59             ` Martin Schwidefsky
2010-11-15 18:08               ` Peter Zijlstra
2010-11-16  8:51                 ` Martin Schwidefsky
2010-11-16 12:16                   ` Peter Zijlstra
2010-11-16 15:33                     ` Martin Schwidefsky
2010-11-16 15:45                       ` Peter Zijlstra
2010-11-16 16:05                         ` Martin Schwidefsky
2010-11-16 18:39                           ` Jeremy Fitzhardinge
2010-11-16 16:38                         ` Avi Kivity
2010-11-16 16:43                           ` Peter Zijlstra
2010-11-16 16:56                             ` Avi Kivity
2010-11-16 17:06                               ` Avi Kivity
2010-11-11 17:03 ` [RFC][PATCH v2 5/7] taskstats: Improve cumulative CPU " Michael Holzheu
2010-11-13 18:38   ` Oleg Nesterov
2010-11-15 15:55     ` Martin Schwidefsky
2010-11-15 16:03       ` Peter Zijlstra
2010-11-15 17:49         ` Martin Schwidefsky
2010-11-15 17:51           ` Peter Zijlstra
2010-11-15 18:00             ` Martin Schwidefsky
2010-11-15 18:10               ` Peter Zijlstra
2010-11-16  8:54                 ` Martin Schwidefsky
2010-11-16 16:57     ` Michael Holzheu
2010-11-18 17:10       ` Oleg Nesterov
2010-11-19 19:46         ` Michael Holzheu
2010-11-16 17:34     ` Michael Holzheu
2010-11-16 17:50       ` Oleg Nesterov
2010-11-18 16:34       ` Oleg Nesterov
2010-11-11 17:03 ` [RFC][PATCH v2 6/7] taskstats: Fix accounting for non-leader thread exec Michael Holzheu
2010-11-11 17:11 ` [RFC][PATCH v2 7/7] taskstats: Precise process accounting user space Michael Holzheu

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=1289840968.1916.85.camel@holzheu-laptop \
    --to=holzheu@linux.vnet.ibm.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=akpm@linux-foundation.org \
    --cc=balbir@linux.vnet.ibm.com \
    --cc=heiko.carstens@de.ibm.com \
    --cc=johnstul@us.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=nagar1234@in.ibm.com \
    --cc=oleg@redhat.com \
    --cc=roland@redhat.com \
    --cc=schwidefsky@de.ibm.com \
    --cc=suresh.b.siddha@intel.com \
    --cc=tglx@linutronix.de \
    --cc=venki@google.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