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()? -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html