All of lore.kernel.org
 help / color / mirror / Atom feed
* RFC: /proc/<pid>/sched should contain cumulative data for all threads in process
@ 2011-02-07 22:29 Chris Friesen
  2011-02-08  9:21 ` Peter Zijlstra
  0 siblings, 1 reply; 6+ messages in thread
From: Chris Friesen @ 2011-02-07 22:29 UTC (permalink / raw)
  To: Ingo Molnar, Peter Zijlstra, Linux Kernel Mailing List


Hi,

We've got a tool that gathers lots of scheduling data for each process
(not task/thread) on the system.

For /proc/<pid>/{stat,io} this is straightforward, as the per-thread
values are summed together for the process as a whole.

However, /proc/<pid>/sched only shows the data for the individual thread
with the same tid as the pid.  To get a per-process view we need to
manually scan all the threads and sum them--and this can get expensive
due to all the extra file operations, parsing, etc.

Was this a concious design decision, or just an oversight?  Would a
patch converting it to whole-process values be accepted or is it enough
of a standard interface that we can't break existing apps that expect
the current behaviour?

Thanks,
Chris

-- 
Chris Friesen
Software Developer
GENBAND
chris.friesen@genband.com
www.genband.com

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: RFC: /proc/<pid>/sched should contain cumulative data for all threads in process
  2011-02-07 22:29 RFC: /proc/<pid>/sched should contain cumulative data for all threads in process Chris Friesen
@ 2011-02-08  9:21 ` Peter Zijlstra
  2011-02-08 12:11   ` Ingo Molnar
  0 siblings, 1 reply; 6+ messages in thread
From: Peter Zijlstra @ 2011-02-08  9:21 UTC (permalink / raw)
  To: Chris Friesen; +Cc: Ingo Molnar, Linux Kernel Mailing List

On Mon, 2011-02-07 at 16:29 -0600, Chris Friesen wrote:
> Hi,
> 
> We've got a tool that gathers lots of scheduling data for each process
> (not task/thread) on the system.
> 
> For /proc/<pid>/{stat,io} this is straightforward, as the per-thread
> values are summed together for the process as a whole.
> 
> However, /proc/<pid>/sched only shows the data for the individual thread
> with the same tid as the pid.  To get a per-process view we need to
> manually scan all the threads and sum them--and this can get expensive
> due to all the extra file operations, parsing, etc.
> 
> Was this a concious design decision, or just an oversight?  Would a
> patch converting it to whole-process values be accepted or is it enough
> of a standard interface that we can't break existing apps that expect
> the current behaviour?

I'd as soon remove all that stuff than extend it, its an abi liability,
esp since you're talking about tools parsing this stuff.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: RFC: /proc/<pid>/sched should contain cumulative data for all threads in process
  2011-02-08  9:21 ` Peter Zijlstra
@ 2011-02-08 12:11   ` Ingo Molnar
  2011-02-08 13:45     ` Peter Zijlstra
  0 siblings, 1 reply; 6+ messages in thread
From: Ingo Molnar @ 2011-02-08 12:11 UTC (permalink / raw)
  To: Peter Zijlstra; +Cc: Chris Friesen, Linux Kernel Mailing List


* Peter Zijlstra <peterz@infradead.org> wrote:

> On Mon, 2011-02-07 at 16:29 -0600, Chris Friesen wrote:
> > Hi,
> > 
> > We've got a tool that gathers lots of scheduling data for each process
> > (not task/thread) on the system.
> > 
> > For /proc/<pid>/{stat,io} this is straightforward, as the per-thread
> > values are summed together for the process as a whole.
> > 
> > However, /proc/<pid>/sched only shows the data for the individual thread
> > with the same tid as the pid.  To get a per-process view we need to
> > manually scan all the threads and sum them--and this can get expensive
> > due to all the extra file operations, parsing, etc.
> > 
> > Was this a concious design decision, or just an oversight?  Would a
> > patch converting it to whole-process values be accepted or is it enough
> > of a standard interface that we can't break existing apps that expect
> > the current behaviour?
> 
> I'd as soon remove all that stuff than extend it, its an abi liability,
> esp since you're talking about tools parsing this stuff.

So assuming a tool would want to capture such stats of the system, what would be its 
options? Could we do all this via system-wide counters and perf stat alike cheap, 
transparent gathering without having to patch/rebuild the kernel?

Thanks,

	Ingo

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: RFC: /proc/<pid>/sched should contain cumulative data for all threads in process
  2011-02-08 12:11   ` Ingo Molnar
@ 2011-02-08 13:45     ` Peter Zijlstra
  2011-02-08 15:14       ` Ingo Molnar
  2011-02-09 17:28       ` Chris Friesen
  0 siblings, 2 replies; 6+ messages in thread
