From mboxrd@z Thu Jan 1 00:00:00 1970 From: Anthony Liguori Subject: Re: [patch] remove vcpu_info array v5 Date: Mon, 10 Nov 2008 09:22:53 -0600 Message-ID: <491851CD.9030401@us.ibm.com> References: <4909C00F.8050704@sgi.com> <49103812.1070104@redhat.com> <5d6222a80811040555q5be67439sbd38d94dfa25d8ad@mail.gmail.com> <49105C95.90809@redhat.com> <5d6222a80811040635j70c57efev1f3abc5096803b29@mail.gmail.com> <49105ED8.107@redhat.com> <4918376D.6060201@sgi.com> <491839CF.9060105@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: Jes Sorensen , Glauber Costa , Hollis Blanchard , "kvm@vger.kernel.org" , "kvm-ia64@vger.kernel.org" To: Avi Kivity Return-path: Received: from e6.ny.us.ibm.com ([32.97.182.146]:32987 "EHLO e6.ny.us.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751463AbYKJPXO (ORCPT ); Mon, 10 Nov 2008 10:23:14 -0500 In-Reply-To: <491839CF.9060105@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: Avi Kivity wrote: > >> My patch gets rid of the pointless MAX_CPUS sized array, which doesn't >> buy us anything. In fact, most of the changes in my patch makes the >> code simpler, because it removes a stack of silly cases where qemu uses >> env->cpu_index to get into the array, just to hide CPUState from libkvm, >> just to have the callback in QEMU go from int vcpu back to CPUState. >> >> Lets just do it right and get rid of this silliness. > > I agree that vcpu_info should die. But we should still have a fast > way of getting a cpu from a cpu_index. I don't see a problem with a > static array of pointers, make it 16K in size if you want. Our real > scaling limits are much lower; they involve the big qemu lock and the > single iothread which will both limit scaling far below any static > vcpu array. Just do a linear search of the CPUState list and be done with it. This smells of premature optimization greatly. I would be amazed if walking the CPUState list is ever on the fast path or will ever be. Really, if you need to go from cpu_index => CPUState, it suggests you're doing something wrong. Regards, Anthony Liguori