diff --git a/src/hotspot/share/gc/g1/g1Analytics.cpp b/src/hotspot/share/gc/g1/g1Analytics.cpp
index 730a143636322..3761db58a4079 100644
--- a/src/hotspot/share/gc/g1/g1Analytics.cpp
+++ b/src/hotspot/share/gc/g1/g1Analytics.cpp
@@ -325,7 +325,7 @@ size_t G1Analytics::predict_rs_length(bool for_young_only_phase) const {
 }
 
 size_t G1Analytics::predict_pending_cards(bool for_young_only_phase) const {
-  if  (for_young_only_phase || !enough_samples_available(_mixed_pending_cards_seq)) {
+  if (for_young_only_phase || !enough_samples_available(_mixed_pending_cards_seq)) {
     return predict_size(_young_pending_cards_seq);
   } else {
     return predict_size(_mixed_pending_cards_seq);
diff --git a/src/hotspot/share/gc/g1/g1Policy.cpp b/src/hotspot/share/gc/g1/g1Policy.cpp
index 7b9ba76ed1a04..2e6152cf74b27 100644
--- a/src/hotspot/share/gc/g1/g1Policy.cpp
+++ b/src/hotspot/share/gc/g1/g1Policy.cpp
@@ -809,11 +809,7 @@ void G1Policy::record_young_collection_end(bool concurrent_operation_is_full_mar
                                       p->sum_thread_work_items(G1GCPhaseTimes::OptMergeRS, G1GCPhaseTimes::MergeRSDirtyCards) +
                                       total_log_buffer_cards;
 
-    // The threshold for the number of cards in a given sampling which we consider
-    // large enough so that the impact from setup and other costs is negligible.
-    size_t const CardsNumSamplingThreshold = 10;
-
-    if (total_cards_merged > CardsNumSamplingThreshold) {
+    if (total_cards_merged >= G1NumCardsCostSampleThreshold) {
       double avg_time_merge_cards = average_time_ms(G1GCPhaseTimes::MergeER) +
                                     average_time_ms(G1GCPhaseTimes::MergeRS) +
                                     average_time_ms(G1GCPhaseTimes::MergeHCC) +
@@ -826,7 +822,7 @@ void G1Policy::record_young_collection_end(bool concurrent_operation_is_full_mar
     size_t const total_cards_scanned = p->sum_thread_work_items(G1GCPhaseTimes::ScanHR, G1GCPhaseTimes::ScanHRScannedCards) +
                                        p->sum_thread_work_items(G1GCPhaseTimes::OptScanHR, G1GCPhaseTimes::ScanHRScannedCards);
 
-    if (total_cards_scanned > CardsNumSamplingThreshold) {
+    if (total_cards_scanned >= G1NumCardsCostSampleThreshold) {
       double avg_time_dirty_card_scan = average_time_ms(G1GCPhaseTimes::ScanHR) +
                                         average_time_ms(G1GCPhaseTimes::OptScanHR);
 
diff --git a/src/hotspot/share/gc/g1/g1_globals.hpp b/src/hotspot/share/gc/g1/g1_globals.hpp
index 85f3b1dc6edc5..5dd37958a563c 100644
--- a/src/hotspot/share/gc/g1/g1_globals.hpp
+++ b/src/hotspot/share/gc/g1/g1_globals.hpp
@@ -377,6 +377,11 @@
           "retained region restore purposes.")                              \
           range(1, 256)                                                     \
                                                                             \
+  product(uint, G1NumCardsCostSampleThreshold, 1000, DIAGNOSTIC,            \
+          "Threshold for the number of cards when reporting card cost "     \
+          "related prediction sample. That sample must involve the same or "\
+          "more than that number of cards to be used.")                     \
+                                                                            \
   GC_G1_EVACUATION_FAILURE_FLAGS(develop,                                   \
                     develop_pd,                                             \
                     product,                                                \