1.1 --- a/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepThread.cpp Wed Jan 25 18:58:59 2012 -0800 1.2 +++ b/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepThread.cpp Thu Jan 26 20:06:06 2012 -0500 1.3 @@ -1,5 +1,5 @@ 1.4 /* 1.5 - * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved. 1.6 + * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved. 1.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.8 * 1.9 * This code is free software; you can redistribute it and/or modify it 1.10 @@ -75,10 +75,25 @@ 1.11 set_name("Concurrent Mark-Sweep GC Thread"); 1.12 1.13 if (os::create_thread(this, os::cgc_thread)) { 1.14 - // XXX: need to set this to low priority 1.15 - // unless "agressive mode" set; priority 1.16 - // should be just less than that of VMThread. 1.17 - os::set_priority(this, NearMaxPriority); 1.18 + // An old comment here said: "Priority should be just less 1.19 + // than that of VMThread". Since the VMThread runs at 1.20 + // NearMaxPriority, the old comment was inaccurate, but 1.21 + // changing the default priority to NearMaxPriority-1 1.22 + // could change current behavior, so the default of 1.23 + // NearMaxPriority stays in place. 1.24 + // 1.25 + // Note that there's a possibility of the VMThread 1.26 + // starving if UseCriticalCMSThreadPriority is on. 1.27 + // That won't happen on Solaris for various reasons, 1.28 + // but may well happen on non-Solaris platforms. 1.29 + int native_prio; 1.30 + if (UseCriticalCMSThreadPriority) { 1.31 + native_prio = os::java_to_os_priority[CriticalPriority]; 1.32 + } else { 1.33 + native_prio = os::java_to_os_priority[NearMaxPriority]; 1.34 + } 1.35 + os::set_native_priority(this, native_prio); 1.36 + 1.37 if (!DisableStartThread) { 1.38 os::start_thread(this); 1.39 }