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

Albert Mingkun Yang ayang at openjdk.java.net
Fri Nov 27 10:36:07 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 with a new target base due to a merge or a rebase. The pull request now contains three commits:

 - merge
 - review
 - ceil timeout

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

Changes: https://git.openjdk.java.net/jdk/pull/1451/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=1451&range=02
  Stats: 22 lines in 3 files changed: 2 ins; 6 del; 14 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