[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] Re: [PATCH 02/15] Refactor cpu_has_work/any_cpu_has_work in
From: |
Marcelo Tosatti |
Subject: |
[Qemu-devel] Re: [PATCH 02/15] Refactor cpu_has_work/any_cpu_has_work in cpus.c |
Date: |
Tue, 8 Feb 2011 16:50:56 -0200 |
User-agent: |
Mutt/1.5.20 (2009-08-17) |
On Mon, Feb 07, 2011 at 12:19:13PM +0100, Jan Kiszka wrote:
> Avoid duplicate use of the function name cpu_has_work, it's confusing.
> Refactor cpu_has_work to cpu_is_idle and do the same with
> any_cpu_has_work.
>
> Signed-off-by: Jan Kiszka <address@hidden>
> ---
> cpus.c | 43 +++++++++++++++++++++++--------------------
> 1 files changed, 23 insertions(+), 20 deletions(-)
>
> diff --git a/cpus.c b/cpus.c
> index d54ec7d..cd764f2 100644
> --- a/cpus.c
> +++ b/cpus.c
> @@ -137,29 +137,30 @@ static int cpu_can_run(CPUState *env)
> return 1;
> }
>
> -static int cpu_has_work(CPUState *env)
> +static bool cpu_is_idle(CPUState *env)
> {
> - if (env->stop)
> - return 1;
> - if (env->queued_work_first)
> - return 1;
> - if (env->stopped || !vm_running)
> - return 0;
> - if (!env->halted)
> - return 1;
> - if (qemu_cpu_has_work(env))
> - return 1;
> - return 0;
> + if (env->stop || env->queued_work_first) {
> + return false;
> + }
> + if (env->stopped || !vm_running) {
> + return true;
> + }
> + if (!env->halted || qemu_cpu_has_work(env)) {
> + return false;
> + }
> + return true;
> }
Do you really find it easier to read evaluations grouped with || ? I
don't.
Sorry but the name change does not feel right either: CPU is still idle
if the vm is not running.
- [Qemu-devel] Re: [PATCH 15/15] kvm: x86: Introduce kvmclock device to save/restore its state, (continued)
- [Qemu-devel] Re: [PATCH 15/15] kvm: x86: Introduce kvmclock device to save/restore its state, Jan Kiszka, 2011/02/07
- [Qemu-devel] Re: [PATCH 15/15] kvm: x86: Introduce kvmclock device to save/restore its state, Glauber Costa, 2011/02/07
- [Qemu-devel] Re: [PATCH 15/15] kvm: x86: Introduce kvmclock device to save/restore its state, Jan Kiszka, 2011/02/07
- [Qemu-devel] Re: [PATCH 15/15] kvm: x86: Introduce kvmclock device to save/restore its state, Glauber Costa, 2011/02/07
- [Qemu-devel] Re: [PATCH 15/15] kvm: x86: Introduce kvmclock device to save/restore its state, Jan Kiszka, 2011/02/07
- [Qemu-devel] Re: [PATCH 15/15] kvm: x86: Introduce kvmclock device to save/restore its state, Glauber Costa, 2011/02/07
- [Qemu-devel] Re: [PATCH 15/15] kvm: x86: Introduce kvmclock device to save/restore its state, Avi Kivity, 2011/02/07
Re: [Qemu-devel] [PATCH 15/15] kvm: x86: Introduce kvmclock device to save/restore its state, Blue Swirl, 2011/02/07
[Qemu-devel] [PATCH 02/15] Refactor cpu_has_work/any_cpu_has_work in cpus.c, Jan Kiszka, 2011/02/07
- [Qemu-devel] Re: [PATCH 02/15] Refactor cpu_has_work/any_cpu_has_work in cpus.c,
Marcelo Tosatti <=
[Qemu-devel] [PATCH v2 02/15] Refactor cpu_has_work/any_cpu_has_work in cpus.c, Jan Kiszka, 2011/02/09