From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46973) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZYvvA-0005iL-8N for qemu-devel@nongnu.org; Mon, 07 Sep 2015 08:53:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZYvv7-0006D3-4G for qemu-devel@nongnu.org; Mon, 07 Sep 2015 08:53:16 -0400 Received: from mx1.redhat.com ([209.132.183.28]:41331) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZYvv6-0006Cz-VU for qemu-devel@nongnu.org; Mon, 07 Sep 2015 08:53:13 -0400 References: <1441383989-3377-1-git-send-email-jjherne@linux.vnet.ibm.com> <1441383989-3377-2-git-send-email-jjherne@linux.vnet.ibm.com> From: Paolo Bonzini Message-ID: <55ED88B3.7090105@redhat.com> Date: Mon, 7 Sep 2015 14:53:07 +0200 MIME-Version: 1.0 In-Reply-To: <1441383989-3377-2-git-send-email-jjherne@linux.vnet.ibm.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v6 1/5] cpu: Provide vcpu throttling interface List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Jason J. Herne" , afaerber@suse.de, amit.shah@redhat.com, dgilbert@redhat.com, borntraeger@de.ibm.com, quintela@redhat.com, qemu-devel@nongnu.org On 04/09/2015 18:26, Jason J. Herne wrote: > + pct = (double)cpu_throttle_get_percentage()/100; > + throttle_ratio = pct / (1 - pct); > + sleeptime_ms = (long)(throttle_ratio * CPU_THROTTLE_TIMESLICE); This is going to be pretty imprecise, since there are only 11 possible values of sleeptime_ms. Can you switch the timer and CPU_THROTTLE_TIMESLICE to nanosecond precision instead? It's okay to provide this as a patch 6/5, and the maintainer will squash it into this patch. Alternatively this can be sent as v7, as you prefer. Paolo > + > + qemu_mutex_unlock_iothread(); > + atomic_set(&cpu->throttle_thread_scheduled, 0); > + g_usleep(sleeptime_ms * 1000); /* Convert ms to us for usleep call */