WangGuangxin commented on a change in pull request #34846:
URL: https://github.com/apache/spark/pull/34846#discussion_r767166389
##########
File path: core/src/main/scala/org/apache/spark/internal/config/package.scala
##########
@@ -2267,4 +2267,12 @@ package object config {
.version("3.3.0")
.intConf
.createWithDefault(5)
+
+ private[spark] val MEMORY_ONHEAP_PAGESIZE_OPTIMIZE_ENABLED =
Review comment:
yeah, it's indeed no need. removed it
##########
File path: core/src/main/scala/org/apache/spark/memory/MemoryManager.scala
##########
@@ -255,7 +256,15 @@ private[spark] abstract class MemoryManager(
}
val size = ByteArrayMethods.nextPowerOf2(maxTungstenMemory / cores /
safetyFactor)
val default = math.min(maxPageSize, math.max(minPageSize, size))
- conf.get(BUFFER_PAGESIZE).getOrElse(default)
+ val sizeAsBytes = conf.get(BUFFER_PAGESIZE).getOrElse(default)
+ if (conf.get(MEMORY_ONHEAP_PAGESIZE_OPTIMIZE_ENABLED) &&
+ tungstenMemoryMode == MemoryMode.ON_HEAP &&
+ sizeAsBytes % (1024 * 1024) == 0 &&
+ Utils.isHumongousAllocation(sizeAsBytes)) {
+ sizeAsBytes - Platform.LONG_ARRAY_OFFSET
Review comment:
you mean even if it is not homongous allocation?
##########
File path: core/src/main/scala/org/apache/spark/util/Utils.scala
##########
@@ -3204,6 +3205,33 @@ private[spark] object Utils extends Logging {
}
files.toSeq
}
+
+ private def isG1GarbageCollector: Boolean = {
Review comment:
ok
##########
File path: core/src/main/scala/org/apache/spark/memory/MemoryManager.scala
##########
@@ -255,7 +256,15 @@ private[spark] abstract class MemoryManager(
}
val size = ByteArrayMethods.nextPowerOf2(maxTungstenMemory / cores /
safetyFactor)
val default = math.min(maxPageSize, math.max(minPageSize, size))
- conf.get(BUFFER_PAGESIZE).getOrElse(default)
+ val sizeAsBytes = conf.get(BUFFER_PAGESIZE).getOrElse(default)
+ if (conf.get(MEMORY_ONHEAP_PAGESIZE_OPTIMIZE_ENABLED) &&
+ tungstenMemoryMode == MemoryMode.ON_HEAP &&
+ sizeAsBytes % (1024 * 1024) == 0 &&
+ Utils.isHumongousAllocation(sizeAsBytes)) {
+ sizeAsBytes - Platform.LONG_ARRAY_OFFSET
Review comment:
I revisit here, it's really no need to restrict to only homongous
allocation
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]