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, Version 1.0 only 6 * (the "License"). You may not use this file except in compliance 7 * with the License. 8 * 9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10 * or http://www.opensolaris.org/os/licensing. 11 * See the License for the specific language governing permissions 12 * and limitations under the License. 13 * 14 * When distributing Covered Code, include this CDDL HEADER in each 15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16 * If applicable, add the following below this CDDL HEADER, with the 17 * fields enclosed by brackets "[]" replaced with your own identifying 18 * information: Portions Copyright [yyyy] [name of copyright owner] 19 * 20 * CDDL HEADER END 21 */ 22 /* 23 * Copyright 2004 Sun Microsystems, Inc. All rights reserved. 24 * Use is subject to license terms. 25 */ 26 27 #ifndef _SYS_MEM_CAGE_H 28 #define _SYS_MEM_CAGE_H 29 30 #pragma ident "%Z%%M% %I% %E% SMI" 31 32 #include <sys/types.h> 33 #include <sys/memlist.h> 34 35 /* 36 * Memory caging interfaces. 37 */ 38 39 #ifdef __cplusplus 40 extern "C" { 41 #endif 42 43 #ifdef _KERNEL 44 45 #define KCT_FAILURE 0 46 #define KCT_CRIT 1 47 #define KCT_NONCRIT 2 48 49 extern int kernel_cage_enable; 50 extern int kcage_on; 51 extern kthread_id_t kcage_cageout_thread; 52 extern pgcnt_t kcage_freemem; 53 extern pgcnt_t kcage_needfree; 54 extern pgcnt_t kcage_lotsfree; 55 extern pgcnt_t kcage_desfree; 56 extern pgcnt_t kcage_minfree; 57 extern pgcnt_t kcage_throttlefree; 58 59 extern void kcage_freemem_add(pgcnt_t); 60 extern void kcage_freemem_sub(pgcnt_t); 61 extern int kcage_create_throttle(pgcnt_t, int); 62 63 /* Third arg controls direction of growth: 0: increasing pfns, 1: decreasing. */ 64 extern int kcage_range_trylock(void); 65 extern void kcage_range_lock(void); 66 extern void kcage_range_unlock(void); 67 extern int kcage_current_pfn(pfn_t *); 68 extern int kcage_range_islocked(void); 69 extern int kcage_range_init(struct memlist *, int); 70 extern int kcage_range_add(pfn_t, pgcnt_t, int); 71 extern int kcage_range_delete(pfn_t, pgcnt_t); 72 extern int kcage_range_delete_post_mem_del(pfn_t, pgcnt_t); 73 74 extern void kcage_init(pgcnt_t); 75 extern void kcage_recalc_thresholds(void); 76 77 /* Called from vm_pageout.c */ 78 extern void kcage_cageout_init(void); 79 extern void kcage_cageout_wakeup(void); 80 81 /* Called from clock thread in clock.c */ 82 extern void kcage_tick(void); 83 84 #endif /* _KERNEL */ 85 86 #ifdef __cplusplus 87 } 88 #endif 89 90 #endif /* _SYS_MEM_CAGE_H */ 91