xref: /titanic_44/usr/src/uts/i86pc/vm/vm_dep.h (revision 50e783325f49fdd425c3ad4611534d110980da2f)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 /*
22  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25 
26 /*
27  * UNIX machine dependent virtual memory support.
28  */
29 
30 #ifndef	_VM_DEP_H
31 #define	_VM_DEP_H
32 
33 #pragma ident	"%Z%%M%	%I%	%E% SMI"
34 
35 #ifdef	__cplusplus
36 extern "C" {
37 #endif
38 
39 #include <sys/clock.h>
40 #include <vm/hat_pte.h>
41 #include <sys/param.h>
42 #include <sys/memnode.h>
43 
44 /*
45  * WARNING: vm_dep.h is included by files in common.
46  */
47 
48 #define	GETTICK()	tsc_read()
49 
50 extern uint_t page_create_update_flags_x86(uint_t);
51 
52 extern size_t plcnt_sz(size_t);
53 #define	PLCNT_SZ(ctrs_sz) (ctrs_sz = plcnt_sz(ctrs_sz))
54 
55 extern caddr_t plcnt_init(caddr_t);
56 #define	PLCNT_INIT(addr) (addr = plcnt_init(addr))
57 
58 extern void plcnt_inc_dec(page_t *, int, int, long, int);
59 #define	PLCNT_INCR(pp, mnode, mtype, szc, flags)			\
60 	plcnt_inc_dec(pp, mtype, szc, 1l << PAGE_BSZS_SHIFT(szc), flags)
61 #define	PLCNT_DECR(pp, mnode, mtype, szc, flags)			\
62 	plcnt_inc_dec(pp, mtype, szc, -1l << PAGE_BSZS_SHIFT(szc), flags)
63 
64 /*
65  * macro to update page list max counts.  no-op on x86.
66  */
67 #define	PLCNT_XFER_NORELOC(pp)
68 
69 #define	PLCNT_MODIFY_MAX(pfn, cnt)	mtype_modify_max(pfn, (pgcnt_t)cnt)
70 extern int memrange_num(pfn_t);
71 extern int pfn_2_mtype(pfn_t);
72 extern int mtype_func(int, int, uint_t);
73 extern void mtype_modify_max(pfn_t, long);
74 extern int mnode_pgcnt(int);
75 extern int mnode_range_cnt(int);
76 
77 /*
78  * candidate counters in vm_pagelist.c are indexed by color and range
79  */
80 #define	NUM_MEM_RANGES	4		/* memory range types */
81 #define	MAX_MNODE_MRANGES	NUM_MEM_RANGES
82 #define	MNODE_RANGE_CNT(mnode)	mnode_range_cnt(mnode)
83 #define	MNODE_MAX_MRANGE(mnode)	memrange_num(mem_node_config[mnode].physbase)
84 
85 /*
86  * This was really badly defined, it implicitly uses mnode_maxmrange[]
87  * which is a static in vm_pagelist.c
88  */
89 extern int mtype_2_mrange(int);
90 #define	MTYPE_2_MRANGE(mnode, mtype)	\
91 	(mnode_maxmrange[mnode] - mtype_2_mrange(mtype))
92 
93 /*
94  * Per page size free lists. Allocated dynamically.
95  * dimensions [mtype][mmu_page_sizes][colors]
96  *
97  * mtype specifies a physical memory range with a unique mnode.
98  */
99 
100 extern page_t ****page_freelists;
101 
102 #define	PAGE_FREELISTS(mnode, szc, color, mtype)		\
103 	(*(page_freelists[mtype][szc] + (color)))
104 
105 /*
106  * For now there is only a single size cache list. Allocated dynamically.
107  * dimensions [mtype][colors]
108  *
109  * mtype specifies a physical memory range with a unique mnode.
110  */
111 extern page_t ***page_cachelists;
112 
113 #define	PAGE_CACHELISTS(mnode, color, mtype) 		\
114 	(*(page_cachelists[mtype] + (color)))
115 
116 /*
117  * There are mutexes for both the page freelist
118  * and the page cachelist.  We want enough locks to make contention
119  * reasonable, but not too many -- otherwise page_freelist_lock() gets
120  * so expensive that it becomes the bottleneck!
121  */
122 
123 #define	NPC_MUTEX	16
124 
125 extern kmutex_t	*fpc_mutex[NPC_MUTEX];
126 extern kmutex_t	*cpc_mutex[NPC_MUTEX];
127 
128 extern page_t *page_get_mnode_freelist(int, uint_t, int, uchar_t, uint_t);
129 extern page_t *page_get_mnode_cachelist(uint_t, uint_t, int, int);
130 
131 /* mem node iterator is not used on x86 */
132 #define	MEM_NODE_ITERATOR_DECL(it)
133 #define	MEM_NODE_ITERATOR_INIT(pfn, mnode, it)
134 
135 /*
136  * interleaved_mnodes mode is never set on x86, therefore,
137  * simply return the limits of the given mnode, which then
138  * determines the length of hpm_counters array for the mnode.
139  */
140 #define	HPM_COUNTERS_LIMITS(mnode, physbase, physmax, first) 	\
141 	{							\
142 		(physbase) = mem_node_config[(mnode)].physbase;	\
143 		(physmax) = mem_node_config[(mnode)].physmax;	\
144 		(first) = (mnode);				\
145 	}
146 
147 #define	PAGE_CTRS_WRITE_LOCK(mnode)				\
148 	{							\
149 		rw_enter(&page_ctrs_rwlock[(mnode)], RW_WRITER);\
150 		page_freelist_lock(mnode);			\
151 	}
152 
153 #define	PAGE_CTRS_WRITE_UNLOCK(mnode)				\
154 	{							\
155 		page_freelist_unlock(mnode);			\
156 		rw_exit(&page_ctrs_rwlock[(mnode)]);		\
157 	}
158 
159 #define	PAGE_GET_COLOR_SHIFT(szc, nszc)				\
160 	    (hw_page_array[(nszc)].hp_shift - hw_page_array[(szc)].hp_shift)
161 
162 #define	PAGE_CONVERT_COLOR(ncolor, szc, nszc)			\
163 	    ((ncolor) << PAGE_GET_COLOR_SHIFT((szc), (nszc)))
164 
165 #define	PFN_2_COLOR(pfn, szc, it)					\
166 	(((pfn) & page_colors_mask) >>			                \
167 	(hw_page_array[szc].hp_shift - hw_page_array[0].hp_shift))
168 
169 #define	PNUM_SIZE(szc)							\
170 	(hw_page_array[(szc)].hp_pgcnt)
171 #define	PNUM_SHIFT(szc)							\
172 	(hw_page_array[(szc)].hp_shift - hw_page_array[0].hp_shift)
173 #define	PAGE_GET_SHIFT(szc)						\
174 	(hw_page_array[(szc)].hp_shift)
175 #define	PAGE_GET_PAGECOLORS(szc)					\
176 	(hw_page_array[(szc)].hp_colors)
177 
178 /*
179  * This macro calculates the next sequential pfn with the specified
180  * color using color equivalency mask
181  */
182 #define	PAGE_NEXT_PFN_FOR_COLOR(pfn, szc, color, ceq_mask, color_mask, it)    \
183 	ASSERT(((color) & ~(ceq_mask)) == 0);                                 \
184 	{								      \
185 		uint_t	pfn_shift = PAGE_BSZS_SHIFT(szc);                     \
186 		pfn_t	spfn = pfn >> pfn_shift;                              \
187 		pfn_t	stride = (ceq_mask) + 1;                              \
188 		ASSERT((((ceq_mask) + 1) & (ceq_mask)) == 0);                 \
189 		if (((spfn ^ (color)) & (ceq_mask)) == 0) {                   \
190 			pfn += stride << pfn_shift;                           \
191 		} else {                                                      \
192 			pfn = (spfn & ~(pfn_t)(ceq_mask)) | (color);          \
193 			pfn = (pfn > spfn ? pfn : pfn + stride) << pfn_shift; \
194 		}                                                             \
195 	}
196 
197 /* get the color equivalency mask for the next szc */
198 #define	PAGE_GET_NSZ_MASK(szc, mask)                                         \
199 	((mask) >> (PAGE_GET_SHIFT((szc) + 1) - PAGE_GET_SHIFT(szc)))
200 
201 /* get the color of the next szc */
202 #define	PAGE_GET_NSZ_COLOR(szc, color)                                       \
203 	((color) >> (PAGE_GET_SHIFT((szc) + 1) - PAGE_GET_SHIFT(szc)))
204 
205 /* Find the bin for the given page if it was of size szc */
206 #define	PP_2_BIN_SZC(pp, szc)	(PFN_2_COLOR(pp->p_pagenum, szc, NULL))
207 
208 #define	PP_2_BIN(pp)		(PP_2_BIN_SZC(pp, pp->p_szc))
209 
210 #define	PP_2_MEM_NODE(pp)	(PFN_2_MEM_NODE(pp->p_pagenum))
211 #define	PP_2_MTYPE(pp)		(pfn_2_mtype(pp->p_pagenum))
212 #define	PP_2_SZC(pp)		(pp->p_szc)
213 
214 #define	SZCPAGES(szc)		(1 << PAGE_BSZS_SHIFT(szc))
215 #define	PFN_BASE(pfnum, szc)	(pfnum & ~(SZCPAGES(szc) - 1))
216 
217 /*
218  * this structure is used for walking free page lists
219  * controls when to split large pages into smaller pages,
220  * and when to coalesce smaller pages into larger pages
221  */
222 typedef struct page_list_walker {
223 	uint_t	plw_colors;		/* num of colors for szc */
224 	uint_t  plw_color_mask;		/* colors-1 */
225 	uint_t	plw_bin_step;		/* next bin: 1 or 2 */
226 	uint_t  plw_count;		/* loop count */
227 	uint_t	plw_bin0;		/* starting bin */
228 	uint_t  plw_bin_marker;		/* bin after initial jump */
229 	uint_t  plw_bin_split_prev;	/* last bin we tried to split */
230 	uint_t  plw_do_split;		/* set if OK to split */
231 	uint_t  plw_split_next;		/* next bin to split */
232 	uint_t	plw_ceq_dif;		/* number of different color groups */
233 					/* to check */
234 	uint_t	plw_ceq_mask[MMU_PAGE_SIZES + 1]; /* color equiv mask */
235 	uint_t	plw_bins[MMU_PAGE_SIZES + 1];	/* num of bins */
236 } page_list_walker_t;
237 
238 void	page_list_walk_init(uchar_t szc, uint_t flags, uint_t bin,
239     int can_split, int use_ceq, page_list_walker_t *plw);
240 
241 uint_t	page_list_walk_next_bin(uchar_t szc, uint_t bin,
242     page_list_walker_t *plw);
243 
244 extern struct cpu	cpus[];
245 #define	CPU0		cpus
246 
247 extern int mtype_init(vnode_t *, caddr_t, uint_t *, size_t);
248 #define	MTYPE_INIT(mtype, vp, vaddr, flags, pgsz)		\
249 	(mtype = mtype_init(vp, vaddr, &(flags), pgsz))
250 
251 /*
252  * macros to loop through the mtype range (page_get_mnode_{free,cache,any}list,
253  * and page_get_contig_pages)
254  *
255  * MTYPE_START sets the initial mtype. -1 if the mtype range specified does
256  * not contain mnode.
257  *
258  * MTYPE_NEXT sets the next mtype. -1 if there are no more valid
259  * mtype in the range.
260  */
261 
262 #define	MTYPE_START(mnode, mtype, flags)				\
263 	(mtype = mtype_func(mnode, mtype, flags))
264 
265 #define	MTYPE_NEXT(mnode, mtype, flags) {				\
266 	if (flags & PGI_MT_RANGE) {					\
267 		mtype = mtype_func(mnode, mtype, flags | PGI_MT_NEXT);	\
268 	} else {							\
269 		mtype = -1;						\
270 	}								\
271 }
272 
273 extern int mtype_pgr_init(int *, page_t *, int, pgcnt_t);
274 #define	MTYPE_PGR_INIT(mtype, flags, pp, mnode, pgcnt)			\
275 	(mtype = mtype_pgr_init(&flags, pp, mnode, pgcnt))
276 
277 #define	MNODE_PGCNT(mnode)		mnode_pgcnt(mnode)
278 
279 extern void mnodetype_2_pfn(int, int, pfn_t *, pfn_t *);
280 #define	MNODETYPE_2_PFN(mnode, mtype, pfnlo, pfnhi)			\
281 	mnodetype_2_pfn(mnode, mtype, &pfnlo, &pfnhi)
282 
283 #define	PC_BIN_MUTEX(mnode, bin, flags) ((flags & PG_FREE_LIST) ?	\
284 	&fpc_mutex[(bin) & (NPC_MUTEX - 1)][mnode] :			\
285 	&cpc_mutex[(bin) & (NPC_MUTEX - 1)][mnode])
286 
287 #define	FPC_MUTEX(mnode, i)	(&fpc_mutex[i][mnode])
288 #define	CPC_MUTEX(mnode, i)	(&cpc_mutex[i][mnode])
289 
290 #ifdef DEBUG
291 #define	CHK_LPG(pp, szc)	chk_lpg(pp, szc)
292 extern void	chk_lpg(page_t *, uchar_t);
293 #else
294 #define	CHK_LPG(pp, szc)
295 #endif
296 
297 #define	FULL_REGION_CNT(rg_szc)	\
298 	(LEVEL_SIZE(rg_szc) >> LEVEL_SHIFT(rg_szc - 1))
299 
300 /* Return the leader for this mapping size */
301 #define	PP_GROUPLEADER(pp, szc) \
302 	(&(pp)[-(int)((pp)->p_pagenum & (SZCPAGES(szc)-1))])
303 
304 /* Return the root page for this page based on p_szc */
305 #define	PP_PAGEROOT(pp) ((pp)->p_szc == 0 ? (pp) : \
306 	PP_GROUPLEADER((pp), (pp)->p_szc))
307 
308 /*
309  * The counter base must be per page_counter element to prevent
310  * races when re-indexing, and the base page size element should
311  * be aligned on a boundary of the given region size.
312  *
313  * We also round up the number of pages spanned by the counters
314  * for a given region to PC_BASE_ALIGN in certain situations to simplify
315  * the coding for some non-performance critical routines.
316  */
317 
318 #define	PC_BASE_ALIGN		((pfn_t)1 << PAGE_BSZS_SHIFT(MMU_PAGE_SIZES-1))
319 #define	PC_BASE_ALIGN_MASK	(PC_BASE_ALIGN - 1)
320 
321 /*
322  * cpu/mmu-dependent vm variables
323  */
324 extern uint_t mmu_page_sizes;
325 extern uint_t mmu_exported_page_sizes;
326 /*
327  * page sizes that legacy applications can see via getpagesizes(3c).
328  * Used to prevent legacy applications from inadvertantly using the
329  * 'new' large pagesizes (1g and above).
330  */
331 extern uint_t mmu_legacy_page_sizes;
332 
333 /* For x86, userszc is the same as the kernel's szc */
334 #define	USERSZC_2_SZC(userszc)	(userszc)
335 #define	SZC_2_USERSZC(szc)	(szc)
336 
337 /*
338  * for hw_page_map_t, sized to hold the ratio of large page to base
339  * pagesize (1024 max)
340  */
341 typedef	short	hpmctr_t;
342 
343 /*
344  * get the setsize of the current cpu - assume homogenous for x86
345  */
346 extern int	l2cache_sz, l2cache_linesz, l2cache_assoc;
347 
348 #define	L2CACHE_ALIGN		l2cache_linesz
349 #define	L2CACHE_ALIGN_MAX	64
350 #define	CPUSETSIZE()		\
351 	(l2cache_assoc ? (l2cache_sz / l2cache_assoc) : MMU_PAGESIZE)
352 
353 /*
354  * Return the log2(pagesize(szc) / MMU_PAGESIZE) --- or the shift count
355  * for the number of base pages in this pagesize
356  */
357 #define	PAGE_BSZS_SHIFT(szc) (LEVEL_SHIFT(szc) - MMU_PAGESHIFT)
358 
359 /*
360  * Internal PG_ flags.
361  */
362 #define	PGI_RELOCONLY	0x010000	/* opposite of PG_NORELOC */
363 #define	PGI_NOCAGE	0x020000	/* cage is disabled */
364 #define	PGI_PGCPHIPRI	0x040000	/* page_get_contig_page pri alloc */
365 #define	PGI_PGCPSZC0	0x080000	/* relocate base pagesize page */
366 
367 /*
368  * PGI range flags - should not overlap PGI flags
369  */
370 #define	PGI_MT_RANGE0	0x1000000	/* mtype range to 0 */
371 #define	PGI_MT_RANGE16M 0x2000000	/* mtype range to 16m */
372 #define	PGI_MT_RANGE4G	0x4000000	/* mtype range to 4g */
373 #define	PGI_MT_NEXT	0x8000000	/* get next mtype */
374 #define	PGI_MT_RANGE	(PGI_MT_RANGE0 | PGI_MT_RANGE16M | PGI_MT_RANGE4G)
375 
376 
377 /*
378  * Maximum and default values for user heap, stack, private and shared
379  * anonymous memory, and user text and initialized data.
380  * Used by map_pgsz*() routines.
381  */
382 extern size_t max_uheap_lpsize;
383 extern size_t default_uheap_lpsize;
384 extern size_t max_ustack_lpsize;
385 extern size_t default_ustack_lpsize;
386 extern size_t max_privmap_lpsize;
387 extern size_t max_uidata_lpsize;
388 extern size_t max_utext_lpsize;
389 extern size_t max_shm_lpsize;
390 extern size_t mcntl0_lpsize;
391 
392 /*
393  * Sanity control. Don't use large pages regardless of user
394  * settings if there's less than priv or shm_lpg_min_physmem memory installed.
395  * The units for this variable are 8K pages.
396  */
397 extern pgcnt_t privm_lpg_min_physmem;
398 extern pgcnt_t shm_lpg_min_physmem;
399 
400 /*
401  * hash as and addr to get a bin.
402  */
403 
404 #define	AS_2_BIN(as, seg, vp, addr, bin, szc)				    \
405 	bin = (((((uintptr_t)(addr) >> PAGESHIFT) + ((uintptr_t)(as) >> 4)) \
406 	    & page_colors_mask) >>					    \
407 	    (hw_page_array[szc].hp_shift - hw_page_array[0].hp_shift))
408 
409 /*
410  * cpu private vm data - accessed thru CPU->cpu_vm_data
411  *	vc_pnum_memseg: tracks last memseg visited in page_numtopp_nolock()
412  *	vc_pnext_memseg: tracks last memseg visited in page_nextn()
413  *	vc_kmptr: orignal unaligned kmem pointer for this vm_cpu_data_t
414  *	vc_kmsize: orignal kmem size for this vm_cpu_data_t
415  */
416 
417 typedef struct {
418 	struct memseg	*vc_pnum_memseg;
419 	struct memseg	*vc_pnext_memseg;
420 	void		*vc_kmptr;
421 	size_t		vc_kmsize;
422 } vm_cpu_data_t;
423 
424 /* allocation size to ensure vm_cpu_data_t resides in its own cache line */
425 #define	VM_CPU_DATA_PADSIZE						\
426 	(P2ROUNDUP(sizeof (vm_cpu_data_t), L2CACHE_ALIGN_MAX))
427 
428 /* for boot cpu before kmem is initialized */
429 extern char	vm_cpu_data0[];
430 
431 /*
432  * When a bin is empty, and we can't satisfy a color request correctly,
433  * we scan.  If we assume that the programs have reasonable spatial
434  * behavior, then it will not be a good idea to use the adjacent color.
435  * Using the adjacent color would result in virtually adjacent addresses
436  * mapping into the same spot in the cache.  So, if we stumble across
437  * an empty bin, skip a bunch before looking.  After the first skip,
438  * then just look one bin at a time so we don't miss our cache on
439  * every look. Be sure to check every bin.  Page_create() will panic
440  * if we miss a page.
441  *
442  * This also explains the `<=' in the for loops in both page_get_freelist()
443  * and page_get_cachelist().  Since we checked the target bin, skipped
444  * a bunch, then continued one a time, we wind up checking the target bin
445  * twice to make sure we get all of them bins.
446  */
447 #define	BIN_STEP	19
448 
449 #ifdef VM_STATS
450 struct vmm_vmstats_str {
451 	ulong_t pgf_alloc[MMU_PAGE_SIZES];	/* page_get_freelist */
452 	ulong_t pgf_allocok[MMU_PAGE_SIZES];
453 	ulong_t pgf_allocokrem[MMU_PAGE_SIZES];
454 	ulong_t pgf_allocfailed[MMU_PAGE_SIZES];
455 	ulong_t	pgf_allocdeferred;
456 	ulong_t	pgf_allocretry[MMU_PAGE_SIZES];
457 	ulong_t pgc_alloc;			/* page_get_cachelist */
458 	ulong_t pgc_allocok;
459 	ulong_t pgc_allocokrem;
460 	ulong_t pgc_allocokdeferred;
461 	ulong_t pgc_allocfailed;
462 	ulong_t	pgcp_alloc[MMU_PAGE_SIZES];	/* page_get_contig_pages */
463 	ulong_t	pgcp_allocfailed[MMU_PAGE_SIZES];
464 	ulong_t	pgcp_allocempty[MMU_PAGE_SIZES];
465 	ulong_t	pgcp_allocok[MMU_PAGE_SIZES];
466 	ulong_t	ptcp[MMU_PAGE_SIZES];		/* page_trylock_contig_pages */
467 	ulong_t	ptcpfreethresh[MMU_PAGE_SIZES];
468 	ulong_t	ptcpfailexcl[MMU_PAGE_SIZES];
469 	ulong_t	ptcpfailszc[MMU_PAGE_SIZES];
470 	ulong_t	ptcpfailcage[MMU_PAGE_SIZES];
471 	ulong_t	ptcpok[MMU_PAGE_SIZES];
472 	ulong_t	pgmf_alloc[MMU_PAGE_SIZES];	/* page_get_mnode_freelist */
473 	ulong_t	pgmf_allocfailed[MMU_PAGE_SIZES];
474 	ulong_t	pgmf_allocempty[MMU_PAGE_SIZES];
475 	ulong_t	pgmf_allocok[MMU_PAGE_SIZES];
476 	ulong_t	pgmc_alloc;			/* page_get_mnode_cachelist */
477 	ulong_t	pgmc_allocfailed;
478 	ulong_t	pgmc_allocempty;
479 	ulong_t	pgmc_allocok;
480 	ulong_t	pladd_free[MMU_PAGE_SIZES];	/* page_list_add/sub */
481 	ulong_t	plsub_free[MMU_PAGE_SIZES];
482 	ulong_t	pladd_cache;
483 	ulong_t	plsub_cache;
484 	ulong_t	plsubpages_szcbig;
485 	ulong_t	plsubpages_szc0;
486 	ulong_t	pfs_req[MMU_PAGE_SIZES];	/* page_freelist_split */
487 	ulong_t	pfs_demote[MMU_PAGE_SIZES];
488 	ulong_t	pfc_coalok[MMU_PAGE_SIZES][MAX_MNODE_MRANGES];
489 	ulong_t	ppr_reloc[MMU_PAGE_SIZES];	/* page_relocate */
490 	ulong_t ppr_relocnoroot[MMU_PAGE_SIZES];
491 	ulong_t ppr_reloc_replnoroot[MMU_PAGE_SIZES];
492 	ulong_t ppr_relocnolock[MMU_PAGE_SIZES];
493 	ulong_t ppr_relocnomem[MMU_PAGE_SIZES];
494 	ulong_t ppr_relocok[MMU_PAGE_SIZES];
495 	ulong_t ppr_copyfail;
496 	/* page coalesce counter */
497 	ulong_t page_ctrs_coalesce[MMU_PAGE_SIZES][MAX_MNODE_MRANGES];
498 	/* candidates useful */
499 	ulong_t page_ctrs_cands_skip[MMU_PAGE_SIZES][MAX_MNODE_MRANGES];
500 	/* ctrs changed after locking */
501 	ulong_t page_ctrs_changed[MMU_PAGE_SIZES][MAX_MNODE_MRANGES];
502 	/* page_freelist_coalesce failed */
503 	ulong_t page_ctrs_failed[MMU_PAGE_SIZES][MAX_MNODE_MRANGES];
504 	ulong_t page_ctrs_coalesce_all;	/* page coalesce all counter */
505 	ulong_t page_ctrs_cands_skip_all; /* candidates useful for all func */
506 	ulong_t	restrict4gcnt;
507 	ulong_t	unrestrict16mcnt;	/* non-DMA 16m allocs allowed */
508 	ulong_t	pgpanicalloc;		/* PG_PANIC allocation */
509 	ulong_t	pcf_deny[MMU_PAGE_SIZES];	/* page_chk_freelist */
510 	ulong_t	pcf_allow[MMU_PAGE_SIZES];
511 };
512 extern struct vmm_vmstats_str vmm_vmstats;
513 #endif	/* VM_STATS */
514 
515 extern size_t page_ctrs_sz(void);
516 extern caddr_t page_ctrs_alloc(caddr_t);
517 extern void page_ctr_sub(int, int, page_t *, int);
518 extern page_t *page_freelist_split(uchar_t,
519     uint_t, int, int, pfn_t, page_list_walker_t *);
520 extern page_t *page_freelist_coalesce(int, uchar_t, uint_t, uint_t, int,
521     pfn_t);
522 extern uint_t page_get_pagecolors(uint_t);
523 extern void pfnzero(pfn_t, uint_t, uint_t);
524 
525 #ifdef	__cplusplus
526 }
527 #endif
528 
529 #endif	/* _VM_DEP_H */
530