Subject: Re: C runqueue
To: None <port-i386@netbsd.org>
From: David Laight <david@l8s.co.uk>
List: port-i386
Date: 10/23/2002 17:55:00
On Wed, Oct 23, 2002 at 04:25:21PM +0000, Charles M. Hannum wrote:
>
> Basically, I mean the following patch, although I haven't tested it
> yet:
> movzbl P_PRIORITY(%eax),%edx
> - shrl $2,%edx
> - btsl %edx,_C_LABEL(sched_whichqs) # set q full bit
> - leal _C_LABEL(sched_qs)(,%edx,8),%edx # locate q hdr
> + andl $-4,%edx
> + movl powerof2(%edx),%ecx
> + orl %ecx,_C_LABEL(sched_whichqs) # set q full bit
> + leal _C_LABEL(sched_qs)(%edx,%edx),%edx # locate q hdr
It has to be faster to do:
movzbl P_PRIORITY(%eax),%cl
shrb $1,%cl
shrb $1,%cl
movl $1,%edx
shrl %cl,%edx
orl %edx,_C_LABEL(sched_whichqs)
leal _C_LABEL(sched_qs)(,%ecx,8),%ecx
Although that is a rather long chain of dependant instructions.
I can't believe that your lookup table will actually be in the cache.
David
--
David Laight: david@l8s.co.uk