[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v4 1/5] cpu: Provide vcpu throttling interface
From: |
Paolo Bonzini |
Subject: |
Re: [Qemu-devel] [PATCH v4 1/5] cpu: Provide vcpu throttling interface |
Date: |
Thu, 2 Jul 2015 18:43:26 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.0.1 |
On 02/07/2015 18:36, Jason J. Herne wrote:
> +static void cpu_throttle_thread(void *opaque)
> +{
> + double pct = (double)throttle_percentage/100;
> + double throttle_ratio = pct / (1 - pct);
> + long sleeptime_ms = (long)(throttle_ratio * CPU_THROTTLE_TIMESLICE);
> +
> + if (!throttle_percentage) {
> + return;
> + }
> +
> + qemu_mutex_unlock_iothread();
> + g_usleep(sleeptime_ms * 1000); /* Convert ms to us for usleep call */
> + qemu_mutex_lock_iothread();
> +}
> +
> +static void cpu_throttle_timer_tick(void *opaque)
> +{
> + CPUState *cpu;
> +
> + /* Stop the timer if needed */
> + if (!throttle_percentage) {
> + return;
> + }
> + CPU_FOREACH(cpu) {
> + async_run_on_cpu(cpu, cpu_throttle_thread, NULL);
> + }
> +
> + timer_mod(throttle_timer, qemu_clock_get_ms(QEMU_CLOCK_VIRTUAL_RT) +
> + CPU_THROTTLE_TIMESLICE);
> +}
This could cause callbacks to pile up I think. David, do you have any
idea how to fix it?
Paolo
- [Qemu-devel] [PATCH v4 0/5] migration: Dynamic cpu throttling for auto-converge, Jason J. Herne, 2015/07/02
- [Qemu-devel] [PATCH v4 5/5] migration: Disambiguate MAX_THROTTLE, Jason J. Herne, 2015/07/02
- [Qemu-devel] [PATCH v4 1/5] cpu: Provide vcpu throttling interface, Jason J. Herne, 2015/07/02
- Re: [Qemu-devel] [PATCH v4 1/5] cpu: Provide vcpu throttling interface,
Paolo Bonzini <=
- Re: [Qemu-devel] [PATCH v4 1/5] cpu: Provide vcpu throttling interface, Dr. David Alan Gilbert, 2015/07/02
- Re: [Qemu-devel] [PATCH v4 1/5] cpu: Provide vcpu throttling interface, Jason J. Herne, 2015/07/13
- Re: [Qemu-devel] [PATCH v4 1/5] cpu: Provide vcpu throttling interface, Paolo Bonzini, 2015/07/13
- Re: [Qemu-devel] [PATCH v4 1/5] cpu: Provide vcpu throttling interface, Jason J. Herne, 2015/07/15
- Re: [Qemu-devel] [PATCH v4 1/5] cpu: Provide vcpu throttling interface, Paolo Bonzini, 2015/07/15
- Re: [Qemu-devel] [PATCH v4 1/5] cpu: Provide vcpu throttling interface, Jason J. Herne, 2015/07/16
- Re: [Qemu-devel] [PATCH v4 1/5] cpu: Provide vcpu throttling interface, Paolo Bonzini, 2015/07/23
- Re: [Qemu-devel] [PATCH v4 1/5] cpu: Provide vcpu throttling interface, Jason J. Herne, 2015/07/31
- Re: [Qemu-devel] [PATCH v4 1/5] cpu: Provide vcpu throttling interface, Paolo Bonzini, 2015/07/31
- Re: [Qemu-devel] [PATCH v4 1/5] cpu: Provide vcpu throttling interface, Jason J. Herne, 2015/07/31