What factors will affect the thread scheduling latency in the system?

42 Views Asked by At

The perf sched latency tool can calculate the latency of a thread being scheduled by the operating system, which is the time between wakeup and schedule-in of task.

/*
 * Explanation of delta-time stats:
 *
 *            t = time of current schedule out event
 *        tprev = time of previous sched out event
 *                also time of schedule-in event for current task
 *    last_time = time of last sched change event for current task
 *                (i.e, time process was last scheduled out)
 * ready_to_run = time of wakeup for current task
 *
 * -----|------------|------------|------------|------
 *    last         ready        tprev          t
 *    time         to run
 *
 *      |-------- dt_wait --------|
 *                   |- dt_delay -|-- dt_run --|
 *
 *   dt_run = run time of current task
 *  dt_wait = time between last schedule out event for task and tprev
 *            represents time spent off the cpu
 * dt_delay = time between wakeup and schedule-in of task
 */

time    cpu  task name                       wait time  sch delay   run time
                        [tid/pid]                          (msec)     (msec)     (msec)
--------------- ------  ------------------------------  ---------  ---------  ---------
   43721.001384 [0001]  <idle>                              0.000      0.000      0.000 
   43721.001401 [0001]  avahi-daemon[950]                   0.000      0.000      0.017 
   43721.001451 [0000]  <idle>                              0.000      0.000      0.000 
   43721.001468 [0000]  Chrome_IOThread[2401/2383]          0.000      0.000      0.016 
   43721.001516 [0004]  <idle>                              0.000      0.000      0.000

What factors can affect this latency? Will factors such as "CPU migration" or "the number of threads" or "CPU performance per core" have an impact? Will cgroups increase the latency?

I found that the latency of the same process in AMD 9654+kernel 5.14 environment is larger than that in Intel 8352Y+kernel 4.18 environment.

0

There are 0 best solutions below