cpupart.h revision 0542eecf8a04bde577ee69151dfe367a36053e40
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
*/
#ifndef _SYS_CPUPART_H
#define _SYS_CPUPART_H
#include <sys/processor.h>
#include <sys/lgrp_user.h>
#ifdef __cplusplus
extern "C" {
#endif
#ifdef _KERNEL
typedef int cpupartid_t;
/*
* Special partition id.
*/
#define CP_DEFAULT 0
/*
* Flags for cpupart_list()
*/
#define CP_ALL 0 /* return all cpu partitions */
typedef struct cpupart {
int cp_ncpus; /* number of online processors */
/*
* cp_nrunnable and cp_nrunning are used to calculate load average.
*/
/*
* cp_updates, cp_nrunnable_cum, cp_nwaiting_cum, and cp_hp_avenrun
* are used to generate kstat information on an as-needed basis.
*/
/* partition has cpus */
/* partition, indexed by lgrp ID */
int cp_nlgrploads; /* size of cp_lgrploads table */
} cpupart_t;
typedef struct cpupart_kstat {
/*
* Macro to obtain the maximum run priority for the global queue associated
* with given cpu partition.
*/
/*
* This macro is used to determine if the given thread must surrender
* CPU to higher priority runnable threads on one of its dispatch queues.
*/
#define DISP_MUST_SURRENDER(t) \
((DISP_MAXRUNPRI(t) > DISP_PRIO(t)) || \
extern cpupart_t cp_default;
extern cpupart_t *cp_list_head;
extern uint_t cp_numparts;
extern uint_t cp_numparts_nonempty;
/*
* Each partition contains a bitset that indicates which CPUs are halted and
* which ones are running. Given the growing number of CPUs in current and
* future platforms, it's important to fanout each CPU within its partition's
* haltset to prevent contention due to false sharing. The fanout factor
* is platform specific, and declared accordingly.
*/
extern uint_t cp_haltset_fanout;
extern void cpupart_initialize_default();
extern int cpupart_create(psetid_t *);
extern int cpupart_destroy(psetid_t);
void *);
extern void cpupart_kpqalloc(pri_t);
extern int cpupart_get_loadavg(psetid_t, int *, int);
#endif /* _KERNEL */
#ifdef __cplusplus
}
#endif
#endif /* _SYS_CPUPART_H */