1/*- 2 * Copyright (c)2006,2007,2008,2009 YAMAMOTO Takashi, 3 * Copyright (c) 2013 EMC Corp. 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 25 unchanged lines hidden (view full) --- 34/* 35 * reference: 36 * - Magazines and Vmem: Extending the Slab Allocator 37 * to Many CPUs and Arbitrary Resources 38 * http://www.usenix.org/event/usenix01/bonwick.html 39 */ 40 41#include <sys/cdefs.h> |
42__FBSDID("$FreeBSD: head/sys/kern/subr_vmem.c 280850 2015-03-30 13:30:53Z mav $"); |
43 44#include "opt_ddb.h" 45 46#include <sys/param.h> 47#include <sys/systm.h> 48#include <sys/kernel.h> 49#include <sys/queue.h> 50#include <sys/callout.h> --- 691 unchanged lines hidden (view full) --- 742 desired = 1 << flsl(vm->vm_nbusytag); 743 desired = MIN(MAX(desired, VMEM_HASHSIZE_MIN), 744 VMEM_HASHSIZE_MAX); 745 current = vm->vm_hashsize; 746 747 /* Grow in powers of two. Shrink less aggressively. */ 748 if (desired >= current * 2 || desired * 4 <= current) 749 vmem_rehash(vm, desired); |
750 751 /* 752 * Periodically wake up threads waiting for resources, 753 * so they could ask for reclamation again. 754 */ 755 VMEM_CONDVAR_BROADCAST(vm); |
756 } 757 mtx_unlock(&vmem_list_lock); 758 759 callout_reset(&vmem_periodic_ch, vmem_periodic_interval, 760 vmem_periodic_kick, NULL); 761} 762 763static void --- 813 unchanged lines hidden --- |