Mercurial > hg > graal-jvmci-8
comparison src/os/linux/vm/os_linux.cpp @ 4854:de268c8a8075
7082553: Interpret Thread.setPriority(Thread.MAX_PRIORITY) to mean FX60 on Solaris 10 and 11
Summary: Add CriticalPriority == MaxPriority+1 and enable scheduling class as well as thread priority to change on Solaris.
Reviewed-by: dholmes, dcubed
author | phh |
---|---|
date | Thu, 26 Jan 2012 20:06:06 -0500 |
parents | d7e3846464d0 |
children | 33df1aeaebbf 9eaf473fff9b |
comparison
equal
deleted
inserted
replaced
4853:6db63e782d3d | 4854:de268c8a8075 |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved. | 2 * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * | 4 * |
5 * This code is free software; you can redistribute it and/or modify it | 5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as | 6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
3381 // not the entire user process, and user level threads are 1:1 mapped to kernel | 3381 // not the entire user process, and user level threads are 1:1 mapped to kernel |
3382 // threads. It has always been the case, but could change in the future. For | 3382 // threads. It has always been the case, but could change in the future. For |
3383 // this reason, the code should not be used as default (ThreadPriorityPolicy=0). | 3383 // this reason, the code should not be used as default (ThreadPriorityPolicy=0). |
3384 // It is only used when ThreadPriorityPolicy=1 and requires root privilege. | 3384 // It is only used when ThreadPriorityPolicy=1 and requires root privilege. |
3385 | 3385 |
3386 int os::java_to_os_priority[MaxPriority + 1] = { | 3386 int os::java_to_os_priority[CriticalPriority + 1] = { |
3387 19, // 0 Entry should never be used | 3387 19, // 0 Entry should never be used |
3388 | 3388 |
3389 4, // 1 MinPriority | 3389 4, // 1 MinPriority |
3390 3, // 2 | 3390 3, // 2 |
3391 2, // 3 | 3391 2, // 3 |
3396 | 3396 |
3397 -2, // 7 | 3397 -2, // 7 |
3398 -3, // 8 | 3398 -3, // 8 |
3399 -4, // 9 NearMaxPriority | 3399 -4, // 9 NearMaxPriority |
3400 | 3400 |
3401 -5 // 10 MaxPriority | 3401 -5, // 10 MaxPriority |
3402 | |
3403 -5 // 11 CriticalPriority | |
3402 }; | 3404 }; |
3403 | 3405 |
3404 static int prio_init() { | 3406 static int prio_init() { |
3405 if (ThreadPriorityPolicy == 1) { | 3407 if (ThreadPriorityPolicy == 1) { |
3406 // Only root can raise thread priority. Don't allow ThreadPriorityPolicy=1 | 3408 // Only root can raise thread priority. Don't allow ThreadPriorityPolicy=1 |
3410 if (!FLAG_IS_DEFAULT(ThreadPriorityPolicy)) { | 3412 if (!FLAG_IS_DEFAULT(ThreadPriorityPolicy)) { |
3411 warning("-XX:ThreadPriorityPolicy requires root privilege on Linux"); | 3413 warning("-XX:ThreadPriorityPolicy requires root privilege on Linux"); |
3412 } | 3414 } |
3413 ThreadPriorityPolicy = 0; | 3415 ThreadPriorityPolicy = 0; |
3414 } | 3416 } |
3417 } | |
3418 if (UseCriticalJavaThreadPriority) { | |
3419 os::java_to_os_priority[MaxPriority] = os::java_to_os_priority[CriticalPriority]; | |
3415 } | 3420 } |
3416 return 0; | 3421 return 0; |
3417 } | 3422 } |
3418 | 3423 |
3419 OSReturn os::set_native_priority(Thread* thread, int newpri) { | 3424 OSReturn os::set_native_priority(Thread* thread, int newpri) { |