diff options
author | akolb <none@none> | 2008-03-26 21:07:48 -0700 |
---|---|---|
committer | akolb <none@none> | 2008-03-26 21:07:48 -0700 |
commit | 0b70c4673a08649be68425e869e9d6357ea777a4 (patch) | |
tree | 732cf84e22666b6a803adf00ea6755970c401e76 /usr/src/uts/common/sys | |
parent | 78ed97a7b79b59ef2ef41f190c9be35c54d90119 (diff) | |
download | illumos-joyent-0b70c4673a08649be68425e869e9d6357ea777a4.tar.gz |
PSARC 2008/138 Soft CPU and processor set bindings
6656791 Weaker CPU and processor set bindings is useful
Diffstat (limited to 'usr/src/uts/common/sys')
-rw-r--r-- | usr/src/uts/common/sys/cpuvar.h | 2 | ||||
-rw-r--r-- | usr/src/uts/common/sys/processor.h | 5 | ||||
-rw-r--r-- | usr/src/uts/common/sys/pset.h | 10 | ||||
-rw-r--r-- | usr/src/uts/common/sys/thread.h | 18 |
4 files changed, 29 insertions, 6 deletions
diff --git a/usr/src/uts/common/sys/cpuvar.h b/usr/src/uts/common/sys/cpuvar.h index c7b76b32ea..cd0d027866 100644 --- a/usr/src/uts/common/sys/cpuvar.h +++ b/usr/src/uts/common/sys/cpuvar.h @@ -668,7 +668,7 @@ void cpu_destroy_bound_threads(cpu_t *cp); extern int cpu_bind_thread(kthread_t *tp, processorid_t bind, processorid_t *obind, int *error); -extern int cpu_unbind(processorid_t cpu_id); +extern int cpu_unbind(processorid_t cpu_id, boolean_t force); extern void thread_affinity_set(kthread_t *t, int cpu_id); extern void thread_affinity_clear(kthread_t *t); extern void affinity_set(int cpu_id); diff --git a/usr/src/uts/common/sys/processor.h b/usr/src/uts/common/sys/processor.h index 4d6f90e988..3a76c8c9b4 100644 --- a/usr/src/uts/common/sys/processor.h +++ b/usr/src/uts/common/sys/processor.h @@ -25,7 +25,7 @@ */ /* - * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -106,6 +106,9 @@ typedef struct { */ #define PBIND_NONE -1 /* LWP/thread is not bound */ #define PBIND_QUERY -2 /* don't set, just return the binding */ +#define PBIND_HARD -3 /* prevents offlining CPU (default) */ +#define PBIND_SOFT -4 /* allows offlining CPU */ +#define PBIND_QUERY_TYPE -5 /* Return binding type */ /* * User-level system call interface prototypes diff --git a/usr/src/uts/common/sys/pset.h b/usr/src/uts/common/sys/pset.h index 395b3850a8..f98e327620 100644 --- a/usr/src/uts/common/sys/pset.h +++ b/usr/src/uts/common/sys/pset.h @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * 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 * or http://www.opensolaris.org/os/licensing. @@ -20,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -45,6 +44,9 @@ typedef int psetid_t; #define PS_NONE -1 #define PS_QUERY -2 #define PS_MYID -3 +#define PS_SOFT -4 +#define PS_HARD -5 +#define PS_QUERY_TYPE -6 /* types of processor sets */ #define PS_SYSTEM 1 diff --git a/usr/src/uts/common/sys/thread.h b/usr/src/uts/common/sys/thread.h index 6fced086b3..eee18d53f9 100644 --- a/usr/src/uts/common/sys/thread.h +++ b/usr/src/uts/common/sys/thread.h @@ -125,6 +125,7 @@ typedef struct _kthread { pri_t t_epri; /* inherited thread priority */ pri_t t_cpri; /* thread scheduling class priority */ char t_writer; /* sleeping in lwp_rwlock_lock(RW_WRITE_LOCK) */ + uchar_t t_bindflag; /* CPU and pset binding type */ label_t t_pcb; /* pcb, save area when switching */ lwpchan_t t_lwpchan; /* reason for blocking */ #define t_wchan0 t_lwpchan.lc_wchan0 @@ -415,6 +416,21 @@ typedef struct _kthread { #define TS_ANYWAITQ (TS_PROJWAITQ|TS_ZONEWAITQ) /* + * Thread binding types + */ +#define TB_ALLHARD 0 +#define TB_CPU_SOFT 0x01 /* soft binding to CPU */ +#define TB_PSET_SOFT 0x02 /* soft binding to pset */ + +#define TB_CPU_SOFT_SET(t) ((t)->t_bindflag |= TB_CPU_SOFT) +#define TB_CPU_HARD_SET(t) ((t)->t_bindflag &= ~TB_CPU_SOFT) +#define TB_PSET_SOFT_SET(t) ((t)->t_bindflag |= TB_PSET_SOFT) +#define TB_PSET_HARD_SET(t) ((t)->t_bindflag &= ~TB_PSET_SOFT) +#define TB_CPU_IS_SOFT(t) ((t)->t_bindflag & TB_CPU_SOFT) +#define TB_CPU_IS_HARD(t) (!TB_CPU_IS_SOFT(t)) +#define TB_PSET_IS_SOFT(t) ((t)->t_bindflag & TB_PSET_SOFT) + +/* * No locking needed for AST field. */ #define aston(t) ((t)->t_astflag = 1) @@ -564,6 +580,8 @@ extern disp_lock_t stop_lock; /* lock protecting stopped threads */ caddr_t thread_stk_init(caddr_t); /* init thread stack */ +extern int default_binding_mode; + #endif /* _KERNEL */ /* |