Print this page
8115 parallel zfs mount
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/uts/common/sys/cpupart.h
+++ new/usr/src/uts/common/sys/cpupart.h
1 1 /*
2 2 * CDDL HEADER START
3 3 *
4 4 * The contents of this file are subject to the terms of the
5 5 * Common Development and Distribution License (the "License").
6 6 * You may not use this file except in compliance with the License.
7 7 *
8 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 9 * or http://www.opensolaris.org/os/licensing.
10 10 * See the License for the specific language governing permissions
11 11 * and limitations under the License.
12 12 *
↓ open down ↓ |
12 lines elided |
↑ open up ↑ |
13 13 * When distributing Covered Code, include this CDDL HEADER in each
14 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 15 * If applicable, add the following below this CDDL HEADER, with the
16 16 * fields enclosed by brackets "[]" replaced with your own identifying
17 17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 18 *
19 19 * CDDL HEADER END
20 20 */
21 21 /*
22 22 * Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved.
23 + * Copyright 2017 RackTop Systems.
23 24 */
24 25
25 26 #ifndef _SYS_CPUPART_H
26 27 #define _SYS_CPUPART_H
27 28
28 29 #include <sys/types.h>
29 30 #include <sys/processor.h>
30 31 #include <sys/cpuvar.h>
31 32 #include <sys/disp.h>
32 33 #include <sys/pset.h>
33 34 #include <sys/lgrp.h>
34 35 #include <sys/lgrp_user.h>
35 36 #include <sys/pg.h>
36 37 #include <sys/bitset.h>
37 38 #include <sys/time.h>
38 39
39 40 #ifdef __cplusplus
40 41 extern "C" {
41 42 #endif
42 43
43 -#ifdef _KERNEL
44 +#if defined(_KERNEL) || defined(_FAKE_KERNEL)
44 45
45 46 typedef int cpupartid_t;
46 47
47 48 /*
48 49 * Special partition id.
49 50 */
50 51 #define CP_DEFAULT 0
51 52
52 53 /*
53 54 * Flags for cpupart_list()
54 55 */
55 56 #define CP_ALL 0 /* return all cpu partitions */
56 57 #define CP_NONEMPTY 1 /* return only non-empty ones */
57 58
58 59 typedef struct cpupart {
59 60 disp_t cp_kp_queue; /* partition-wide kpreempt queue */
60 61 cpupartid_t cp_id; /* partition ID */
61 62 int cp_ncpus; /* number of online processors */
62 63 struct cpupart *cp_next; /* next partition in list */
63 64 struct cpupart *cp_prev; /* previous partition in list */
64 65 struct cpu *cp_cpulist; /* processor list */
65 66 struct kstat *cp_kstat; /* per-partition statistics */
66 67
67 68 /*
68 69 * cp_nrunnable and cp_nrunning are used to calculate load average.
69 70 */
70 71 uint_t cp_nrunnable; /* current # of runnable threads */
71 72 uint_t cp_nrunning; /* current # of running threads */
72 73
73 74 /*
74 75 * cp_updates, cp_nrunnable_cum, cp_nwaiting_cum, and cp_hp_avenrun
75 76 * are used to generate kstat information on an as-needed basis.
76 77 */
77 78 uint64_t cp_updates; /* number of statistics updates */
78 79 uint64_t cp_nrunnable_cum; /* cum. # of runnable threads */
79 80 uint64_t cp_nwaiting_cum; /* cum. # of waiting threads */
80 81
81 82 struct loadavg_s cp_loadavg; /* cpupart loadavg */
82 83
83 84 klgrpset_t cp_lgrpset; /* set of lgroups on which this */
84 85 /* partition has cpus */
85 86 lpl_t *cp_lgrploads; /* table of load averages for this */
86 87 /* partition, indexed by lgrp ID */
87 88 int cp_nlgrploads; /* size of cp_lgrploads table */
88 89 uint64_t cp_hp_avenrun[3]; /* high-precision load average */
89 90 uint_t cp_attr; /* bitmask of attributes */
90 91 lgrp_gen_t cp_gen; /* generation number */
91 92 lgrp_id_t cp_lgrp_hint; /* last home lgroup chosen */
92 93 bitset_t cp_cmt_pgs; /* CMT PGs represented */
93 94 bitset_t cp_haltset; /* halted CPUs */
94 95 } cpupart_t;
95 96
96 97 typedef struct cpupart_kstat {
97 98 kstat_named_t cpk_updates; /* number of updates */
98 99 kstat_named_t cpk_runnable; /* cum # of runnable threads */
99 100 kstat_named_t cpk_waiting; /* cum # waiting for I/O */
100 101 kstat_named_t cpk_ncpus; /* current # of CPUs */
101 102 kstat_named_t cpk_avenrun_1min; /* 1-minute load average */
102 103 kstat_named_t cpk_avenrun_5min; /* 5-minute load average */
103 104 kstat_named_t cpk_avenrun_15min; /* 15-minute load average */
104 105 } cpupart_kstat_t;
105 106
106 107 /*
107 108 * Macro to obtain the maximum run priority for the global queue associated
108 109 * with given cpu partition.
109 110 */
110 111 #define CP_MAXRUNPRI(cp) ((cp)->cp_kp_queue.disp_maxrunpri)
111 112
112 113 /*
113 114 * This macro is used to determine if the given thread must surrender
114 115 * CPU to higher priority runnable threads on one of its dispatch queues.
115 116 * This should really be defined in <sys/disp.h> but it is not because
116 117 * including <sys/cpupart.h> there would cause recursive includes.
117 118 */
118 119 #define DISP_MUST_SURRENDER(t) \
119 120 ((DISP_MAXRUNPRI(t) > DISP_PRIO(t)) || \
120 121 (CP_MAXRUNPRI(t->t_cpupart) > DISP_PRIO(t)))
121 122
122 123 extern cpupart_t cp_default;
123 124 extern cpupart_t *cp_list_head;
124 125 extern uint_t cp_numparts;
125 126 extern uint_t cp_numparts_nonempty;
126 127
127 128 /*
128 129 * Each partition contains a bitset that indicates which CPUs are halted and
129 130 * which ones are running. Given the growing number of CPUs in current and
130 131 * future platforms, it's important to fanout each CPU within its partition's
131 132 * haltset to prevent contention due to false sharing. The fanout factor
132 133 * is platform specific, and declared accordingly.
133 134 */
134 135 extern uint_t cp_haltset_fanout;
135 136
136 137 extern void cpupart_initialize_default();
137 138 extern cpupart_t *cpupart_find(psetid_t);
138 139 extern int cpupart_create(psetid_t *);
139 140 extern int cpupart_destroy(psetid_t);
140 141 extern psetid_t cpupart_query_cpu(cpu_t *);
↓ open down ↓ |
87 lines elided |
↑ open up ↑ |
141 142 extern int cpupart_attach_cpu(psetid_t, cpu_t *, int);
142 143 extern int cpupart_get_cpus(psetid_t *, processorid_t *, uint_t *);
143 144 extern int cpupart_bind_thread(kthread_id_t, psetid_t, int, void *,
144 145 void *);
145 146 extern void cpupart_kpqalloc(pri_t);
146 147 extern int cpupart_get_loadavg(psetid_t, int *, int);
147 148 extern uint_t cpupart_list(psetid_t *, uint_t, int);
148 149 extern int cpupart_setattr(psetid_t, uint_t);
149 150 extern int cpupart_getattr(psetid_t, uint_t *);
150 151
151 -#endif /* _KERNEL */
152 +#endif /* _KERNEL || _FAKE_KERNEL */
152 153
153 154 #ifdef __cplusplus
154 155 }
155 156 #endif
156 157
157 158 #endif /* _SYS_CPUPART_H */
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX