On Mon, Aug 30, 2010 at 06:46:25PM +0200, Peter Zijlstra wrote:
> On Mon, 2010-08-30 at 12:06 -0400, Glauber Costa wrote:
> > This patch proposes a common steal time implementation. When no
> > steal time is accounted, we just add a branch to the current
> > accounting code, that shouldn't add much overhead.
>
> But why not use alternative code and avoid that conditional
> all-together?
>
> > * Account user cpu time to a process.
> > * @p: the process that the cpu time gets accounted to
> > @@ -3169,6 +3179,12 @@ void account_user_time(struct task_struct *p,
> > cputime_t cputime,
> > struct cpu_usage_stat *cpustat = &kstat_this_cpu.cpustat;
> > cputime64_t tmp;
> >
> > + tmp = get_steal_time_from_hypervisor();
> > + if (tmp) {
> > + account_steal_time(tmp);
> > + return;
> > + }
> > +
> > /* Add user time to process. */
> > p->utime = cputime_add(p->utime, cputime);
> > p->utimescaled = cputime_add(p->utimescaled, cputime_scaled);
> > @@ -3234,6 +3250,12 @@ void account_system_time(struct task_struct *p, int
> > hardirq_offset,
> > return;
> > }
> >
> > + tmp = get_steal_time_from_hypervisor();
> > + if (tmp) {
> > + account_steal_time(tmp);
> > + return;
> > + }
> > +
> > /* Add system time to process. */
> > p->stime = cputime_add(p->stime, cputime);
> > p->stimescaled = cputime_add(p->stimescaled, cputime_scaled);
>
> Why replicate that code and not restructure account_process_tick()?
For both: because this way is easier, and this is just an rfc, so I
am mainly interested in getting convergence on the design, or leaving
this behind altogether. I do agree with both your comments, btw
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html