Re: [PATCH blktests 2/2] throtl: fix the race between submitting IO and setting cgroup.procs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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





[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux