cmt.h revision fb2f18f820d90b001aea4fb27dd654bc1263c440
fb2f18f820d90b001aea4fb27dd654bc1263c440esaxe/*
fb2f18f820d90b001aea4fb27dd654bc1263c440esaxe * CDDL HEADER START
fb2f18f820d90b001aea4fb27dd654bc1263c440esaxe *
fb2f18f820d90b001aea4fb27dd654bc1263c440esaxe * The contents of this file are subject to the terms of the
fb2f18f820d90b001aea4fb27dd654bc1263c440esaxe * Common Development and Distribution License (the "License").
fb2f18f820d90b001aea4fb27dd654bc1263c440esaxe * You may not use this file except in compliance with the License.
fb2f18f820d90b001aea4fb27dd654bc1263c440esaxe *
fb2f18f820d90b001aea4fb27dd654bc1263c440esaxe * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
fb2f18f820d90b001aea4fb27dd654bc1263c440esaxe * or http://www.opensolaris.org/os/licensing.
fb2f18f820d90b001aea4fb27dd654bc1263c440esaxe * See the License for the specific language governing permissions
fb2f18f820d90b001aea4fb27dd654bc1263c440esaxe * and limitations under the License.
fb2f18f820d90b001aea4fb27dd654bc1263c440esaxe *
fb2f18f820d90b001aea4fb27dd654bc1263c440esaxe * When distributing Covered Code, include this CDDL HEADER in each
fb2f18f820d90b001aea4fb27dd654bc1263c440esaxe * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
fb2f18f820d90b001aea4fb27dd654bc1263c440esaxe * If applicable, add the following below this CDDL HEADER, with the
fb2f18f820d90b001aea4fb27dd654bc1263c440esaxe * fields enclosed by brackets "[]" replaced with your own identifying
fb2f18f820d90b001aea4fb27dd654bc1263c440esaxe * information: Portions Copyright [yyyy] [name of copyright owner]
fb2f18f820d90b001aea4fb27dd654bc1263c440esaxe *
fb2f18f820d90b001aea4fb27dd654bc1263c440esaxe * CDDL HEADER END
fb2f18f820d90b001aea4fb27dd654bc1263c440esaxe */
fb2f18f820d90b001aea4fb27dd654bc1263c440esaxe/*
fb2f18f820d90b001aea4fb27dd654bc1263c440esaxe * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
fb2f18f820d90b001aea4fb27dd654bc1263c440esaxe * Use is subject to license terms.
fb2f18f820d90b001aea4fb27dd654bc1263c440esaxe */
fb2f18f820d90b001aea4fb27dd654bc1263c440esaxe
fb2f18f820d90b001aea4fb27dd654bc1263c440esaxe#ifndef _CMT_H
fb2f18f820d90b001aea4fb27dd654bc1263c440esaxe#define _CMT_H
fb2f18f820d90b001aea4fb27dd654bc1263c440esaxe
fb2f18f820d90b001aea4fb27dd654bc1263c440esaxe#pragma ident "%Z%%M% %I% %E% SMI"
fb2f18f820d90b001aea4fb27dd654bc1263c440esaxe
fb2f18f820d90b001aea4fb27dd654bc1263c440esaxe/*
fb2f18f820d90b001aea4fb27dd654bc1263c440esaxe * CMT PG class
fb2f18f820d90b001aea4fb27dd654bc1263c440esaxe */
fb2f18f820d90b001aea4fb27dd654bc1263c440esaxe
fb2f18f820d90b001aea4fb27dd654bc1263c440esaxe#ifdef __cplusplus
fb2f18f820d90b001aea4fb27dd654bc1263c440esaxeextern "C" {
fb2f18f820d90b001aea4fb27dd654bc1263c440esaxe#endif
fb2f18f820d90b001aea4fb27dd654bc1263c440esaxe
fb2f18f820d90b001aea4fb27dd654bc1263c440esaxe#if (defined(_KERNEL) || defined(_KMEMUSER))
fb2f18f820d90b001aea4fb27dd654bc1263c440esaxe#include <sys/group.h>
fb2f18f820d90b001aea4fb27dd654bc1263c440esaxe#include <sys/pghw.h>
fb2f18f820d90b001aea4fb27dd654bc1263c440esaxe#include <sys/types.h>
fb2f18f820d90b001aea4fb27dd654bc1263c440esaxe
fb2f18f820d90b001aea4fb27dd654bc1263c440esaxe/*
fb2f18f820d90b001aea4fb27dd654bc1263c440esaxe * CMT pg structure
fb2f18f820d90b001aea4fb27dd654bc1263c440esaxe */
fb2f18f820d90b001aea4fb27dd654bc1263c440esaxetypedef struct pg_cmt {
fb2f18f820d90b001aea4fb27dd654bc1263c440esaxe struct pghw cmt_pg; /* physical grouping */
fb2f18f820d90b001aea4fb27dd654bc1263c440esaxe struct group *cmt_siblings; /* CMT PGs to balance with */
fb2f18f820d90b001aea4fb27dd654bc1263c440esaxe struct pg_cmt *cmt_parent; /* Parent CMT PG */
fb2f18f820d90b001aea4fb27dd654bc1263c440esaxe struct group *cmt_children; /* Active children CMT PGs */
fb2f18f820d90b001aea4fb27dd654bc1263c440esaxe int cmt_nchildren; /* # of children CMT PGs */
fb2f18f820d90b001aea4fb27dd654bc1263c440esaxe int cmt_hint; /* hint for balancing */
fb2f18f820d90b001aea4fb27dd654bc1263c440esaxe uint32_t cmt_nrunning; /* # of running threads */
fb2f18f820d90b001aea4fb27dd654bc1263c440esaxe struct group cmt_cpus_actv;
fb2f18f820d90b001aea4fb27dd654bc1263c440esaxe bitset_t cmt_cpus_actv_set; /* bitset of active CPUs */
fb2f18f820d90b001aea4fb27dd654bc1263c440esaxe} pg_cmt_t;
fb2f18f820d90b001aea4fb27dd654bc1263c440esaxe
fb2f18f820d90b001aea4fb27dd654bc1263c440esaxe
fb2f18f820d90b001aea4fb27dd654bc1263c440esaxe/*
fb2f18f820d90b001aea4fb27dd654bc1263c440esaxe * Change the number of running threads on the pg
fb2f18f820d90b001aea4fb27dd654bc1263c440esaxe */
fb2f18f820d90b001aea4fb27dd654bc1263c440esaxe#define PG_NRUN_UPDATE(cp, n) (pg_cmt_load((cp), (n)))
fb2f18f820d90b001aea4fb27dd654bc1263c440esaxe
fb2f18f820d90b001aea4fb27dd654bc1263c440esaxevoid pg_cmt_load(cpu_t *, int);
fb2f18f820d90b001aea4fb27dd654bc1263c440esaxevoid pg_cmt_cpu_startup(cpu_t *);
fb2f18f820d90b001aea4fb27dd654bc1263c440esaxeint pg_cmt_can_migrate(cpu_t *, cpu_t *);
fb2f18f820d90b001aea4fb27dd654bc1263c440esaxe
fb2f18f820d90b001aea4fb27dd654bc1263c440esaxe#endif /* !_KERNEL && !_KMEMUSER */
fb2f18f820d90b001aea4fb27dd654bc1263c440esaxe
fb2f18f820d90b001aea4fb27dd654bc1263c440esaxe#ifdef __cplusplus
fb2f18f820d90b001aea4fb27dd654bc1263c440esaxe}
fb2f18f820d90b001aea4fb27dd654bc1263c440esaxe#endif
fb2f18f820d90b001aea4fb27dd654bc1263c440esaxe
fb2f18f820d90b001aea4fb27dd654bc1263c440esaxe#endif /* _CMT_H */