Hi,
在 2024/12/17 21:14, Nilay Shroff 写道:
This commit helps fix the above race condition by touching a temp file. The
the existence of the temp file is then polled by the background process at
regular interval. Until the temp file is created, the background process
would not forward progress and starts submitting IO and from the main
thread we'd touch temp file only after we write PID of the background
process into cgroup.procs.
It's right sleep 0.1 is not appropriate here, and this can work.
However, I think reading cgroup.procs directly is better, something
like following:
_throtl_test_io() {
- local pid
+ local pid="none"
{
local rw=$1
local bs=$2
local count=$3
- sleep 0.1
+ while ! cat $CGROUP2_DIR/$THROTL_DIR/cgroup.procs | grep
$pid; do
+ sleep 0.1
_throtl_issue_io "$rw" "$bs" "$count"
} &
Thanks,
Kuai