WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

Re: [Xen-devel] [PATCH] Credit1: Tweak reset condition

To: Tim Deegan <Tim.Deegan@xxxxxxxxxx>
Subject: Re: [Xen-devel] [PATCH] Credit1: Tweak reset condition
From: George Dunlap <George.Dunlap@xxxxxxxxxxxxx>
Date: Mon, 9 Aug 2010 13:49:39 +0100
Cc: "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>
Delivery-date: Mon, 09 Aug 2010 05:56:04 -0700
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:sender:received :in-reply-to:references:date:x-google-sender-auth:message-id:subject :from:to:cc:content-type:content-transfer-encoding; bh=Mgg8gyynIqGYQABGitcblxdiEOPkjTQrRLF8tcb9jhA=; b=Es8eH8yMjkBy+Zgvp4HSvMx8CsL+GmZq8yVijpVez+IcXsTYo+IxYlSxUrEubGMlxB etdG2Wpxkwv/56CDjy6iUyz92vcsBJ66zfWYzzrW+S5PhIJXj3vTlWluOErXIvYRtlYQ 15945dbplVWmkzw8cQVfJZzmvJycik68XUJjQ=
Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=NVtH/GFKiLRjb0+UZo80ZOxtrdfhqMsrhmCF4bXBMNB2cFnYXIIKjlg4m3mK+u0OVO kLBCj8GtMP6DApNA5NvJdHm535X8KVXU2Tgz3prr7T7xLP5uAfO+r7U/aBHKmbYH94RI 8nwngX+Y7xzs+tTLJ5RcnOFsslsv72MEOy50A=
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <20100809123128.GX13291@xxxxxxxxxxxxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <1a29b22ef2e9ade8e478.1281353913@gdunlap-desktop> <20100809123128.GX13291@xxxxxxxxxxxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
If we wanted to be clever, we could rely upon the fact that this
condition only happens when credit > CSCHED_CREDITS_PER_TSLICE, which
is a positive value.

But I'm all for being defensive and using /= 2 instead.

 -George

On Mon, Aug 9, 2010 at 1:31 PM, Tim Deegan <Tim.Deegan@xxxxxxxxxx> wrote:
> Hi,
>
> At 12:38 +0100 on 09 Aug (1281357513), George Dunlap wrote:
>> VMs that don't use their full timeslice are guaranteed to flip back
>> and forth between "active" and "inactive".  If we set credit to 0
>> when setting "inactive", then when the VM comes back to "active"
>> again, it will effectively be behind most other vcpus in credit.
>> This causes the credit1 to effectively discriminate *against*
>> VMs which use less than their full timeslice.
>>
>> Instead of setting credit to 0, divide it in half (shifting
>> by one bit for more efficiency).
>
> "credit" here is signed, and the compiler is allowed to use either a
> signed or an unsigned shift for >>.  Better to code it as /=2 and trust
> the compiler to DTRT with a constant division.
>
> Cheers,
>
> Tim.
>
>>  This gets rid of some of the
>> system credit while allowing non-cpu-bound VMs to keep some priority
>> advantage.
>>
>> Signed-off-by: George Dunlap <george.dunlap@xxxxxxxxxxxxx>
>>
>> diff -r 6f07d9ac1e7c -r 1a29b22ef2e9 xen/common/sched_credit.c
>> --- a/xen/common/sched_credit.c       Thu Aug 05 14:41:14 2010 +0100
>> +++ b/xen/common/sched_credit.c       Mon Aug 09 12:38:12 2010 +0100
>> @@ -1069,7 +1069,9 @@
>>                  if ( credit > CSCHED_CREDITS_PER_TSLICE )
>>                  {
>>                      __csched_vcpu_acct_stop_locked(prv, svc);
>> -                    credit = 0;
>> +                    /* Divide credits in half, so that when it starts
>> +                     * accounting again, it starts a little bit "ahead" */
>> +                    credit >>= 1;
>>                      atomic_set(&svc->credit, credit);
>>                  }
>>              }
>>
>> _______________________________________________
>> Xen-devel mailing list
>> Xen-devel@xxxxxxxxxxxxxxxxxxx
>> http://lists.xensource.com/xen-devel
>
> --
> Tim Deegan <Tim.Deegan@xxxxxxxxxx>
> Principal Software Engineer, XenServer Engineering
> Citrix Systems UK Ltd.  (Company #02937203, SL9 0BG)
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@xxxxxxxxxxxxxxxxxxx
> http://lists.xensource.com/xen-devel
>

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

<Prev in Thread] Current Thread [Next in Thread>