Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F101317203
D18474.id51729.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D18474.id51729.diff
View Options
Index: sys/kern/subr_blist.c
===================================================================
--- sys/kern/subr_blist.c
+++ sys/kern/subr_blist.c
@@ -644,14 +644,14 @@
/*
* BLST_LEAF_ALLOC() - allocate at a leaf in the radix tree (a bitmap).
*
- * This is the core of the allocator and is optimized for the
- * BLIST_BMAP_RADIX block allocation case. Otherwise, execution
- * time is proportional to log2(count) + bitpos time.
+ * This is the core of the allocator. Execution time is proportional
+ * to log(count), plus height of the tree if the allocation crosses a
+ * leaf boundary.
*/
static daddr_t
blst_leaf_alloc(blmeta_t *scan, daddr_t blk, int count)
{
- u_daddr_t mask;
+ u_daddr_t cursor_mask, mask;
int count1, hi, lo, num_shifts, range1, range_ext;
range1 = 0;
@@ -691,9 +691,22 @@
}
/* Discard any candidates that appear before blk. */
- mask &= (u_daddr_t)-1 << (blk & BLIST_BMAP_MASK);
- if (mask == 0)
- return (SWAPBLK_NONE);
+ if ((blk & BLIST_BMAP_MASK) != 0) {
+ cursor_mask = mask & bitrange(0, blk & BLIST_BMAP_MASK);
+ if (cursor_mask != 0) {
+ mask ^= cursor_mask;
+ if (mask == 0)
+ return (SWAPBLK_NONE);
+
+ /*
+ * Bighint change for last block allocation cannot
+ * assume that any other block are allocated, so the
+ * bighint cannot be reduced much.
+ */
+ range1 = BLIST_MAX_ALLOC - 1;
+ }
+ blk &= ~BLIST_BMAP_MASK;
+ }
/*
* The least significant set bit in mask marks the start of the first
@@ -734,7 +747,7 @@
}
/* Clear the allocated bits from this leaf. */
scan->bm_bitmap &= ~mask;
- return ((blk & ~BLIST_BMAP_MASK) + lo);
+ return (blk + lo);
}
/*
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Oct 28, 5:19 PM (21 h, 49 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
14369691
Default Alt Text
D18474.id51729.diff (1 KB)
Attached To
Mode
D18474: Stop updating leaf hint after last block allocation when cursor affected resul
Attached
Detach File
Event Timeline
Log In to Comment