[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1296586771.26581.298.camel@laptop>
Date: Tue, 01 Feb 2011 19:59:31 +0100
From: Peter Zijlstra <peterz@...radead.org>
To: Glauber Costa <glommer@...hat.com>
Cc: kvm@...r.kernel.org, linux-kernel@...r.kernel.org,
aliguori@...ibm.com, Rik van Riel <riel@...hat.com>,
Jeremy Fitzhardinge <jeremy.fitzhardinge@...rix.com>,
Avi Kivity <avi@...hat.com>
Subject: Re: [PATCH v2 5/6] KVM-GST: adjust scheduler cpu power
On Tue, 2011-02-01 at 14:22 -0200, Glauber Costa wrote:
>
>
> Which tick accounting? In your other e-mail , you pointed that this only
> runs in touch_steal_time, which is fine, will change.
That tick ;-), all the account_foo muck is per tick.
> But all the rest
> here, that is behind the hypervisor specific vs generic code has nothing
> to do with ticks at all.
But I don't get it, there is no generic code needed, all that's needed
is u64 steal_time_clock(int cpu), and the first part of your
kvm_account_steal_time() function is exactly that if you add the cpu
argument.
+static u64 steal_time_clock(int cpu)
+{
+ u64 steal_time;
+ struct kvm_steal_time *src;
+ int version;
+
+ preempt_disable();
+ src = &per_cpu_ptr(steal_time, cpu);
+ do {
+ version = src->version;
+ rmb();
+ steal_time = src->steal;
+ rmb();
+ } while ((src->version & 1) || (version != src->version));
+ preempt_enable();
+
+ return steal_time
+}
And you're done.. no need to for any of that steal_time_{read,write} business.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists