7082553: Interpret Thread.setPriority(Thread.MAX_PRIORITY) to mean FX60 on Solaris 10 and 11

Add CriticalPriority == MaxPriority+1 and enable scheduling class as well as thread priority to change on Solaris.

Reviewed-by: dholmes, dcubed
This commit is contained in:
Paul Hohensee 2012-01-26 20:06:06 -05:00
parent 7ece654913
commit 09e21afaaa
9 changed files with 289 additions and 140 deletions

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -3296,7 +3296,7 @@ void os::yield_all(int attempts) {
// so we compress Java's ten down to seven. It would be better
// if we dynamically adjusted relative priorities.
int os::java_to_os_priority[MaxPriority + 1] = {
int os::java_to_os_priority[CriticalPriority + 1] = {
THREAD_PRIORITY_IDLE, // 0 Entry should never be used
THREAD_PRIORITY_LOWEST, // 1 MinPriority
THREAD_PRIORITY_LOWEST, // 2
@ -3307,10 +3307,11 @@ int os::java_to_os_priority[MaxPriority + 1] = {
THREAD_PRIORITY_ABOVE_NORMAL, // 7
THREAD_PRIORITY_ABOVE_NORMAL, // 8
THREAD_PRIORITY_HIGHEST, // 9 NearMaxPriority
THREAD_PRIORITY_HIGHEST // 10 MaxPriority
THREAD_PRIORITY_HIGHEST, // 10 MaxPriority
THREAD_PRIORITY_HIGHEST // 11 CriticalPriority
};
int prio_policy1[MaxPriority + 1] = {
int prio_policy1[CriticalPriority + 1] = {
THREAD_PRIORITY_IDLE, // 0 Entry should never be used
THREAD_PRIORITY_LOWEST, // 1 MinPriority
THREAD_PRIORITY_LOWEST, // 2
@ -3321,17 +3322,21 @@ int prio_policy1[MaxPriority + 1] = {
THREAD_PRIORITY_ABOVE_NORMAL, // 7
THREAD_PRIORITY_HIGHEST, // 8
THREAD_PRIORITY_HIGHEST, // 9 NearMaxPriority
THREAD_PRIORITY_TIME_CRITICAL // 10 MaxPriority
THREAD_PRIORITY_TIME_CRITICAL, // 10 MaxPriority
THREAD_PRIORITY_TIME_CRITICAL // 11 CriticalPriority
};
static int prio_init() {
// If ThreadPriorityPolicy is 1, switch tables
if (ThreadPriorityPolicy == 1) {
int i;
for (i = 0; i < MaxPriority + 1; i++) {
for (i = 0; i < CriticalPriority + 1; i++) {
os::java_to_os_priority[i] = prio_policy1[i];
}
}
if (UseCriticalJavaThreadPriority) {
os::java_to_os_priority[MaxPriority] = os::java_to_os_priority[CriticalPriority] ;
}
return 0;
}