-
Notifications
You must be signed in to change notification settings - Fork 712
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix issue relate with CollectionUsageThreshold of memory pool #2993
Conversation
aa8bfdb
to
cbfd7b8
Compare
runtime/jcl/common/mgmtinit.c
Outdated
/* if a heap collection threshold is set, check whether we are above or below */ | ||
if (0 < memoryPool->collectionUsageThreshold) { | ||
/* if a memory pool collection threshold is set and the memory pool is manaaged by the collector, check whether we are above or below */ | ||
if (0 < memoryPool->collectionUsageThreshold && j9gc_is_managedpool_by_collector(vm, (UDATA)(gcID & J9VM_MANAGEMENT_GC_HEAP_ID_MASK), (UDATA)(memoryPool->id & J9VM_MANAGEMENT_POOL_HEAP_ID_MASK))) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would you please add extra brackets around "0 < memoryPool->collectionUsageThreshold" ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
There is a similar pattern in Java_com_ibm_java_lang_management_internal_MemoryPoolMXBeanImpl_isCollectionUsageThresholdExceededImpl(). Should it be updated as well? |
3d97c85
to
4fdc078
Compare
runtime/jcl/common/mgmtinit.c
Outdated
@@ -632,8 +632,8 @@ gcEndEvent(J9JavaVM *vm, UDATA heapSize, UDATA heapUsed, UDATA *totals, UDATA *f | |||
memoryPool->peakMax = memoryPool->postCollectionMaxSize; | |||
} | |||
|
|||
/* if a heap collection threshold is set, check whether we are above or below */ | |||
if (0 < memoryPool->collectionUsageThreshold) { | |||
/* if a memory pool collection threshold is set and the memory pool is manaaged by the collector, check whether we are above or below */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo manaaged -> managed
f6d37d8
to
ddf4792
Compare
update for MemoryPoolMXBean.getCollectionUsage() getPreCollectionUsage() and isCollectionUsageThresholdExceeded() as well |
runtime/jcl/common/mgmtinit.c
Outdated
@@ -546,7 +552,8 @@ gcStartEvent(J9JavaVM *vm, UDATA heapSize, UDATA heapUsed, UDATA *totals, UDATA | |||
notification->usageThreshold->poolID = memoryPool->id; | |||
notification->usageThreshold->usedSize = used; | |||
notification->usageThreshold->totalSize = total; | |||
notification->usageThreshold->maxSize = memoryPool->preCollectionMaxSize; | |||
// notification->usageThreshold->maxSize = memoryPool->preCollectionMaxSize; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess this line should be removed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
runtime/jcl/common/mgmtmempool.c
Outdated
{ | ||
UDATA idx = 0; | ||
|
||
for(; idx < mgmt->supportedCollectors; ++idx) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need space between "for" and bracket. Also I would provide initial value explicitly:
for (idx=0; idx < mgmt->supportedCollectors; ++idx) {
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
ddf4792
to
3478041
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@dmitripivkine @LinHu2016 Is this required for the 0.11.0 release? How risky is the change? |
I believe the risk is medium but limited to MemoryPoolMXBean functionality. @LinHu2016 is there urgency for this? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
one minor nitpick which isn't strictly required and the code looks ok to me
runtime/gc_base/modronapi.cpp
Outdated
if (J9_GC_MANAGEMENT_COLLECTOR_SCAVENGE == gcID) { | ||
/* for BackCompatible mode scavenge does not try to reclaim memory from the whole heap, so we do not mark JavaHeap managed by scavenge */ | ||
return 0; | ||
} else { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The else block is unnecessary as the if block returns. Can be written as:
if (J9_GC_MANAGEMENT_COLLECTOR_SCAVENGE == gcID) {
/* for BackCompatible mode scavenge does not try to reclaim memory from the whole heap, so we do not mark JavaHeap managed by scavenge */
return 0;
}
return 1;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@DanHeidinga @dmitripivkine As Dmitri said without the fix, it would be limited to MemoryPoolMXBean CollectionUsage related functionality, but it is not urgency. |
Jenkins test sanity,functional zlinux,win jdk8 |
Jenkins test sanity,functional zlinux jdk8 |
Jenkins test sanity zlinux jdk8 |
Jenkins test extended zlinux jdk8 |
Jenkins test sanity win jdk10 |
Windows compile failure:
|
@LinHu2016 are you looking at the compile failure? |
- we should only check if the notification for CollectionUsageThreshold need to be fired at the end of the collection, which try to recycle the memory pool. - for BackCompatible mode scavenge does not try to reclaim memory from the whole heap, so we do not fire the notification of CollectionUsageThreshold at the end scavenge. - record the last GC ID for retrieving more detail gcInfo of last GC from J9GarbageCollectorData - MemoryPoolMXBean.getCollectionUsage() getPreCollectionUsage() and isCollectionUsageThresholdExceeded() also match the same rule. Signed-off-by: Lin Hu <linhu@ca.ibm.com>
fixed the compiling error. |
Jenkins test all zlinux jdk8 |
Jenkins test sanity win jdk10 |
Reverted until the problems can be fixed, since the change is causing test failures
|
CollectionUsageThreshold need to be fired at the end of the collection,
which try to recycle the memory pool.
the whole heap, so we do not fire the notification of
CollectionUsageThreshold at the end scavenge.
GC from J9GarbageCollectorData
and isCollectionUsageThresholdExceeded() also match the same rule.
fix: #2982
Signed-off-by: Lin Hu linhu@ca.ibm.com