Wed, 06 Feb 2013 14:50:37 -0800
7052429: G1: Avoid unnecessary scanning of humongous regions during concurrent marking
Summary: Skip unnecessary scanning of bitmap for unmarked humongous objects/regions.
Reviewed-by: jwilhelm, johnc
Contributed-by: Tao Mao <tao.mao@oracle.com>
src/share/vm/gc_implementation/g1/concurrentMark.cpp | file | annotate | diff | comparison | revisions | |
src/share/vm/runtime/globals.hpp | file | annotate | diff | comparison | revisions |
1.1 --- a/src/share/vm/gc_implementation/g1/concurrentMark.cpp Tue Feb 05 22:24:36 2013 -0800 1.2 +++ b/src/share/vm/gc_implementation/g1/concurrentMark.cpp Wed Feb 06 14:50:37 2013 -0800 1.3 @@ -4066,11 +4066,23 @@ 1.4 _worker_id, _finger, _region_limit, _curr_region); 1.5 } 1.6 1.7 - // Let's iterate over the bitmap of the part of the 1.8 - // region that is left. 1.9 - if (mr.is_empty() || _nextMarkBitMap->iterate(&bitmap_closure, mr)) { 1.10 - // We successfully completed iterating over the region. Now, 1.11 - // let's give up the region. 1.12 + HeapRegion* hr = _g1h->heap_region_containing(mr.start()); 1.13 + assert(!hr->isHumongous() || mr.start() == hr->bottom(), 1.14 + "the start of HeapRegion and MemRegion should be consistent for humongous regions"); 1.15 + 1.16 + // The special case of the bitmap of a humongous region with its first 1.17 + // bit NOT marked should be avoided from (wasteful) iterating. 1.18 + // Note that the alternative case of the bitmap of a humongous region 1.19 + // with its first bit marked is handled properly in the iterate() routine. 1.20 + // Then, let's iterate over the bitmap of the part of the region that is 1.21 + // left. 1.22 + // If the iteration is successful, give up the region. 1.23 + // Also note that the case of the bitmap of a humongous region with its 1.24 + // first bit NOT marked is considered "successful", leveraging the fact 1.25 + // that the entire bitmap consists of all 0's in such case. 1.26 + if (mr.is_empty() || 1.27 + (hr != NULL && hr->isHumongous() && !_nextMarkBitMap->isMarked(mr.start())) || 1.28 + _nextMarkBitMap->iterate(&bitmap_closure, mr)) { 1.29 giveup_current_region(); 1.30 regular_clock_call(); 1.31 } else {
2.1 --- a/src/share/vm/runtime/globals.hpp Tue Feb 05 22:24:36 2013 -0800 2.2 +++ b/src/share/vm/runtime/globals.hpp Wed Feb 06 14:50:37 2013 -0800 2.3 @@ -1,5 +1,5 @@ 2.4 /* 2.5 - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. 2.6 + * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. 2.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 2.8 * 2.9 * This code is free software; you can redistribute it and/or modify it 2.10 @@ -1816,7 +1816,7 @@ 2.11 \ 2.12 product(uintx, InitiatingHeapOccupancyPercent, 45, \ 2.13 "Percentage of the (entire) heap occupancy to start a " \ 2.14 - "concurrent GC cycle. It us used by GCs that trigger a " \ 2.15 + "concurrent GC cycle. It is used by GCs that trigger a " \ 2.16 "concurrent GC cycle based on the occupancy of the entire heap, " \ 2.17 "not just one of the generations (e.g., G1). A value of 0 " \ 2.18 "denotes 'do constant GC cycles'.") \