xref: /titanic_53/usr/src/uts/common/sys/cmt.h (revision fb2f18f820d90b001aea4fb27dd654bc1263c440)
1*fb2f18f8Sesaxe /*
2*fb2f18f8Sesaxe  * CDDL HEADER START
3*fb2f18f8Sesaxe  *
4*fb2f18f8Sesaxe  * The contents of this file are subject to the terms of the
5*fb2f18f8Sesaxe  * Common Development and Distribution License (the "License").
6*fb2f18f8Sesaxe  * You may not use this file except in compliance with the License.
7*fb2f18f8Sesaxe  *
8*fb2f18f8Sesaxe  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9*fb2f18f8Sesaxe  * or http://www.opensolaris.org/os/licensing.
10*fb2f18f8Sesaxe  * See the License for the specific language governing permissions
11*fb2f18f8Sesaxe  * and limitations under the License.
12*fb2f18f8Sesaxe  *
13*fb2f18f8Sesaxe  * When distributing Covered Code, include this CDDL HEADER in each
14*fb2f18f8Sesaxe  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15*fb2f18f8Sesaxe  * If applicable, add the following below this CDDL HEADER, with the
16*fb2f18f8Sesaxe  * fields enclosed by brackets "[]" replaced with your own identifying
17*fb2f18f8Sesaxe  * information: Portions Copyright [yyyy] [name of copyright owner]
18*fb2f18f8Sesaxe  *
19*fb2f18f8Sesaxe  * CDDL HEADER END
20*fb2f18f8Sesaxe  */
21*fb2f18f8Sesaxe /*
22*fb2f18f8Sesaxe  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
23*fb2f18f8Sesaxe  * Use is subject to license terms.
24*fb2f18f8Sesaxe  */
25*fb2f18f8Sesaxe 
26*fb2f18f8Sesaxe #ifndef	_CMT_H
27*fb2f18f8Sesaxe #define	_CMT_H
28*fb2f18f8Sesaxe 
29*fb2f18f8Sesaxe #pragma ident	"%Z%%M%	%I%	%E% SMI"
30*fb2f18f8Sesaxe 
31*fb2f18f8Sesaxe /*
32*fb2f18f8Sesaxe  * CMT PG class
33*fb2f18f8Sesaxe  */
34*fb2f18f8Sesaxe 
35*fb2f18f8Sesaxe #ifdef	__cplusplus
36*fb2f18f8Sesaxe extern "C" {
37*fb2f18f8Sesaxe #endif
38*fb2f18f8Sesaxe 
39*fb2f18f8Sesaxe #if (defined(_KERNEL) || defined(_KMEMUSER))
40*fb2f18f8Sesaxe #include <sys/group.h>
41*fb2f18f8Sesaxe #include <sys/pghw.h>
42*fb2f18f8Sesaxe #include <sys/types.h>
43*fb2f18f8Sesaxe 
44*fb2f18f8Sesaxe /*
45*fb2f18f8Sesaxe  * CMT pg structure
46*fb2f18f8Sesaxe  */
47*fb2f18f8Sesaxe typedef struct pg_cmt {
48*fb2f18f8Sesaxe 	struct pghw	cmt_pg;			/* physical grouping */
49*fb2f18f8Sesaxe 	struct group	*cmt_siblings;		/* CMT PGs to balance with */
50*fb2f18f8Sesaxe 	struct pg_cmt	*cmt_parent;		/* Parent CMT PG */
51*fb2f18f8Sesaxe 	struct group	*cmt_children;		/* Active children CMT PGs */
52*fb2f18f8Sesaxe 	int		cmt_nchildren;		/* # of children CMT PGs */
53*fb2f18f8Sesaxe 	int		cmt_hint;		/* hint for balancing */
54*fb2f18f8Sesaxe 	uint32_t	cmt_nrunning;		/* # of running threads */
55*fb2f18f8Sesaxe 	struct group	cmt_cpus_actv;
56*fb2f18f8Sesaxe 	bitset_t	cmt_cpus_actv_set;	/* bitset of active CPUs */
57*fb2f18f8Sesaxe } pg_cmt_t;
58*fb2f18f8Sesaxe 
59*fb2f18f8Sesaxe 
60*fb2f18f8Sesaxe /*
61*fb2f18f8Sesaxe  * Change the number of running threads on the pg
62*fb2f18f8Sesaxe  */
63*fb2f18f8Sesaxe #define	PG_NRUN_UPDATE(cp, n)	(pg_cmt_load((cp), (n)))
64*fb2f18f8Sesaxe 
65*fb2f18f8Sesaxe void		pg_cmt_load(cpu_t *, int);
66*fb2f18f8Sesaxe void		pg_cmt_cpu_startup(cpu_t *);
67*fb2f18f8Sesaxe int		pg_cmt_can_migrate(cpu_t *, cpu_t *);
68*fb2f18f8Sesaxe 
69*fb2f18f8Sesaxe #endif	/* !_KERNEL && !_KMEMUSER */
70*fb2f18f8Sesaxe 
71*fb2f18f8Sesaxe #ifdef	__cplusplus
72*fb2f18f8Sesaxe }
73*fb2f18f8Sesaxe #endif
74*fb2f18f8Sesaxe 
75*fb2f18f8Sesaxe #endif /* _CMT_H */
76