Mercurial > hg > graal-jvmci-8
comparison src/share/vm/gc_implementation/parNew/parCardTableModRefBS.cpp @ 4095:bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
Summary: Select number of GC threads dynamically based on heap usage and number of Java threads
Reviewed-by: johnc, ysr, jcoomes
author | jmasa |
---|---|
date | Tue, 09 Aug 2011 10:16:01 -0700 |
parents | 3be7439273c5 |
children | 04b9a2566eec 441e946dc1af |
comparison
equal
deleted
inserted
replaced
4094:3a298e04d914 | 4095:bca17e38de00 |
---|---|
31 #include "memory/universe.hpp" | 31 #include "memory/universe.hpp" |
32 #include "oops/oop.inline.hpp" | 32 #include "oops/oop.inline.hpp" |
33 #include "runtime/java.hpp" | 33 #include "runtime/java.hpp" |
34 #include "runtime/mutexLocker.hpp" | 34 #include "runtime/mutexLocker.hpp" |
35 #include "runtime/virtualspace.hpp" | 35 #include "runtime/virtualspace.hpp" |
36 #include "runtime/vmThread.hpp" | |
36 | 37 |
37 void CardTableModRefBS::non_clean_card_iterate_parallel_work(Space* sp, MemRegion mr, | 38 void CardTableModRefBS::non_clean_card_iterate_parallel_work(Space* sp, MemRegion mr, |
38 OopsInGenClosure* cl, | 39 OopsInGenClosure* cl, |
39 CardTableRS* ct, | 40 CardTableRS* ct, |
40 int n_threads) { | 41 int n_threads) { |
41 assert(n_threads > 0, "Error: expected n_threads > 0"); | 42 assert(n_threads > 0, "Error: expected n_threads > 0"); |
42 assert((n_threads == 1 && ParallelGCThreads == 0) || | 43 assert((n_threads == 1 && ParallelGCThreads == 0) || |
43 n_threads <= (int)ParallelGCThreads, | 44 n_threads <= (int)ParallelGCThreads, |
44 "# worker threads != # requested!"); | 45 "# worker threads != # requested!"); |
46 assert(!Thread::current()->is_VM_thread() || (n_threads == 1), "There is only 1 VM thread"); | |
47 assert(UseDynamicNumberOfGCThreads || | |
48 !FLAG_IS_DEFAULT(ParallelGCThreads) || | |
49 n_threads == (int)ParallelGCThreads, | |
50 "# worker threads != # requested!"); | |
45 // Make sure the LNC array is valid for the space. | 51 // Make sure the LNC array is valid for the space. |
46 jbyte** lowest_non_clean; | 52 jbyte** lowest_non_clean; |
47 uintptr_t lowest_non_clean_base_chunk_index; | 53 uintptr_t lowest_non_clean_base_chunk_index; |
48 size_t lowest_non_clean_chunk_size; | 54 size_t lowest_non_clean_chunk_size; |
49 get_LNC_array_for_space(sp, lowest_non_clean, | 55 get_LNC_array_for_space(sp, lowest_non_clean, |
50 lowest_non_clean_base_chunk_index, | 56 lowest_non_clean_base_chunk_index, |
51 lowest_non_clean_chunk_size); | 57 lowest_non_clean_chunk_size); |
52 | 58 |
53 int n_strides = n_threads * ParGCStridesPerThread; | 59 int n_strides = n_threads * ParGCStridesPerThread; |
54 SequentialSubTasksDone* pst = sp->par_seq_tasks(); | 60 SequentialSubTasksDone* pst = sp->par_seq_tasks(); |
61 // Sets the condition for completion of the subtask (how many threads | |
62 // need to finish in order to be done). | |
55 pst->set_n_threads(n_threads); | 63 pst->set_n_threads(n_threads); |
56 pst->set_n_tasks(n_strides); | 64 pst->set_n_tasks(n_strides); |
57 | 65 |
58 int stride = 0; | 66 int stride = 0; |
59 while (!pst->is_task_claimed(/* reference */ stride)) { | 67 while (!pst->is_task_claimed(/* reference */ stride)) { |