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 /*
23 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
25 */
26
27 #ifndef _LGRP_H
28 #define _LGRP_H
29
30 /*
31 * locality group definitions for kernel
32 */
33
34 #include <sys/types.h>
35
36 #ifdef __cplusplus
37 extern "C" {
38 #endif
39
40 #define LGRP_NONE (-1) /* non-existent lgroup ID */
41
42 #if (!defined(_KERNEL) && !defined(_KMEMUSER))
43 typedef struct lgrp_mem_policy_info { int opaque[2]; } lgrp_mem_policy_info_t;
44 #endif /* !_KERNEL && !_KMEMUSER */
45
46 #if (defined(_KERNEL) || defined(_KMEMUSER))
47 #include <sys/cpuvar.h>
48 #include <sys/bitmap.h>
49 #include <sys/vnode.h>
50 #include <vm/anon.h>
51 #include <vm/seg.h>
52 #include <sys/lgrp_user.h>
53 #include <sys/param.h>
54
55 typedef uint32_t lgrp_load_t; /* lgrp_loadavg type */
56 typedef uintptr_t lgrp_handle_t; /* lgrp handle */
57
58 #define LGRP_NONE_SUCH LGRP_NONE /* non-existent lgroup ID */
59 /* null platform handle */
60 #define LGRP_NULL_HANDLE ((lgrp_handle_t)0xbadbad)
61 #define LGRP_DEFAULT_HANDLE ((lgrp_handle_t)0xbabecafe) /* uma handle */
62 #define LGRP_ROOTID (0) /* root lgroup ID */
63
64 /*
65 * Maximum number of lgrps a platform may define.
66 */
614
615 /* platform interfaces */
616 void lgrp_plat_init(lgrp_init_stages_t);
617 lgrp_t *lgrp_plat_alloc(lgrp_id_t lgrpid);
618 void lgrp_plat_config(lgrp_config_flag_t, uintptr_t);
619 lgrp_handle_t lgrp_plat_cpu_to_hand(processorid_t);
620 lgrp_handle_t lgrp_plat_pfn_to_hand(pfn_t);
621 int lgrp_plat_max_lgrps(void);
622 pgcnt_t lgrp_plat_mem_size(lgrp_handle_t, lgrp_mem_query_t);
623 int lgrp_plat_latency(lgrp_handle_t, lgrp_handle_t);
624 lgrp_handle_t lgrp_plat_root_hand(void);
625
626 extern uint32_t lgrp_expand_proc_thresh;
627 extern uint32_t lgrp_expand_proc_diff;
628 extern pgcnt_t lgrp_mem_free_thresh;
629 extern uint32_t lgrp_loadavg_tolerance;
630 extern uint32_t lgrp_loadavg_max_effect;
631 extern uint32_t lgrp_load_thresh;
632 extern lgrp_mem_policy_t lgrp_mem_policy_root;
633
634 #endif /* _KERNEL && _KMEMUSER */
635
636 #ifdef __cplusplus
637 }
638 #endif
639
640 #endif /* _LGRP_H */
|
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 /*
23 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
25 *
26 * Copyright 2017 RackTop Systems.
27 */
28
29 #ifndef _LGRP_H
30 #define _LGRP_H
31
32 /*
33 * locality group definitions for kernel
34 */
35
36 #include <sys/types.h>
37
38 #ifdef __cplusplus
39 extern "C" {
40 #endif
41
42 #define LGRP_NONE (-1) /* non-existent lgroup ID */
43
44 #if !defined(_KERNEL) && !defined(_FAKE_KERNEL) && !defined(_KMEMUSER)
45 typedef struct lgrp_mem_policy_info { int opaque[2]; } lgrp_mem_policy_info_t;
46 #endif /* !_KERNEL && !_FAKE_KERNEL && !_KMEMUSER */
47
48 #if defined(_KERNEL) || defined(_FAKE_KERNEL) || defined(_KMEMUSER)
49 #include <sys/cpuvar.h>
50 #include <sys/bitmap.h>
51 #include <sys/vnode.h>
52 #include <vm/anon.h>
53 #include <vm/seg.h>
54 #include <sys/lgrp_user.h>
55 #include <sys/param.h>
56
57 typedef uint32_t lgrp_load_t; /* lgrp_loadavg type */
58 typedef uintptr_t lgrp_handle_t; /* lgrp handle */
59
60 #define LGRP_NONE_SUCH LGRP_NONE /* non-existent lgroup ID */
61 /* null platform handle */
62 #define LGRP_NULL_HANDLE ((lgrp_handle_t)0xbadbad)
63 #define LGRP_DEFAULT_HANDLE ((lgrp_handle_t)0xbabecafe) /* uma handle */
64 #define LGRP_ROOTID (0) /* root lgroup ID */
65
66 /*
67 * Maximum number of lgrps a platform may define.
68 */
616
617 /* platform interfaces */
618 void lgrp_plat_init(lgrp_init_stages_t);
619 lgrp_t *lgrp_plat_alloc(lgrp_id_t lgrpid);
620 void lgrp_plat_config(lgrp_config_flag_t, uintptr_t);
621 lgrp_handle_t lgrp_plat_cpu_to_hand(processorid_t);
622 lgrp_handle_t lgrp_plat_pfn_to_hand(pfn_t);
623 int lgrp_plat_max_lgrps(void);
624 pgcnt_t lgrp_plat_mem_size(lgrp_handle_t, lgrp_mem_query_t);
625 int lgrp_plat_latency(lgrp_handle_t, lgrp_handle_t);
626 lgrp_handle_t lgrp_plat_root_hand(void);
627
628 extern uint32_t lgrp_expand_proc_thresh;
629 extern uint32_t lgrp_expand_proc_diff;
630 extern pgcnt_t lgrp_mem_free_thresh;
631 extern uint32_t lgrp_loadavg_tolerance;
632 extern uint32_t lgrp_loadavg_max_effect;
633 extern uint32_t lgrp_load_thresh;
634 extern lgrp_mem_policy_t lgrp_mem_policy_root;
635
636 #endif /* _KERNEL || _FAKE_KERNEL || _KMEMUSER */
637
638 #ifdef __cplusplus
639 }
640 #endif
641
642 #endif /* _LGRP_H */
|