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.
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.
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]
22 * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
26 #ifndef _SYS_MEM_CAGE_H
27 #define _SYS_MEM_CAGE_H
29 #pragma ident "%Z%%M% %I% %E% SMI"
31 #include <sys/types.h>
32 #include <sys/memlist.h>
35 * Memory caging interfaces.
48 extern int kernel_cage_enable
;
50 extern kthread_id_t kcage_cageout_thread
;
51 extern pgcnt_t kcage_freemem
;
52 extern pgcnt_t kcage_needfree
;
53 extern pgcnt_t kcage_lotsfree
;
54 extern pgcnt_t kcage_desfree
;
55 extern pgcnt_t kcage_minfree
;
56 extern pgcnt_t kcage_throttlefree
;
58 extern void kcage_freemem_add(pgcnt_t
);
59 extern void kcage_freemem_sub(pgcnt_t
);
60 extern int kcage_create_throttle(pgcnt_t
, int);
63 * Control direction of growth: 0: increasing pfns, 1: decreasing.
65 typedef enum {KCAGE_UP
, KCAGE_DOWN
} kcage_dir_t
;
66 extern void kcage_range_init(struct memlist
*, kcage_dir_t
, pgcnt_t
);
67 extern int kcage_range_add(pfn_t
, pgcnt_t
, kcage_dir_t
);
69 extern int kcage_current_pfn(pfn_t
*);
70 extern int kcage_range_delete(pfn_t
, pgcnt_t
);
71 extern int kcage_range_delete_post_mem_del(pfn_t
, pgcnt_t
);
73 extern void kcage_recalc_thresholds(void);
75 /* Called from vm_pageout.c */
76 extern void kcage_cageout_init(void);
77 extern void kcage_cageout_wakeup(void);
79 /* Called from clock thread in clock.c */
80 extern void kcage_tick(void);
82 /* Called from vm_pagelist.c */
83 extern int kcage_next_range(int incage
,
84 pfn_t lo
, pfn_t hi
, pfn_t
*nlo
, pfn_t
*nhi
);
86 extern kcage_dir_t kcage_startup_dir
;
94 #endif /* _SYS_MEM_CAGE_H */