kern_resource.c (210225) | kern_resource.c (210226) |
---|---|
1/*- 2 * Copyright (c) 1982, 1986, 1991, 1993 3 * The Regents of the University of California. All rights reserved. 4 * (c) UNIX System Laboratories, Inc. 5 * All or some portions of this file are derived from material licensed 6 * to the University of California by American Telephone and Telegraph 7 * Co. or Unix System Laboratories, Inc. and are reproduced herein with 8 * the permission of UNIX System Laboratories, Inc. --- 21 unchanged lines hidden (view full) --- 30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 32 * SUCH DAMAGE. 33 * 34 * @(#)kern_resource.c 8.5 (Berkeley) 1/21/94 35 */ 36 37#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 1982, 1986, 1991, 1993 3 * The Regents of the University of California. All rights reserved. 4 * (c) UNIX System Laboratories, Inc. 5 * All or some portions of this file are derived from material licensed 6 * to the University of California by American Telephone and Telegraph 7 * Co. or Unix System Laboratories, Inc. and are reproduced herein with 8 * the permission of UNIX System Laboratories, Inc. --- 21 unchanged lines hidden (view full) --- 30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 32 * SUCH DAMAGE. 33 * 34 * @(#)kern_resource.c 8.5 (Berkeley) 1/21/94 35 */ 36 37#include <sys/cdefs.h> |
38__FBSDID("$FreeBSD: head/sys/kern/kern_resource.c 210225 2010-07-18 20:23:10Z trasz $"); | 38__FBSDID("$FreeBSD: head/sys/kern/kern_resource.c 210226 2010-07-18 20:57:53Z trasz $"); |
39 40#include "opt_compat.h" 41 42#include <sys/param.h> 43#include <sys/systm.h> 44#include <sys/sysproto.h> 45#include <sys/file.h> 46#include <sys/kernel.h> --- 1195 unchanged lines hidden (view full) --- 1242void 1243uihold(uip) 1244 struct uidinfo *uip; 1245{ 1246 1247 refcount_acquire(&uip->ui_ref); 1248} 1249 | 39 40#include "opt_compat.h" 41 42#include <sys/param.h> 43#include <sys/systm.h> 44#include <sys/sysproto.h> 45#include <sys/file.h> 46#include <sys/kernel.h> --- 1195 unchanged lines hidden (view full) --- 1242void 1243uihold(uip) 1244 struct uidinfo *uip; 1245{ 1246 1247 refcount_acquire(&uip->ui_ref); 1248} 1249 |
1250/* | 1250/*- |
1251 * Since uidinfo structs have a long lifetime, we use an 1252 * opportunistic refcounting scheme to avoid locking the lookup hash 1253 * for each release. 1254 * 1255 * If the refcount hits 0, we need to free the structure, 1256 * which means we need to lock the hash. 1257 * Optimal case: 1258 * After locking the struct and lowering the refcount, if we find --- 118 unchanged lines hidden --- | 1251 * Since uidinfo structs have a long lifetime, we use an 1252 * opportunistic refcounting scheme to avoid locking the lookup hash 1253 * for each release. 1254 * 1255 * If the refcount hits 0, we need to free the structure, 1256 * which means we need to lock the hash. 1257 * Optimal case: 1258 * After locking the struct and lowering the refcount, if we find --- 118 unchanged lines hidden --- |