comparison src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp @ 1111:44f61c24ddab

6862387: tune concurrent refinement further Summary: Reworked the concurrent refinement: threads activation, feedback-based threshold adjustment, other miscellaneous fixes. Reviewed-by: apetrusenko, tonyp
author iveresov
date Wed, 16 Dec 2009 15:12:51 -0800
parents 3fc996d4edd2
children 0414c1049f15
comparison
equal deleted inserted replaced
1104:27f9477e879b 1111:44f61c24ddab
1912 _free_regions_at_end_of_collection = _g1->free_regions(); 1912 _free_regions_at_end_of_collection = _g1->free_regions();
1913 _scan_only_regions_at_end_of_collection = _g1->young_list_length(); 1913 _scan_only_regions_at_end_of_collection = _g1->young_list_length();
1914 calculate_young_list_min_length(); 1914 calculate_young_list_min_length();
1915 calculate_young_list_target_config(); 1915 calculate_young_list_target_config();
1916 1916
1917 // Note that _mmu_tracker->max_gc_time() returns the time in seconds.
1918 double update_rs_time_goal_ms = _mmu_tracker->max_gc_time() * MILLIUNITS * G1RSUpdatePauseFractionPercent / 100.0;
1919 adjust_concurrent_refinement(update_rs_time, update_rs_processed_buffers, update_rs_time_goal_ms);
1920
1917 // </NEW PREDICTION> 1921 // </NEW PREDICTION>
1918 1922
1919 _target_pause_time_ms = -1.0; 1923 _target_pause_time_ms = -1.0;
1920 } 1924 }
1921 1925
1922 // <NEW PREDICTION> 1926 // <NEW PREDICTION>
1927
1928 void G1CollectorPolicy::adjust_concurrent_refinement(double update_rs_time,
1929 double update_rs_processed_buffers,
1930 double goal_ms) {
1931 DirtyCardQueueSet& dcqs = JavaThread::dirty_card_queue_set();
1932 ConcurrentG1Refine *cg1r = G1CollectedHeap::heap()->concurrent_g1_refine();
1933
1934 if (G1AdaptiveConcRefine) {
1935 const int k_gy = 3, k_gr = 6;
1936 const double inc_k = 1.1, dec_k = 0.9;
1937
1938 int g = cg1r->green_zone();
1939 if (update_rs_time > goal_ms) {
1940 g = (int)(g * dec_k); // Can become 0, that's OK. That would mean a mutator-only processing.
1941 } else {
1942 if (update_rs_time < goal_ms && update_rs_processed_buffers > g) {
1943 g = (int)MAX2(g * inc_k, g + 1.0);
1944 }
1945 }
1946 // Change the refinement threads params
1947 cg1r->set_green_zone(g);
1948 cg1r->set_yellow_zone(g * k_gy);
1949 cg1r->set_red_zone(g * k_gr);
1950 cg1r->reinitialize_threads();
1951
1952 int processing_threshold_delta = MAX2((int)(cg1r->green_zone() * sigma()), 1);
1953 int processing_threshold = MIN2(cg1r->green_zone() + processing_threshold_delta,
1954 cg1r->yellow_zone());
1955 // Change the barrier params
1956 dcqs.set_process_completed_threshold(processing_threshold);
1957 dcqs.set_max_completed_queue(cg1r->red_zone());
1958 }
1959
1960 int curr_queue_size = dcqs.completed_buffers_num();
1961 if (curr_queue_size >= cg1r->yellow_zone()) {
1962 dcqs.set_completed_queue_padding(curr_queue_size);
1963 } else {
1964 dcqs.set_completed_queue_padding(0);
1965 }
1966 dcqs.notify_if_necessary();
1967 }
1923 1968
1924 double 1969 double
1925 G1CollectorPolicy:: 1970 G1CollectorPolicy::
1926 predict_young_collection_elapsed_time_ms(size_t adjustment) { 1971 predict_young_collection_elapsed_time_ms(size_t adjustment) {
1927 guarantee( adjustment == 0 || adjustment == 1, "invariant" ); 1972 guarantee( adjustment == 0 || adjustment == 1, "invariant" );