DragonFly commits List (threaded) for 2007-04
DragonFly BSD
DragonFly commits List (threaded) for 2007-04
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

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


From: Matthew Dillon <dillon@xxxxxxxxxxxxxxxxxxxx>
Date: Wed, 18 Apr 2007 20:13:31 -0700 (PDT)

: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@backplane.com>



[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]