xref: /xnu-11215.1.10/bsd/sys/mcache.h (revision 8d741a5de7ff4191bf97d57b9f54c2f6d4a15585)
1*8d741a5dSApple OSS Distributions /*
2*8d741a5dSApple OSS Distributions  * Copyright (c) 2006-2019 Apple Inc. All rights reserved.
3*8d741a5dSApple OSS Distributions  *
4*8d741a5dSApple OSS Distributions  * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5*8d741a5dSApple OSS Distributions  *
6*8d741a5dSApple OSS Distributions  * This file contains Original Code and/or Modifications of Original Code
7*8d741a5dSApple OSS Distributions  * as defined in and that are subject to the Apple Public Source License
8*8d741a5dSApple OSS Distributions  * Version 2.0 (the 'License'). You may not use this file except in
9*8d741a5dSApple OSS Distributions  * compliance with the License. The rights granted to you under the License
10*8d741a5dSApple OSS Distributions  * may not be used to create, or enable the creation or redistribution of,
11*8d741a5dSApple OSS Distributions  * unlawful or unlicensed copies of an Apple operating system, or to
12*8d741a5dSApple OSS Distributions  * circumvent, violate, or enable the circumvention or violation of, any
13*8d741a5dSApple OSS Distributions  * terms of an Apple operating system software license agreement.
14*8d741a5dSApple OSS Distributions  *
15*8d741a5dSApple OSS Distributions  * Please obtain a copy of the License at
16*8d741a5dSApple OSS Distributions  * http://www.opensource.apple.com/apsl/ and read it before using this file.
17*8d741a5dSApple OSS Distributions  *
18*8d741a5dSApple OSS Distributions  * The Original Code and all software distributed under the License are
19*8d741a5dSApple OSS Distributions  * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20*8d741a5dSApple OSS Distributions  * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21*8d741a5dSApple OSS Distributions  * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22*8d741a5dSApple OSS Distributions  * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23*8d741a5dSApple OSS Distributions  * Please see the License for the specific language governing rights and
24*8d741a5dSApple OSS Distributions  * limitations under the License.
25*8d741a5dSApple OSS Distributions  *
26*8d741a5dSApple OSS Distributions  * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27*8d741a5dSApple OSS Distributions  */
28*8d741a5dSApple OSS Distributions #ifndef _SYS_MCACHE_H
29*8d741a5dSApple OSS Distributions #define _SYS_MCACHE_H
30*8d741a5dSApple OSS Distributions 
31*8d741a5dSApple OSS Distributions #ifdef KERNEL_PRIVATE
32*8d741a5dSApple OSS Distributions 
33*8d741a5dSApple OSS Distributions #ifdef  __cplusplus
34*8d741a5dSApple OSS Distributions extern "C" {
35*8d741a5dSApple OSS Distributions #endif
36*8d741a5dSApple OSS Distributions 
37*8d741a5dSApple OSS Distributions #include <sys/types.h>
38*8d741a5dSApple OSS Distributions #include <sys/queue.h>
39*8d741a5dSApple OSS Distributions #include <mach/boolean.h>
40*8d741a5dSApple OSS Distributions #include <kern/locks.h>
41*8d741a5dSApple OSS Distributions #include <libkern/OSAtomic.h>
42*8d741a5dSApple OSS Distributions 
43*8d741a5dSApple OSS Distributions #ifdef ASSERT
44*8d741a5dSApple OSS Distributions #undef ASSERT
45*8d741a5dSApple OSS Distributions #endif
46*8d741a5dSApple OSS Distributions 
47*8d741a5dSApple OSS Distributions #ifdef VERIFY
48*8d741a5dSApple OSS Distributions #undef VERIFY
49*8d741a5dSApple OSS Distributions #endif
50*8d741a5dSApple OSS Distributions 
51*8d741a5dSApple OSS Distributions /*
52*8d741a5dSApple OSS Distributions  * Unlike VERIFY(), ASSERT() is evaluated only in DEBUG/DEVELOPMENT build.
53*8d741a5dSApple OSS Distributions  */
54*8d741a5dSApple OSS Distributions #define VERIFY(EX)      \
55*8d741a5dSApple OSS Distributions 	((void)(__probable((EX)) || assfail(#EX, __FILE__, __LINE__)))
56*8d741a5dSApple OSS Distributions #if (DEBUG || DEVELOPMENT)
57*8d741a5dSApple OSS Distributions #define ASSERT(EX)      VERIFY(EX)
58*8d741a5dSApple OSS Distributions #else
59*8d741a5dSApple OSS Distributions #define ASSERT(EX)      ((void)0)
60*8d741a5dSApple OSS Distributions #endif
61*8d741a5dSApple OSS Distributions 
62*8d741a5dSApple OSS Distributions /*
63*8d741a5dSApple OSS Distributions  * Compile time assert; this should be on its own someday.
64*8d741a5dSApple OSS Distributions  */
65*8d741a5dSApple OSS Distributions #define _CASSERT(x)     _Static_assert(x, "compile-time assertion failed")
66*8d741a5dSApple OSS Distributions 
67*8d741a5dSApple OSS Distributions /*
68*8d741a5dSApple OSS Distributions  * Use CPU_CACHE_LINE_SIZE instead of MAX_CPU_CACHE_LINE_SIZE, unless
69*8d741a5dSApple OSS Distributions  * wasting space is of no concern.
70*8d741a5dSApple OSS Distributions  */
71*8d741a5dSApple OSS Distributions #define MAX_CPU_CACHE_LINE_SIZE 128
72*8d741a5dSApple OSS Distributions #define CPU_CACHE_LINE_SIZE     mcache_cache_line_size()
73*8d741a5dSApple OSS Distributions 
74*8d741a5dSApple OSS Distributions #ifndef IS_P2ALIGNED
75*8d741a5dSApple OSS Distributions #define IS_P2ALIGNED(v, a) \
76*8d741a5dSApple OSS Distributions 	((((uintptr_t)(v)) & ((uintptr_t)(a) - 1)) == 0)
77*8d741a5dSApple OSS Distributions #endif /* IS_P2ALIGNED */
78*8d741a5dSApple OSS Distributions 
79*8d741a5dSApple OSS Distributions #ifndef P2ROUNDUP
80*8d741a5dSApple OSS Distributions #define P2ROUNDUP(x, align) \
81*8d741a5dSApple OSS Distributions 	(-(-((uintptr_t)(x)) & -((uintptr_t)align)))
82*8d741a5dSApple OSS Distributions #endif /* P2ROUNDUP */
83*8d741a5dSApple OSS Distributions 
84*8d741a5dSApple OSS Distributions #ifndef P2ROUNDDOWN
85*8d741a5dSApple OSS Distributions #define P2ROUNDDOWN(x, align) \
86*8d741a5dSApple OSS Distributions 	(((uintptr_t)(x)) & ~((uintptr_t)(align) - 1))
87*8d741a5dSApple OSS Distributions #endif /* P2ROUNDDOWN */
88*8d741a5dSApple OSS Distributions 
89*8d741a5dSApple OSS Distributions #ifndef P2ALIGN
90*8d741a5dSApple OSS Distributions #define P2ALIGN(x, align) \
91*8d741a5dSApple OSS Distributions 	((uintptr_t)(x) & -((uintptr_t)(align)))
92*8d741a5dSApple OSS Distributions #endif /* P2ALIGN */
93*8d741a5dSApple OSS Distributions 
94*8d741a5dSApple OSS Distributions #define MCACHE_FREE_PATTERN             0xdeadbeefdeadbeefULL
95*8d741a5dSApple OSS Distributions #define MCACHE_UNINITIALIZED_PATTERN    0xbaddcafebaddcafeULL
96*8d741a5dSApple OSS Distributions 
97*8d741a5dSApple OSS Distributions /*
98*8d741a5dSApple OSS Distributions  * mcache allocation request flags.
99*8d741a5dSApple OSS Distributions  *
100*8d741a5dSApple OSS Distributions  * MCR_NOSLEEP and MCR_FAILOK are mutually exclusive.  The latter is used
101*8d741a5dSApple OSS Distributions  * by the mbuf allocator to handle the implementation of several caches that
102*8d741a5dSApple OSS Distributions  * involve multiple layers of mcache.  It implies a best effort blocking
103*8d741a5dSApple OSS Distributions  * allocation request; if the request cannot be satisfied, the caller will
104*8d741a5dSApple OSS Distributions  * be blocked until further notice, similar to MCR_SLEEP, except that upon
105*8d741a5dSApple OSS Distributions  * a wake up it will return immediately to the caller regardless of whether
106*8d741a5dSApple OSS Distributions  * the request can been fulfilled.
107*8d741a5dSApple OSS Distributions  *
108*8d741a5dSApple OSS Distributions  * MCR_TRYHARD implies a non-blocking allocation request, regardless of
109*8d741a5dSApple OSS Distributions  * whether MCR_NOSLEEP is set.  It informs the allocator that the request
110*8d741a5dSApple OSS Distributions  * should not cause the calling thread to block, and that it must have
111*8d741a5dSApple OSS Distributions  * exhausted all possible schemes to fulfill the request, including doing
112*8d741a5dSApple OSS Distributions  * reclaims and/or purges, before returning to the caller.
113*8d741a5dSApple OSS Distributions  *
114*8d741a5dSApple OSS Distributions  * Regular mcache clients should only use MCR_SLEEP or MCR_NOSLEEP.
115*8d741a5dSApple OSS Distributions  */
116*8d741a5dSApple OSS Distributions #define MCR_SLEEP       0x0000          /* same as M_WAITOK */
117*8d741a5dSApple OSS Distributions #define MCR_NOSLEEP     0x0001          /* same as M_NOWAIT */
118*8d741a5dSApple OSS Distributions #define MCR_FAILOK      0x0100          /* private, for internal use only */
119*8d741a5dSApple OSS Distributions #define MCR_TRYHARD     0x0200          /* private, for internal use only */
120*8d741a5dSApple OSS Distributions #define MCR_USR1        0x1000          /* private, for internal use only */
121*8d741a5dSApple OSS Distributions 
122*8d741a5dSApple OSS Distributions #define MCR_NONBLOCKING (MCR_NOSLEEP | MCR_FAILOK | MCR_TRYHARD)
123*8d741a5dSApple OSS Distributions 
124*8d741a5dSApple OSS Distributions /*
125*8d741a5dSApple OSS Distributions  * Generic one-way linked list element structure.  This is used to handle
126*8d741a5dSApple OSS Distributions  * mcache_alloc_ext() requests in order to chain the allocated objects
127*8d741a5dSApple OSS Distributions  * together before returning them to the caller.
128*8d741a5dSApple OSS Distributions  */
129*8d741a5dSApple OSS Distributions typedef struct mcache_obj {
130*8d741a5dSApple OSS Distributions 	struct mcache_obj       *obj_next;
131*8d741a5dSApple OSS Distributions } mcache_obj_t;
132*8d741a5dSApple OSS Distributions 
133*8d741a5dSApple OSS Distributions typedef struct mcache_bkt {
134*8d741a5dSApple OSS Distributions 	void            *bkt_next;      /* next bucket in list */
135*8d741a5dSApple OSS Distributions 	struct mcache_bkttype *bkt_type; /* bucket type */
136*8d741a5dSApple OSS Distributions 	void            *bkt_obj[1];    /* one or more objects */
137*8d741a5dSApple OSS Distributions } mcache_bkt_t;
138*8d741a5dSApple OSS Distributions 
139*8d741a5dSApple OSS Distributions typedef struct mcache_bktlist {
140*8d741a5dSApple OSS Distributions 	mcache_bkt_t    *bl_list;       /* bucket list */
141*8d741a5dSApple OSS Distributions 	u_int32_t       bl_total;       /* number of buckets */
142*8d741a5dSApple OSS Distributions 	u_int32_t       bl_min;         /* min since last update */
143*8d741a5dSApple OSS Distributions 	u_int32_t       bl_reaplimit;   /* max reapable buckets */
144*8d741a5dSApple OSS Distributions 	u_int64_t       bl_alloc;       /* allocations from this list */
145*8d741a5dSApple OSS Distributions } mcache_bktlist_t;
146*8d741a5dSApple OSS Distributions 
147*8d741a5dSApple OSS Distributions typedef struct mcache_bkttype {
148*8d741a5dSApple OSS Distributions 	int             bt_bktsize;     /* bucket size (number of elements) */
149*8d741a5dSApple OSS Distributions 	size_t          bt_minbuf;      /* all smaller buffers qualify */
150*8d741a5dSApple OSS Distributions 	size_t          bt_maxbuf;      /* no larger bfufers qualify */
151*8d741a5dSApple OSS Distributions 	struct mcache   *bt_cache;      /* bucket cache */
152*8d741a5dSApple OSS Distributions } mcache_bkttype_t;
153*8d741a5dSApple OSS Distributions 
154*8d741a5dSApple OSS Distributions typedef struct mcache_cpu {
155*8d741a5dSApple OSS Distributions 	decl_lck_mtx_data(, cc_lock);
156*8d741a5dSApple OSS Distributions 	mcache_bkt_t    *cc_filled;     /* the currently filled bucket */
157*8d741a5dSApple OSS Distributions 	mcache_bkt_t    *cc_pfilled;    /* the previously filled bucket */
158*8d741a5dSApple OSS Distributions 	u_int64_t       cc_alloc;       /* allocations from this cpu */
159*8d741a5dSApple OSS Distributions 	u_int64_t       cc_free;        /* frees to this cpu */
160*8d741a5dSApple OSS Distributions 	int             cc_objs;        /* number of objects in filled bkt */
161*8d741a5dSApple OSS Distributions 	int             cc_pobjs;       /* number of objects in previous bkt */
162*8d741a5dSApple OSS Distributions 	int             cc_bktsize;     /* number of elements in a full bkt */
163*8d741a5dSApple OSS Distributions } __attribute__((aligned(MAX_CPU_CACHE_LINE_SIZE))) mcache_cpu_t;
164*8d741a5dSApple OSS Distributions 
165*8d741a5dSApple OSS Distributions typedef unsigned int (*mcache_allocfn_t)(void *, mcache_obj_t ***,
166*8d741a5dSApple OSS Distributions     unsigned int, int);
167*8d741a5dSApple OSS Distributions typedef void (*mcache_freefn_t)(void *, mcache_obj_t *, boolean_t);
168*8d741a5dSApple OSS Distributions typedef void (*mcache_auditfn_t)(void *, mcache_obj_t *, boolean_t);
169*8d741a5dSApple OSS Distributions typedef void (*mcache_logfn_t)(u_int32_t, mcache_obj_t *, boolean_t);
170*8d741a5dSApple OSS Distributions typedef void (*mcache_notifyfn_t)(void *, u_int32_t);
171*8d741a5dSApple OSS Distributions 
172*8d741a5dSApple OSS Distributions typedef struct mcache {
173*8d741a5dSApple OSS Distributions 	/*
174*8d741a5dSApple OSS Distributions 	 * Cache properties
175*8d741a5dSApple OSS Distributions 	 */
176*8d741a5dSApple OSS Distributions 	LIST_ENTRY(mcache) mc_list;     /* cache linkage */
177*8d741a5dSApple OSS Distributions 	char            mc_name[32];    /* cache name */
178*8d741a5dSApple OSS Distributions 	struct zone     *mc_slab_zone;  /* backend zone allocator */
179*8d741a5dSApple OSS Distributions 	mcache_allocfn_t mc_slab_alloc; /* slab layer allocate callback */
180*8d741a5dSApple OSS Distributions 	mcache_freefn_t mc_slab_free;   /* slab layer free callback */
181*8d741a5dSApple OSS Distributions 	mcache_auditfn_t mc_slab_audit; /* slab layer audit callback */
182*8d741a5dSApple OSS Distributions 	mcache_logfn_t mc_slab_log;     /* slab layer log callback */
183*8d741a5dSApple OSS Distributions 	mcache_notifyfn_t mc_slab_notify; /* slab layer notify callback */
184*8d741a5dSApple OSS Distributions 	void            *mc_private;    /* opaque arg to callbacks */
185*8d741a5dSApple OSS Distributions 	size_t          mc_bufsize;     /* object size */
186*8d741a5dSApple OSS Distributions 	size_t          mc_align;       /* object alignment */
187*8d741a5dSApple OSS Distributions 	u_int32_t       mc_flags;       /* cache creation flags */
188*8d741a5dSApple OSS Distributions 	u_int32_t       mc_purge_cnt;   /* # of purges requested by slab */
189*8d741a5dSApple OSS Distributions 	u_int32_t       mc_enable_cnt;  /* # of reenables due to purges */
190*8d741a5dSApple OSS Distributions 	u_int32_t       mc_waiter_cnt;  /* # of slab layer waiters */
191*8d741a5dSApple OSS Distributions 	u_int32_t       mc_wretry_cnt;  /* # of wait retries */
192*8d741a5dSApple OSS Distributions 	u_int32_t       mc_nwretry_cnt; /* # of no-wait retry attempts */
193*8d741a5dSApple OSS Distributions 	u_int32_t       mc_nwfail_cnt;  /* # of no-wait retries that failed */
194*8d741a5dSApple OSS Distributions 	decl_lck_mtx_data(, mc_sync_lock); /* protects purges and reenables */
195*8d741a5dSApple OSS Distributions 	lck_grp_t       *mc_sync_lock_grp;
196*8d741a5dSApple OSS Distributions 	/*
197*8d741a5dSApple OSS Distributions 	 * Keep CPU and buckets layers lock statistics separate.
198*8d741a5dSApple OSS Distributions 	 */
199*8d741a5dSApple OSS Distributions 	lck_grp_t       *mc_cpu_lock_grp;
200*8d741a5dSApple OSS Distributions 
201*8d741a5dSApple OSS Distributions 	/*
202*8d741a5dSApple OSS Distributions 	 * Bucket layer common to all CPUs
203*8d741a5dSApple OSS Distributions 	 */
204*8d741a5dSApple OSS Distributions 	decl_lck_mtx_data(, mc_bkt_lock);
205*8d741a5dSApple OSS Distributions 	lck_grp_t       *mc_bkt_lock_grp;
206*8d741a5dSApple OSS Distributions 	mcache_bkttype_t *cache_bkttype;        /* bucket type */
207*8d741a5dSApple OSS Distributions 	mcache_bktlist_t mc_full;               /* full buckets */
208*8d741a5dSApple OSS Distributions 	mcache_bktlist_t mc_empty;              /* empty buckets */
209*8d741a5dSApple OSS Distributions 	size_t          mc_chunksize;           /* bufsize + alignment */
210*8d741a5dSApple OSS Distributions 	u_int32_t       mc_bkt_contention;      /* lock contention count */
211*8d741a5dSApple OSS Distributions 	u_int32_t       mc_bkt_contention_prev; /* previous snapshot */
212*8d741a5dSApple OSS Distributions 
213*8d741a5dSApple OSS Distributions 	/*
214*8d741a5dSApple OSS Distributions 	 * Per-CPU layer, aligned at cache line boundary
215*8d741a5dSApple OSS Distributions 	 */
216*8d741a5dSApple OSS Distributions 	mcache_cpu_t    mc_cpu[1]
217*8d741a5dSApple OSS Distributions 	__attribute__((aligned(MAX_CPU_CACHE_LINE_SIZE)));
218*8d741a5dSApple OSS Distributions } mcache_t;
219*8d741a5dSApple OSS Distributions 
220*8d741a5dSApple OSS Distributions #define MCACHE_ALIGN    8       /* default guaranteed alignment */
221*8d741a5dSApple OSS Distributions 
222*8d741a5dSApple OSS Distributions /* Valid values for mc_flags */
223*8d741a5dSApple OSS Distributions #define MCF_VERIFY      0x00000001      /* enable verification */
224*8d741a5dSApple OSS Distributions #define MCF_TRACE       0x00000002      /* enable transaction auditing */
225*8d741a5dSApple OSS Distributions #define MCF_NOCPUCACHE  0x00000010      /* disable CPU layer caching */
226*8d741a5dSApple OSS Distributions #define MCF_NOLEAKLOG   0x00000100      /* disable leak logging */
227*8d741a5dSApple OSS Distributions #define MCF_EXPLEAKLOG  0x00000200      /* expose leak info to user space */
228*8d741a5dSApple OSS Distributions 
229*8d741a5dSApple OSS Distributions #define MCF_DEBUG       (MCF_VERIFY | MCF_TRACE)
230*8d741a5dSApple OSS Distributions #define MCF_FLAGS_MASK  \
231*8d741a5dSApple OSS Distributions 	(MCF_DEBUG | MCF_NOCPUCACHE | MCF_NOLEAKLOG | MCF_EXPLEAKLOG)
232*8d741a5dSApple OSS Distributions 
233*8d741a5dSApple OSS Distributions /* Valid values for notify callback */
234*8d741a5dSApple OSS Distributions #define MCN_RETRYALLOC  0x00000001      /* Allocation should be retried */
235*8d741a5dSApple OSS Distributions 
236*8d741a5dSApple OSS Distributions #define MCACHE_STACK_DEPTH 16
237*8d741a5dSApple OSS Distributions 
238*8d741a5dSApple OSS Distributions #define MCA_TRN_MAX     2               /* Number of transactions to record */
239*8d741a5dSApple OSS Distributions 
240*8d741a5dSApple OSS Distributions #define DUMP_MCA_BUF_SIZE       512
241*8d741a5dSApple OSS Distributions 
242*8d741a5dSApple OSS Distributions typedef struct mcache_audit {
243*8d741a5dSApple OSS Distributions 	struct mcache_audit *mca_next;  /* next audit struct */
244*8d741a5dSApple OSS Distributions 	void            *mca_addr;      /* address of buffer */
245*8d741a5dSApple OSS Distributions 	mcache_t        *mca_cache;     /* parent cache of the buffer */
246*8d741a5dSApple OSS Distributions 	size_t          mca_contents_size; /* size of saved contents */
247*8d741a5dSApple OSS Distributions 	void            *mca_contents;  /* user-specific saved contents */
248*8d741a5dSApple OSS Distributions 	void            *mca_uptr;      /* user-specific pointer */
249*8d741a5dSApple OSS Distributions 	uint32_t        mca_uflags;     /* user-specific flags */
250*8d741a5dSApple OSS Distributions 	uint32_t        mca_next_trn;
251*8d741a5dSApple OSS Distributions 	struct mca_trn {
252*8d741a5dSApple OSS Distributions 		struct thread   *mca_thread;    /* thread doing transaction */
253*8d741a5dSApple OSS Distributions 		uint32_t        mca_tstamp;
254*8d741a5dSApple OSS Distributions 		uint16_t        mca_depth;
255*8d741a5dSApple OSS Distributions 		void            *mca_stack[MCACHE_STACK_DEPTH];
256*8d741a5dSApple OSS Distributions 	} mca_trns[MCA_TRN_MAX];
257*8d741a5dSApple OSS Distributions } mcache_audit_t;
258*8d741a5dSApple OSS Distributions 
259*8d741a5dSApple OSS Distributions __private_extern__ int assfail(const char *, const char *, int) __abortlike;
260*8d741a5dSApple OSS Distributions __private_extern__ void mcache_init(void);
261*8d741a5dSApple OSS Distributions __private_extern__ unsigned int mcache_getflags(void);
262*8d741a5dSApple OSS Distributions __private_extern__ unsigned int mcache_cache_line_size(void);
263*8d741a5dSApple OSS Distributions __private_extern__ mcache_t *mcache_create(const char *, size_t,
264*8d741a5dSApple OSS Distributions     size_t, u_int32_t, int);
265*8d741a5dSApple OSS Distributions __private_extern__ void *mcache_alloc(mcache_t *, int);
266*8d741a5dSApple OSS Distributions __private_extern__ void mcache_free(mcache_t *, void *);
267*8d741a5dSApple OSS Distributions __private_extern__ mcache_t *mcache_create_ext(const char *, size_t,
268*8d741a5dSApple OSS Distributions     mcache_allocfn_t, mcache_freefn_t, mcache_auditfn_t, mcache_logfn_t,
269*8d741a5dSApple OSS Distributions     mcache_notifyfn_t, void *__unsafe_indexable, u_int32_t, int);
270*8d741a5dSApple OSS Distributions __private_extern__ void mcache_destroy(mcache_t *);
271*8d741a5dSApple OSS Distributions __private_extern__ unsigned int mcache_alloc_ext(mcache_t *, mcache_obj_t **,
272*8d741a5dSApple OSS Distributions     unsigned int, int);
273*8d741a5dSApple OSS Distributions __private_extern__ void mcache_free_ext(mcache_t *, mcache_obj_t *);
274*8d741a5dSApple OSS Distributions __private_extern__ void mcache_reap(void);
275*8d741a5dSApple OSS Distributions __private_extern__ void mcache_reap_now(mcache_t *, boolean_t);
276*8d741a5dSApple OSS Distributions __private_extern__ boolean_t mcache_purge_cache(mcache_t *, boolean_t);
277*8d741a5dSApple OSS Distributions __private_extern__ void mcache_waiter_inc(mcache_t *);
278*8d741a5dSApple OSS Distributions __private_extern__ void mcache_waiter_dec(mcache_t *);
279*8d741a5dSApple OSS Distributions __private_extern__ boolean_t mcache_bkt_isempty(mcache_t *);
280*8d741a5dSApple OSS Distributions 
281*8d741a5dSApple OSS Distributions struct timeval;
282*8d741a5dSApple OSS Distributions __private_extern__ void mcache_buffer_log(mcache_audit_t *, void *, mcache_t *,
283*8d741a5dSApple OSS Distributions     struct timeval *);
284*8d741a5dSApple OSS Distributions __private_extern__ void mcache_set_pattern(u_int64_t, void *, size_t);
285*8d741a5dSApple OSS Distributions __private_extern__ void *mcache_verify_pattern(u_int64_t, void *, size_t);
286*8d741a5dSApple OSS Distributions __private_extern__ void mcache_audit_free_verify(mcache_audit_t *,
287*8d741a5dSApple OSS Distributions     void *, size_t, size_t);
288*8d741a5dSApple OSS Distributions __private_extern__ void mcache_audit_free_verify_set(mcache_audit_t *,
289*8d741a5dSApple OSS Distributions     void *, size_t, size_t);
290*8d741a5dSApple OSS Distributions __private_extern__ char *mcache_dump_mca(char buf[DUMP_MCA_BUF_SIZE], mcache_audit_t *);
291*8d741a5dSApple OSS Distributions 
292*8d741a5dSApple OSS Distributions extern mcache_t *mcache_audit_cache;
293*8d741a5dSApple OSS Distributions 
294*8d741a5dSApple OSS Distributions #ifdef  __cplusplus
295*8d741a5dSApple OSS Distributions }
296*8d741a5dSApple OSS Distributions #endif
297*8d741a5dSApple OSS Distributions 
298*8d741a5dSApple OSS Distributions #endif /* KERNEL_PRIVATE */
299*8d741a5dSApple OSS Distributions 
300*8d741a5dSApple OSS Distributions #endif /* _SYS_MCACHE_H */
301