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

Albert Mingkun Yang ayang at openjdk.java.net
Thu Nov 26 14:00:10 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.

Albert Mingkun Yang has updated the pull request incrementally with one additional commit since the last revision:

  review

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

Changes:
  - all: https://git.openjdk.java.net/jdk/pull/1451/files
  - new: https://git.openjdk.java.net/jdk/pull/1451/files/ff513b05..92f8fbdf

Webrevs:
 - full: https://webrevs.openjdk.java.net/?repo=jdk&pr=1451&range=01
 - incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=1451&range=00-01

  Stats: 5 lines in 2 files changed: 1 ins; 0 del; 4 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