LVS
lvs-users
Google
 
Web LinuxVirtualServer.org

Re: [PATCH-2.4] fix locking in est scheduler

To: "LinuxVirtualServer.org users mailing list." <lvs-users@xxxxxxxxxxxxxxxxxxxxxx>
Subject: Re: [PATCH-2.4] fix locking in est scheduler
From: Wensong Zhang <wensong@xxxxxxxxxxxx>
Date: Sun, 29 Jun 2003 23:24:28 +0800 (CST)

Hello Ratz,

On Sat, 28 Jun 2003, Roberto Nibali wrote:

> > 
> > Yes, but we need to make some release candidates before releasing 
> > ipvs-1.0.10.
> 
> Do you want to do it or shall I give it a spin?
> 

I do, because there is some changes accumulated in my ipvs-1.0 tree.

> 
> Sure, but I mean wrr is rr with weight "choosal", why do we need to have 
> it so much different to rr (or am I misreading the code)?
> 

Well, maybe you need read the wrr code for the algorithm. ;) After weight
is introduced, the algorithm is a little bit complicated. Servers with
higher weights receive new and get more jobs than servers with lower
weights. Servers with equal weights get an equal distribution of new jobs.

> Also, the static int gcd() can be optimised, look:
> 
> static int gcd_lvs(int a, int b) {
>          int c;
> 
>          while ((c = a % b)) {
>                  a = b;
>                  b = c;
>          }
>          return b;
> }
> 
> static int gcd_new(int a, int b) {
>          while (b > 0) {
>                  a = a % b;
>                  a = a + b;
>                  b = a - b;
>                  a = a - b;
>          }
>          return a;
> }
> 
> gcd_lvs:
>          pushl   %ebp
>          movl    %esp, %ebp
>          pushl   %esi
>          pushl   %ebx
>          subl    $4, %esp
>          movl    8(%ebp), %ebx
>          movl    12(%ebp), %esi
>          movl    %ebx, %eax
>          cltd
>          idivl   %esi
>          testl   %edx, %edx
>          movl    %edx, %ecx
>          je      .L7
>          .p2align 4,,15
> .L7:
>          popl    %edx
>          movl    %esi, %eax
>          popl    %ebx
>          popl    %esi
>          popl    %ebp
>          ret
> gcd_new:
>          pushl   %ebp
>          movl    %esp, %ebp
>          pushl   %ebx
>          subl    $4, %esp
>          movl    12(%ebp), %ebx
>          movl    8(%ebp), %ecx
>          testl   %ebx, %ebx
>          jle     .L14
>          .p2align 4,,15
> .L14:
>          movl    %ecx, %eax
>          popl    %ecx
>          popl    %ebx
>          popl    %ebp
>          ret
> 
> Much faster :) :)
> 

:) Maybe I miss something in the assemble code of gcd_new, where is the 
mod (%) operation?

Best regards,

Wensong

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