@@ -320,7 +320,7 @@ static uint32_t vmem_id;
320320static uint32_t vmem_populators ;
321321static vmem_seg_t vmem_seg0 [VMEM_SEG_INITIAL ];
322322static vmem_seg_t * vmem_segfree ;
323- static kmutex_t vmem_list_lock ;
323+ kmutex_t vmem_list_lock ;
324324static kmutex_t vmem_segfree_lock ;
325325static kmutex_t vmem_sleep_lock ;
326326static kmutex_t vmem_nosleep_lock ;
@@ -342,9 +342,10 @@ vmem_t *spl_heap_arena;
342342static void * spl_heap_arena_initial_alloc ;
343343static uint32_t spl_heap_arena_initial_alloc_size = 0 ;
344344#define NUMBER_OF_ARENAS_IN_VMEM_INIT 21
345- // static struct timespec vmem_update_interval = {15 , 0}; /* vmem_update() every 15 seconds */
345+ static struct timespec vmem_update_interval = {60 , 0 }; /* vmem_update() every 60 seconds */
346346uint32_t vmem_mtbf ; /* mean time between failures [default: off] */
347347uint32_t vmem_seg_size = sizeof (vmem_seg_t );
348+ volatile boolean_t hash_rescale_exit = FALSE;
348349
349350// must match with include/sys/vmem_impl.h
350351static vmem_kstat_t vmem_kstat_template = {
@@ -2127,9 +2128,12 @@ vmem_destroy(vmem_t *vmp)
21272128 vmp -> vm_name , leaked , (vmp -> vm_cflags & VMC_IDENTIFIER ) ?
21282129 "identifiers" : "bytes" );
21292130
2130- if (vmp -> vm_hash_table != vmp -> vm_hash0 )
2131- vmem_free (vmem_hash_arena , vmp -> vm_hash_table ,
2132- (vmp -> vm_hash_mask + 1 ) * sizeof (void * ));
2131+ if (vmp -> vm_hash_table != vmp -> vm_hash0 ) {
2132+ if (vmem_hash_arena != NULL ) {
2133+ vmem_free (vmem_hash_arena , vmp -> vm_hash_table ,
2134+ (vmp -> vm_hash_mask + 1 ) * sizeof (void * ));
2135+ }
2136+ }
21332137
21342138 /*
21352139 * Give back the segment structures for anything that's left in the
@@ -2176,10 +2180,13 @@ vmem_destroy_internal(vmem_t *vmp)
21762180 vmp -> vm_name , leaked , (vmp -> vm_cflags & VMC_IDENTIFIER ) ?
21772181 "identifiers" : "bytes" );
21782182
2179- if (vmp -> vm_hash_table != vmp -> vm_hash0 )
2180- if (vmem_hash_arena != NULL )
2181- vmem_free (vmem_hash_arena , vmp -> vm_hash_table ,
2182- (vmp -> vm_hash_mask + 1 ) * sizeof (void * ));
2183+ if (vmp -> vm_hash_table != vmp -> vm_hash0 ) {
2184+ if (vmem_hash_arena != NULL ) {
2185+ vmem_free (vmem_hash_arena , vmp -> vm_hash_table ,
2186+ (vmp -> vm_hash_mask + 1 ) * sizeof (void * ));
2187+ }
2188+ }
2189+
21832190
21842191 /*
21852192 * Give back the segment structures for anything that's left in the
@@ -2275,9 +2282,16 @@ void
22752282vmem_update (void * dummy )
22762283{
22772284 vmem_t * vmp ;
2285+ static struct bsd_timeout_wrapper vmem_update_tm ;
2286+
2287+ if (hash_rescale_exit == TRUE)
2288+ return ;
22782289
22792290 mutex_enter (& vmem_list_lock );
22802291 for (vmp = vmem_list ; vmp != NULL ; vmp = vmp -> vm_next ) {
2292+ if (hash_rescale_exit == TRUE) {
2293+ break ;
2294+ }
22812295 /*
22822296 * If threads are waiting for resources, wake them up
22832297 * periodically so they can issue another kmem_reap()
@@ -2292,7 +2306,9 @@ vmem_update(void *dummy)
22922306 }
22932307 mutex_exit (& vmem_list_lock );
22942308
2295- // (void) bsd_timeout(vmem_update, dummy, &vmem_update_interval);
2309+
2310+ if (hash_rescale_exit == FALSE)
2311+ (void ) bsd_timeout (vmem_update , & vmem_update_tm , & vmem_update_interval );
22962312}
22972313
22982314void
0 commit comments