• Yafang Shao's avatar
    sched/dl: Support schedstats for deadline sched class · b5eb4a5f
    Yafang Shao authored
    After we make the struct sched_statistics and the helpers of it
    independent of fair sched class, we can easily use the schedstats
    facility for deadline sched class.
    
    The schedstat usage in DL sched class is similar with fair sched class,
    for example,
                        fair                        deadline
        enqueue         update_stats_enqueue_fair   update_stats_enqueue_dl
        dequeue         update_stats_dequeue_fair   update_stats_dequeue_dl
        put_prev_task   update_stats_wait_start     update_stats_wait_start_dl
        set_next_task   update_stats_wait_end       update_stats_wait_end_dl
    
    The user can get the schedstats information in the same way in fair sched
    class. For example,
               fair                            deadline
               /proc/[pid]/sched               /proc/[pid]/sched
    
    The output of a deadline task's schedstats as follows,
    
    $ cat /proc/69662/sched
    ...
    se.sum_exec_runtime                          :          3067.696449
    se.nr_migrations                             :                    0
    sum_sleep_runtime                            :        720144.029661
    sum_block_runtime                            :             0.547853
    wait_start                                   :             0.000000
    sleep_start                                  :      14131540.828955
    block_start                                  :             0.000000
    sleep_max                                    :          2999.974045
    block_max                                    :             0.283637
    exec_max                                     :             1.000269
    slice_max                                    :             0.000000
    wait_max                                     :             0.002217
    wait_sum                                     :             0.762179
    wait_count                                   :                  733
    iowait_sum                                   :             0.547853
    iowait_count                                 :                    3
    nr_migrations_cold                           :                    0
    nr_failed_migrations_affine                  :                    0
    nr_failed_migrations_running                 :                    0
    nr_failed_migrations_hot                     :                    0
    nr_forced_migrations                         :                    0
    nr_wakeups                                   :                  246
    nr_wakeups_sync                              :                    2
    nr_wakeups_migrate                           :                    0
    nr_wakeups_local                             :                  244
    nr_wakeups_remote                            :                    2
    nr_wakeups_affine                            :                    0
    nr_wakeups_affine_attempts                   :                    0
    nr_wakeups_passive                           :                    0
    nr_wakeups_idle                              :                    0
    ...
    
    The sched:sched_stat_{wait, sleep, iowait, blocked} tracepoints can
    be used to trace deadlline tasks as well.
    Signed-off-by: default avatarYafang Shao <laoar.shao@gmail.com>
    Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
    Link: https://lore.kernel.org/r/20210905143547.4668-9-laoar.shao@gmail.com
    b5eb4a5f
deadline.c 81.3 KB