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