[1/4] RFC: SLB rewrite (core rewrite)

David Gibson david at gibson.dropbear.id.au
Thu Jul 8 11:46:54 EST 2004


On Wed, Jul 07, 2004 at 10:06:43AM -0500, Jake Moilanen wrote:
>
> This is pretty nice.  Good work.  I have just one nit below:
>
> > +_GLOBAL(slb_allocate)
> > +	/*
> > +	 * First find a slot, round robin. Previously we tried to find
> > +	 * a free slot first but that took too long. Unfortunately we
> > +	 * dont have any LRU information to help us choose a slot.
> > +	 */
> > +	srdi	r9,r1,27
> > +	ori	r9,r9,1			/* mangle SP for later compare */
> > +
> > +	ld	r10,PACASTABRR(r13)
> > +3:
> > +	addi	r10,r10,1
> > +	/* use a cpu feature mask if we ever change our slb size */
> > +	cmpldi	r10,SLB_NUM_ENTRIES
> > +
> > +	blt+	4f
>
> This branch probably shouldn't be predicted.  The general rule on branch
> prediction is for an error case, or a missed lock.  Since about power 4,
> the branch prediction is a little over 99% correct, you'll get a miss 1
> out of 62 times or 1.6% of the time.  It's probably not measurable, just
> might save a few cycles.

Hmm, well Anton actually suggested that branch hint, and the one
below.  Because the branch prediction is based on whether it was taken
last time round, and this is a strict round-robin, he thought the
dynamic prediction would get it wrong twice round the cycle, whereas
the static would only get it wrong one.

Or something.

He did do some timings, the difference was certainly tiny, although it
might have been (just) measurable.

> > +	 * The >> 27 (rather than >> 28) is so that the LSB is the
> > +	 * valid bit - this way we check valid and ESID in one compare.
> > +	 */
> > +	srdi	r11,r11,27
> > +	cmpd	r11,r9
> > +	beq-	3b
>
> Same as above.

Of course, I do also have a plan to get rid of the slbmfee and that
loop by locking the kernel stack into a fixed SLB slot.  I have a
patch to do it even, but I need to figure out how to get it to work on
iSeries.

--
David Gibson			| For every complex problem there is a
david AT gibson.dropbear.id.au	| solution which is simple, neat and
				| wrong.
http://www.ozlabs.org/people/dgibson

** Sent via the linuxppc64-dev mail list. See http://lists.linuxppc.org/





More information about the Linuxppc64-dev mailing list