RFR: 8257149: Improve G1 Service thread task scheduling to guarantee task delay

Albert Mingkun Yang ayang at openjdk.java.net
Thu Nov 26 11:40:04 UTC 2020


Adopt the "at-least" semantics for scheduling delays in G1 service thread scheduling API so that a task is never scheduled earlier than it asked for. IOW, `schedule_task(task, delay_ms)` means `task` will run after `>= delay_ms` has passed.

Inspecting the logs (`-Xlog:gc,gc+task*=trace`) and focusing lines containing `(Remembered Set Sampling Task) (schedule)`, we can see at what time the sampling task is scheduled.
 
Without `ceil`, sampling task could be scheduled more frequent than intended:
[0.321s][trace][gc,task      ] G1 Service Thread (Remembered Set Sampling Task) (schedule) @0.322s
[0.321s][debug][gc,task      ] G1 Service Thread (Remembered Set Sampling Task) (run) 0.042ms (cpu: 0.000ms)
[0.321s][debug][gc,task,start] G1 Service Thread (Remembered Set Sampling Task) (run)
[0.321s][trace][gc,task      ] G1 Service Thread (Remembered Set Sampling Task) (schedule) @0.322s
[0.321s][debug][gc,task      ] G1 Service Thread (Remembered Set Sampling Task) (run) 0.010ms (cpu: 0.000ms)
[0.321s][debug][gc,task,start] G1 Service Thread (Remembered Set Sampling Task) (run)
[0.321s][trace][gc,task      ] G1 Service Thread (Remembered Set Sampling Task) (schedule) @0.322s
[0.321s][debug][gc,task      ] G1 Service Thread (Remembered Set Sampling Task) (run) 0.008ms (cpu: 0.000ms)
[0.321s][debug][gc,task,start] G1 Service Thread (Remembered Set Sampling Task) (run)

With ceil; there's 300ms (`G1ConcRefinementServiceIntervalMillis`) interval btw each scheduling of the sampling task.
[0.093s][trace][gc,task      ] G1 Service Thread (Remembered Set Sampling Task) (schedule) @0.323s
[0.093s][debug][gc,task      ] G1 Service Thread (Remembered Set Sampling Task) (run) 0.006ms (cpu: 0.000ms)
[0.093s][debug][gc,task,start] G1 Service Thread (Periodic GC Task) (run)
[0.093s][trace][gc,task      ] G1 Service Thread (Periodic GC Task) (schedule) @1.093s
[0.093s][debug][gc,task      ] G1 Service Thread (Periodic GC Task) (run) 0.004ms (cpu: 0.000ms)
[0.093s][trace][gc,task      ] G1 Service Thread (wait) 0.230s
[0.323s][debug][gc,task,start] G1 Service Thread (Remembered Set Sampling Task) (run)
[0.323s][trace][gc,task      ] G1 Service Thread (Remembered Set Sampling Task) (schedule) @0.623s
[0.323s][debug][gc,task      ] G1 Service Thread (Remembered Set Sampling Task) (run) 0.024ms (cpu: 0.000ms)
[0.323s][trace][gc,task      ] G1 Service Thread (wait) 0.300s
[0.623s][debug][gc,task,start] G1 Service Thread (Remembered Set Sampling Task) (run)
[0.623s][trace][gc,task      ] G1 Service Thread (Remembered Set Sampling Task) (schedule) @0.923s
[0.623s][debug][gc,task      ] G1 Service Thread (Remembered Set Sampling Task) (run) 0.026ms (cpu: 0.000ms)
[0.623s][trace][gc,task      ] G1 Service Thread (wait) 0.300s

Tested: tier1 and manually checking the logs.

-------------

Commit messages:
 - ceil timeout

Changes: https://git.openjdk.java.net/jdk/pull/1451/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=1451&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8257149
  Stats: 24 lines in 3 files changed: 5 ins; 9 del; 10 mod
  Patch: https://git.openjdk.java.net/jdk/pull/1451.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/1451/head:pull/1451

PR: https://git.openjdk.java.net/jdk/pull/1451


More information about the hotspot-gc-dev mailing list