uma_core.c (166213) | uma_core.c (166654) |
---|---|
1/*- 2 * Copyright (c) 2002, 2003, 2004, 2005 Jeffrey Roberson <jeff@FreeBSD.org> 3 * Copyright (c) 2004, 2005 Bosko Milekic <bmilekic@FreeBSD.org> 4 * Copyright (c) 2004-2006 Robert N. M. Watson 5 * All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions --- 34 unchanged lines hidden (view full) --- 43 44/* 45 * TODO: 46 * - Improve memory usage for large allocations 47 * - Investigate cache size adjustments 48 */ 49 50#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2002, 2003, 2004, 2005 Jeffrey Roberson <jeff@FreeBSD.org> 3 * Copyright (c) 2004, 2005 Bosko Milekic <bmilekic@FreeBSD.org> 4 * Copyright (c) 2004-2006 Robert N. M. Watson 5 * All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions --- 34 unchanged lines hidden (view full) --- 43 44/* 45 * TODO: 46 * - Improve memory usage for large allocations 47 * - Investigate cache size adjustments 48 */ 49 50#include <sys/cdefs.h> |
51__FBSDID("$FreeBSD: head/sys/vm/uma_core.c 166213 2007-01-25 01:05:23Z mohans $"); | 51__FBSDID("$FreeBSD: head/sys/vm/uma_core.c 166654 2007-02-11 20:13:52Z rwatson $"); |
52 53/* I should really use ktr.. */ 54/* 55#define UMA_DEBUG 1 56#define UMA_DEBUG_ALLOC 1 57#define UMA_DEBUG_ALLOC_1 1 58*/ 59 --- 46 unchanged lines hidden (view full) --- 106static uma_zone_t slabrefzone; /* With refcounters (for UMA_ZONE_REFCNT) */ 107 108/* 109 * The initial hash tables come out of this zone so they can be allocated 110 * prior to malloc coming up. 111 */ 112static uma_zone_t hashzone; 113 | 52 53/* I should really use ktr.. */ 54/* 55#define UMA_DEBUG 1 56#define UMA_DEBUG_ALLOC 1 57#define UMA_DEBUG_ALLOC_1 1 58*/ 59 --- 46 unchanged lines hidden (view full) --- 106static uma_zone_t slabrefzone; /* With refcounters (for UMA_ZONE_REFCNT) */ 107 108/* 109 * The initial hash tables come out of this zone so they can be allocated 110 * prior to malloc coming up. 111 */ 112static uma_zone_t hashzone; 113 |
114/* The boot-time adjusted value for cache line alignment. */ 115static int uma_align_cache = 16 - 1; 116 |
|
114static MALLOC_DEFINE(M_UMAHASH, "UMAHash", "UMA Hash Buckets"); 115 116/* 117 * Are we allowed to allocate buckets? 118 */ 119static int bucketdisable = 1; 120 121/* Linked list of all kegs in the system */ --- 1580 unchanged lines hidden (view full) --- 1702uma_kcreate(uma_zone_t zone, size_t size, uma_init uminit, uma_fini fini, 1703 int align, u_int32_t flags) 1704{ 1705 struct uma_kctor_args args; 1706 1707 args.size = size; 1708 args.uminit = uminit; 1709 args.fini = fini; | 117static MALLOC_DEFINE(M_UMAHASH, "UMAHash", "UMA Hash Buckets"); 118 119/* 120 * Are we allowed to allocate buckets? 121 */ 122static int bucketdisable = 1; 123 124/* Linked list of all kegs in the system */ --- 1580 unchanged lines hidden (view full) --- 1705uma_kcreate(uma_zone_t zone, size_t size, uma_init uminit, uma_fini fini, 1706 int align, u_int32_t flags) 1707{ 1708 struct uma_kctor_args args; 1709 1710 args.size = size; 1711 args.uminit = uminit; 1712 args.fini = fini; |
1710 args.align = align; | 1713 args.align = (align == UMA_ALIGN_CACHE) ? uma_align_cache : align; |
1711 args.flags = flags; 1712 args.zone = zone; 1713 return (uma_zalloc_internal(kegs, &args, M_WAITOK)); 1714} 1715 1716/* See uma.h */ | 1714 args.flags = flags; 1715 args.zone = zone; 1716 return (uma_zalloc_internal(kegs, &args, M_WAITOK)); 1717} 1718 1719/* See uma.h */ |
1720void 1721uma_set_align(int align) 1722{ 1723 1724 if (align != UMA_ALIGN_CACHE) 1725 uma_align_cache = align; 1726} 1727 1728/* See uma.h */ |
|
1717uma_zone_t 1718uma_zcreate(char *name, size_t size, uma_ctor ctor, uma_dtor dtor, 1719 uma_init uminit, uma_fini fini, int align, u_int32_t flags) 1720 1721{ 1722 struct uma_zctor_args args; 1723 1724 /* This stuff is essential for the zone ctor */ --- 1277 unchanged lines hidden --- | 1729uma_zone_t 1730uma_zcreate(char *name, size_t size, uma_ctor ctor, uma_dtor dtor, 1731 uma_init uminit, uma_fini fini, int align, u_int32_t flags) 1732 1733{ 1734 struct uma_zctor_args args; 1735 1736 /* This stuff is essential for the zone ctor */ --- 1277 unchanged lines hidden --- |