From: Peter Zijlstra @ 2011-02-08 13:45 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: Chris Friesen, Linux Kernel Mailing List

On Tue, 2011-02-08 at 13:11 +0100, Ingo Molnar wrote:
> * Peter Zijlstra <peterz@infradead.org> wrote:
> 
> > On Mon, 2011-02-07 at 16:29 -0600, Chris Friesen wrote:
> > > Hi,
> > > 
> > > We've got a tool that gathers lots of scheduling data for each process
> > > (not task/thread) on the system.
> > > 
> > > For /proc/<pid>/{stat,io} this is straightforward, as the per-thread
> > > values are summed together for the process as a whole.
> > > 
> > > However, /proc/<pid>/sched only shows the data for the individual thread
> > > with the same tid as the pid.  To get a per-process view we need to
> > > manually scan all the threads and sum them--and this can get expensive
> > > due to all the extra file operations, parsing, etc.
> > > 
> > > Was this a concious design decision, or just an oversight?  Would a
> > > patch converting it to whole-process values be accepted or is it enough
> > > of a standard interface that we can't break existing apps that expect
> > > the current behaviour?
> > 
> > I'd as soon remove all that stuff than extend it, its an abi liability,
> > esp since you're talking about tools parsing this stuff.
> 
> So assuming a tool would want to capture such stats of the system, what would be its 
> options? Could we do all this via system-wide counters and perf stat alike cheap, 
> transparent gathering without having to patch/rebuild the kernel?

Very much depends on what is wanted, but most of the stuff inside those
files is very specific to the implementation and pinning any of that to
an ABI is like silly.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: RFC: /proc/<pid>/sched should contain cumulative data for all threads in process
  2011-02-08 13:45     ` Peter Zijlstra
@ 2011-02-08 15:14       ` Ingo Molnar
  2011-02-09 17:28       ` Chris Friesen
  1 sibling, 0 replies; 6+ messages in thread
From: Ingo Molnar @ 2011-02-08 15:14 UTC (permalink / raw)
  To: Peter Zijlstra; +Cc: Chris Friesen, Linux Kernel Mailing List


* Peter Zijlstra <peterz@infradead.org> wrote:

> Very much depends on what is wanted, but most of the stuff inside those files is 
> very specific to the implementation and pinning any of that to an ABI is like 
> silly.

Why? If the implementation changes then those values lose meaning and the most 
correct value to report is *zero* and that's it.

That's how such things were always done, it was never a problem in the past 15 
years. Why should it start being a problem suddenly?

Thanks,

	Ingo

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: RFC: /proc/<pid>/sched should contain cumulative data for all threads in process
  2011-02-08 13:45     ` Peter Zijlstra
  2011-02-08 15:14       ` Ingo Molnar
@ 2011-02-09 17:28       ` Chris Friesen
  1 sibling, 0 replies; 6+ messages in thread
From: Chris Friesen @ 2011-02-09 17:28 UTC (permalink / raw)
  To: Peter Zijlstra; +Cc: Ingo Molnar, Linux Kernel Mailing List

On 02/08/2011 07:45 AM, Peter Zijlstra wrote:
> On Tue, 2011-02-08 at 13:11 +0100, Ingo Molnar wrote:

>> So assuming a tool would want to capture such stats of the system, what would be its 
>> options? Could we do all this via system-wide counters and perf stat alike cheap, 
>> transparent gathering without having to patch/rebuild the kernel?
> 
> Very much depends on what is wanted, but most of the stuff inside those
> files is very specific to the implementation and pinning any of that to
> an ABI is like silly.

Currently we're using the following fields from
/proc/<pid>/task/<tid>/sched:

sum_exec_runtime
wait_sum
wait_max
exec_max
iowait_sum
iowait_count
nr_switches

If there's a better way to get this information (with the precision
available from this interface) then I'd love to hear about it.

Chris

-- 
Chris Friesen
Software Developer
GENBAND
chris.friesen@genband.com
www.genband.com

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2011-02-09 17:28 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-02-07 22:29 RFC: /proc/<pid>/sched should contain cumulative data for all threads in process Chris Friesen
2011-02-08  9:21 ` Peter Zijlstra
2011-02-08 12:11   ` Ingo Molnar
2011-02-08 13:45     ` Peter Zijlstra
2011-02-08 15:14       ` Ingo Molnar
2011-02-09 17:28       ` Chris Friesen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.