Re: Commit 1e5a74059f9 broke utime measurement of ptraced()processes

From: Mike Galbraith
Date: Tue Dec 27 2011 - 03:04:36 EST

On Tue, 2011-12-27 at 11:30 +0300, ÐÑÑÐÐ ÐÐÐÑÐÐÐÐ wrote:
> On Saturday 24 December 2011 10:42:46, Mike Galbraith wrote :
> >
> > > Also I'd like to know if there is a way to get reliable utime
> > > measurements in recent kernels.
> >
> > If wakeup preemption is undesirable, you could run SCHED_BATCH.
> > CPU utilization shifts with wakeup preemption, so there will be visible
> > effect when you change wakeup preemption in any way.
> Thanks, SCHED_BATCH does solve my problem. I'd like to modify the man page
> times (2) so that it includes a warning on utime of processes that wake each
> other. Do you find the following note correct?

Yeah, guess so. I'd leave out the "hand a few wakeup expense...",
that's just a small side effect of not wasting cycles doing very nearly
back to back clock updates for no good reason. The important thing to
note is that utilization is affected by sleep/wakeup patterns.

> ----- to be added to times (2) -----
> On Linux, the user time of a process depends on pattern of wakeups of the
> process. The scheduler is permitted to cut waker's CPU usage and hand a few
> wakeup expense cycles to the wakee that preempted. As a consequence, if two
> processes A and B wake each other frequently (e.g., they communicate via
> pipes, or by sending signals) then only the collective user time of A and B is
> well defined; individual user times of A and B can be arbitrarily
> redistributed between them. If this behaviour is undesirable then both
> processes need to use the SCHED_BATCH scheduler class, see
> sched_setscheduler(2).
> ----- to be added to times (2) -----

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at