cvs commit: src/sys/conf files src/sys/sys alist.h src/sys/kern subr_alist.c

Matthew Dillon dillon at apollo.backplane.com
Wed Apr 18 20:16:08 PDT 2007


:Allocations of size greater than the radix seem to be returning the 
:wrong starting block. Should the allocator return the starting block at 
:which it allocated from? If so, sys/kern/subr_alist.c at line 393 should 
:be changed to the following (or similar):
:
:		mask = (u_daddr_t)-1 >> (ALIST_BMAP_RADIX - n);
:		for (j = 0; j < ALIST_META_RADIX; j += n / 2) {
:			if ((scan->bm_bitmap & mask) == mask) {
:				scan->bm_bitmap &= ~mask;
:				return blk; // <== here
:			}
:			mask <<= n;
:			blk += radix * n / 2; // <== here
:		}

    Yup, you found a bug!  I'm going to use a slightly different patch,
    instead of iterating the blk in the loop I will just amend the 
    return(blk + j) I had before to become return(blk + j * radix).

:Also, there appears to be a redundent check for a terminating block at 
:line 442: the first check is at the start of the for loop on line 412. 
:Removing it shows a 4-5% speed up on allocation from an average of 220ms 
:  down to an average of 210ms per allocation for sequential single block 
:allocations on an Athlon X2 2Ghz.
:
:- Jason

    Yah, definitely redundant.  The original skeleton was adapted from the
    subr_blist code I did years ago and I forgot to remove that bit.

					-Matt
					Matthew Dillon 
					<dillon at backplane.com>





More information about the Commits mailing list