kern_umtx.c (163697) | kern_umtx.c (163709) |
---|---|
1/*- 2 * Copyright (c) 2004, David Xu <davidxu@freebsd.org> 3 * Copyright (c) 2002, Jeffrey Roberson <jeff@freebsd.org> 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 12 unchanged lines hidden (view full) --- 21 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 25 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 */ 27 28#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2004, David Xu <davidxu@freebsd.org> 3 * Copyright (c) 2002, Jeffrey Roberson <jeff@freebsd.org> 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 12 unchanged lines hidden (view full) --- 21 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 25 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 */ 27 28#include <sys/cdefs.h> |
29__FBSDID("$FreeBSD: head/sys/kern/kern_umtx.c 163697 2006-10-26 09:33:34Z davidxu $"); | 29__FBSDID("$FreeBSD: head/sys/kern/kern_umtx.c 163709 2006-10-26 21:42:22Z jb $"); |
30 31#include "opt_compat.h" 32#include <sys/param.h> 33#include <sys/kernel.h> 34#include <sys/limits.h> 35#include <sys/lock.h> 36#include <sys/malloc.h> 37#include <sys/mutex.h> --- 123 unchanged lines hidden (view full) --- 161 * Don't propagate time-sharing priority, there is a security reason, 162 * a user can simply introduce PI-mutex, let thread A lock the mutex, 163 * and let another thread B block on the mutex, because B is 164 * sleeping, its priority will be boosted, this causes A's priority to 165 * be boosted via priority propagating too and will never be lowered even 166 * if it is using 100%CPU, this is unfair to other processes. 167 */ 168 | 30 31#include "opt_compat.h" 32#include <sys/param.h> 33#include <sys/kernel.h> 34#include <sys/limits.h> 35#include <sys/lock.h> 36#include <sys/malloc.h> 37#include <sys/mutex.h> --- 123 unchanged lines hidden (view full) --- 161 * Don't propagate time-sharing priority, there is a security reason, 162 * a user can simply introduce PI-mutex, let thread A lock the mutex, 163 * and let another thread B block on the mutex, because B is 164 * sleeping, its priority will be boosted, this causes A's priority to 165 * be boosted via priority propagating too and will never be lowered even 166 * if it is using 100%CPU, this is unfair to other processes. 167 */ 168 |
169#ifdef KSE |
|
169#define UPRI(td) (((td)->td_ksegrp->kg_user_pri >= PRI_MIN_TIMESHARE &&\ 170 (td)->td_ksegrp->kg_user_pri <= PRI_MAX_TIMESHARE) ?\ 171 PRI_MAX_TIMESHARE : (td)->td_ksegrp->kg_user_pri) | 170#define UPRI(td) (((td)->td_ksegrp->kg_user_pri >= PRI_MIN_TIMESHARE &&\ 171 (td)->td_ksegrp->kg_user_pri <= PRI_MAX_TIMESHARE) ?\ 172 PRI_MAX_TIMESHARE : (td)->td_ksegrp->kg_user_pri) |
173#else 174#define UPRI(td) (((td)->td_user_pri >= PRI_MIN_TIMESHARE &&\ 175 (td)->td_user_pri <= PRI_MAX_TIMESHARE) ?\ 176 PRI_MAX_TIMESHARE : (td)->td_user_pri) 177#endif |
|
172 173#define GOLDEN_RATIO_PRIME 2654404609U 174#define UMTX_CHAINS 128 175#define UMTX_SHIFTS (__WORD_BIT - 7) 176 177#define THREAD_SHARE 0 178#define PROCESS_SHARE 1 179#define AUTO_SHARE 2 --- 2309 unchanged lines hidden --- | 178 179#define GOLDEN_RATIO_PRIME 2654404609U 180#define UMTX_CHAINS 128 181#define UMTX_SHIFTS (__WORD_BIT - 7) 182 183#define THREAD_SHARE 0 184#define PROCESS_SHARE 1 185#define AUTO_SHARE 2 --- 2309 unchanged lines hidden --- |