Up Top

Memory allocation (& GC 処理) : ヒープの動的サイズ調整/動的パラメータ調整 : TLAB の動的サイズ調整


概要(Summary)

TLAB の動的サイズ調整処理は以下のように行われる.

  1. まず, GC 中に CollectedHeap::accumulate_statistics_all_tlabs() で情報を収集する.
  2. 次に, GC 後に CollectedHeap::resize_all_tlabs() でサイズの調整を行う.

最終的には ThreadLocalAllocBuffer::desired_size() に新しい値が設定される.

備考(Notes)

ThreadLocalAllocBuffer::desired_size() の値は TLAB 確保時に確保サイズの決定に使われる. より具体的に言うと ThreadLocalAllocBuffer::compute_size() 内で参照される (See: here for details).

処理の流れ (概要)(Execution Flows : Summary)

GC 中の処理

ParallelScavengeHeap の場合

(See: here for details)
-> PSScavenge::invoke_no_policy()
   -> ParallelScavengeHeap::accumulate_statistics_all_tlabs()
      -> CollectedHeap::accumulate_statistics_all_tlabs()
         -> ThreadLocalAllocBuffer::accumulate_statistics_before_gc()
            -> GlobalTLABStats::initialize()
            -> ThreadLocalAllocBuffer::accumulate_statistics()
            -> ThreadLocalAllocBuffer::initialize_statistics()
            -> GlobalTLABStats::publish()

(See: here for details)
-> PSParallelCompact::pre_compact()
   -> ParallelScavengeHeap::accumulate_statistics_all_tlabs()
      -> (同上)

(See: here for details)
-> PSMarkSweep::invoke_no_policy()
   -> ParallelScavengeHeap::accumulate_statistics_all_tlabs()
      -> (同上)

G1CollectedHeap の場合

(#Under Construction)

GenCollectedHeap の場合

(See: here for details)
-> GenCollectedHeap::do_collection()
   -> GenCollectedHeap::gc_prologue()
      -> CollectedHeap::accumulate_statistics_all_tlabs()
         -> (同上)

GC 後の処理

ParallelScavengeHeap の場合

(See: here for details)
-> PSScavenge::invoke_no_policy()
   -> ParallelScavengeHeap::resize_all_tlabs()
      -> CollectedHeap::resize_all_tlabs()
         -> ThreadLocalAllocBuffer::resize_all_tlabs()
            -> ThreadLocalAllocBuffer::resize()

(See: here for details)
-> PSParallelCompact::invoke_no_policy()
   -> ParallelScavengeHeap::resize_all_tlabs()
      -> (同上)

(See: here for details)
-> PSMarkSweep::invoke_no_policy()
   -> ParallelScavengeHeap::resize_all_tlabs()
      -> (同上)

G1CollectedHeap の場合

(#Under Construction)

GenCollectedHeap の場合

(See: here for details)
-> GenCollectedHeap::do_collection()
   -> GenCollectedHeap::gc_epilogue()
      -> CollectedHeap::resize_all_tlabs()
         -> (同上)

処理の流れ (詳細)(Execution Flows : Details)

ParallelScavengeHeap::accumulate_statistics_all_tlabs()

See: here for details

CollectedHeap::accumulate_statistics_all_tlabs()

See: here for details

ThreadLocalAllocBuffer::accumulate_statistics_before_gc()

See: here for details

GlobalTLABStats::initialize()

See: here for details

ThreadLocalAllocBuffer::accumulate_statistics()

See: here for details

ThreadLocalAllocBuffer::initialize_statistics()

See: here for details

GlobalTLABStats::publish()

See: here for details

ParallelScavengeHeap::resize_all_tlabs()

See: here for details

CollectedHeap::resize_all_tlabs()

See: here for details

ThreadLocalAllocBuffer::resize_all_tlabs()

See: here for details

ThreadLocalAllocBuffer::resize()

See: here for details


This document is available under the GNU GENERAL PUBLIC LICENSE Version 2.