Index: sys/kern/subr_blist.c =================================================================== --- sys/kern/subr_blist.c +++ sys/kern/subr_blist.c @@ -90,6 +90,7 @@ #ifdef _KERNEL #include +#include #include #include #include @@ -382,6 +383,14 @@ blist_destroy(save); } +static long bighint_updates, bighint_reads, bighint_fails, bighint_blocks, bighint_resets; +static SYSCTL_NODE(_debug, OID_AUTO, counters, CTLFLAG_RD, 0, ""); +SYSCTL_ULONG(_debug_counters, OID_AUTO, bighint_updates, CTLFLAG_RD, &bighint_updates, 0, ""); +SYSCTL_ULONG(_debug_counters, OID_AUTO, bighint_reads, CTLFLAG_RD, &bighint_reads, 0, ""); +SYSCTL_ULONG(_debug_counters, OID_AUTO, bighint_fails, CTLFLAG_RD, &bighint_fails, 0, ""); +SYSCTL_ULONG(_debug_counters, OID_AUTO, bighint_blocks, CTLFLAG_RD, &bighint_blocks, 0, ""); +SYSCTL_ULONG(_debug_counters, OID_AUTO, bighint_resets, CTLFLAG_RD, &bighint_resets, 0, ""); + #ifdef BLIST_DEBUG /* @@ -686,6 +695,7 @@ * Update bighint. There is no allocation bigger than range1 * starting in this leaf. */ + atomic_add_long(&bighint_updates, 1); scan->bm_bighint = range1; return (SWAPBLK_NONE); } @@ -740,6 +750,7 @@ * Update bighint. There is no allocation bigger than range1 * available in this leaf after this allocation completes. */ + atomic_add_long(&bighint_updates, 1); scan->bm_bighint = range1; } else { /* Clear the bits of mask at position 'hi' and higher. */ @@ -797,6 +808,7 @@ bit = mask & -mask; digit = bitpos(bit); i = 1 + digit * skip; + atomic_add_long(&bighint_reads, 1); if (count <= scan[i].bm_bighint) { /* * The allocation might fit beginning in the i'th subtree. @@ -808,7 +820,9 @@ scan->bm_bitmap ^= bit; return (r); } - } + atomic_add_long(&bighint_fails, 1); + } else + atomic_add_long(&bighint_blocks, 1); cursor = blk; } while ((mask ^= bit) != 0); @@ -817,8 +831,10 @@ * scanned, and the last tree node is allocated, update bighint. */ if (scan_from_start && !(digit == BLIST_META_RADIX - 1 && - scan[i].bm_bighint == BLIST_MAX_ALLOC)) + scan[i].bm_bighint == BLIST_MAX_ALLOC)) { + atomic_add_long(&bighint_updates, 1); scan->bm_bighint = count - 1; + } return (SWAPBLK_NONE); } @@ -866,6 +882,7 @@ * If we just shoehorn it, a little extra overhead will be incurred * on the next allocation (but only that one typically). */ + atomic_add_long(&bighint_resets, 1); scan->bm_bighint = BLIST_MAX_ALLOC; if (radix == BLIST_BMAP_RADIX)