SUGGESTED FIX
*** src/share/vm/runtime/globals.hpp- Thu Nov 20 01:14:16 2008
--- src/share/vm/runtime/globals.hpp Tue Feb 17 10:42:44 2009
***************
*** 1,12 ****
#ifdef USE_PRAGMA_IDENT_HDR
! #pragma ident "@(#)globals.hpp 1.856 08/04/22 11:10:51 JVM"
#endif
/*
! * @(#)globals.hpp 1.856 08/04/22
*
! * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*/
typedef const char* ccstr; // string type alias used only in this file
--- 1,12 ----
#ifdef USE_PRAGMA_IDENT_HDR
! #pragma ident "%W% %E% %U% JVM"
#endif
/*
! * %W% %E%
*
! * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*/
typedef const char* ccstr; // string type alias used only in this file
***************
*** 1023,1032 ****
--- 1023,1035 ----
\
product(intx, ParCMSPromoteBlocksToClaim, 50, \
"Number of blocks to attempt to claim when refilling CMS LAB for "\
"parallel GC.") \
\
+ product(bool, AlwaysPreTouch, false, \
+ "It forces all freshly committed pages to be pre-touched.") \
+ \
product(bool, CMSIncrementalMode, false, \
"Whether CMS GC should operate in \"incremental\" mode") \
\
product(uintx, CMSIncrementalDutyCycle, 50, \
"CMS incremental mode duty cycle (a percentage, 0-100). If" \
*** src/share/vm/runtime/virtualspace.cpp- Thu Nov 20 01:14:16 2008
--- src/share/vm/runtime/virtualspace.cpp Tue Feb 17 10:43:42 2009
***************
*** 1,12 ****
#ifdef USE_PRAGMA_IDENT_SRC
! #pragma ident "@(#)virtualspace.cpp 1.55 05/08/04 15:43:29 JVM"
#endif
/*
! * @(#)virtualspace.cpp 1.55 05/08/04
*
! * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
* SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*/
#include "incls/_precompiled.incl"
#include "incls/_virtualspace.cpp.incl"
--- 1,12 ----
#ifdef USE_PRAGMA_IDENT_SRC
! #pragma ident "%W% %E% %U% JVM"
#endif
/*
! * %W% %E%
*
! * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*/
#include "incls/_precompiled.incl"
#include "incls/_virtualspace.cpp.incl"
***************
*** 307,316 ****
--- 307,317 ----
// don't commit memory if the entire space is pinned in memory
_high += bytes;
return true;
}
+ char* previous_high = high();
char* unaligned_new_high = high() + bytes;
assert(unaligned_new_high <= high_boundary(),
"cannot expand by more than upper boundary");
// Calculate where the new high for each of the regions should be. If
***************
*** 401,410 ****
--- 402,428 ----
} else {
_upper_high += upper_needs;
}
}
+ if (AlwaysPreTouch) {
+ int vm_ps = os::vm_page_size();
+ for (char* curr = previous_high;
+ curr < unaligned_new_high;
+ curr += vm_ps) {
+ // Note the use of a write here; originally we tried just a read, but
+ // since the value read was unused, the optimizer removed the read.
+ // If we ever have a concurrent touchahead thread, we'll want to use
+ // a read, to avoid the potential of overwriting data (if a mutator
+ // thread beats the touchahead thread to a page). There are various
+ // ways of making sure this read is not optimized away: for example,
+ // generating the code for a read procedure at runtime.
+ *curr = 0;
+ }
+ }
+
+
_high += bytes;
return true;
}
// A page is uncommitted if the contents of the entire page is deemed unusable.
*** src/share/vm/gc_implementation/parallelScavenge/psVirtualspace.cpp- Thu Nov 20 01:14:11 2008
--- src/share/vm/gc_implementation/parallelScavenge/psVirtualspace.cpp Tue Feb 17 10:48:55 2009
***************
*** 1,12 ****
#ifdef USE_PRAGMA_IDENT_SRC
! #pragma ident "@(#)psVirtualspace.cpp 1.10 05/05/02 05:14:03 JVM"
#endif
/*
! * @(#)psVirtualspace.cpp 1.10 05/05/02
*
! * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
* SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*/
#include "incls/_precompiled.incl"
#include "incls/_psVirtualspace.cpp.incl"
--- 1,12 ----
#ifdef USE_PRAGMA_IDENT_SRC
! #pragma ident "%W% %E% %U% JVM"
#endif
/*
! * %W% %E%
*
! * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*/
#include "incls/_precompiled.incl"
#include "incls/_psVirtualspace.cpp.incl"
***************
*** 81,90 ****
--- 81,99 ----
bool result = special() || os::commit_memory(base_addr, bytes, alignment());
if (result) {
_committed_high_addr += bytes;
}
+ if (AlwaysPreTouch) {
+ for (char* curr = base_addr;
+ curr < _committed_high_addr;
+ curr += os::vm_page_size()) {
+ char tmp = *curr;
+ *curr = 0;
+ }
+ }
+
return result;
}
bool PSVirtualSpace::shrink_by(size_t bytes) {
assert(is_aligned(bytes), "arg not aligned");
***************
*** 249,258 ****
--- 258,276 ----
bool result = special() || os::commit_memory(base_addr, bytes, alignment());
if (result) {
_committed_low_addr -= bytes;
}
+ if (AlwaysPreTouch) {
+ for (char* curr = base_addr;
+ curr < _committed_high_addr;
+ curr += os::vm_page_size()) {
+ char tmp = *curr;
+ *curr = 0;
+ }
+ }
+
return result;
}
bool PSVirtualSpaceHighToLow::shrink_by(size_t bytes) {
assert(is_aligned(bytes), "arg not aligned");
|