lkml.org 
[lkml]   [2022]   [Jun]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 5.10 152/452] sched/fair: Fix cfs_rq_clock_pelt() for throttled cfs_rq
    Date
    From: Chengming Zhou <zhouchengming@bytedance.com>

    [ Upstream commit 64eaf50731ac0a8c76ce2fedd50ef6652aabc5ff ]

    Since commit 23127296889f ("sched/fair: Update scale invariance of PELT")
    change to use rq_clock_pelt() instead of rq_clock_task(), we should also
    use rq_clock_pelt() for throttled_clock_task_time and throttled_clock_task
    accounting to get correct cfs_rq_clock_pelt() of throttled cfs_rq. And
    rename throttled_clock_task(_time) to be clock_pelt rather than clock_task.

    Fixes: 23127296889f ("sched/fair: Update scale invariance of PELT")
    Signed-off-by: Chengming Zhou <zhouchengming@bytedance.com>
    Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
    Reviewed-by: Ben Segall <bsegall@google.com>
    Reviewed-by: Vincent Guittot <vincent.guittot@linaro.org>
    Link: https://lore.kernel.org/r/20220408115309.81603-1-zhouchengming@bytedance.com
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    ---
    kernel/sched/fair.c | 8 ++++----
    kernel/sched/pelt.h | 4 ++--
    kernel/sched/sched.h | 4 ++--
    3 files changed, 8 insertions(+), 8 deletions(-)

    diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
    index 1a306ef51bbe..bca0efc03a51 100644
    --- a/kernel/sched/fair.c
    +++ b/kernel/sched/fair.c
    @@ -4758,8 +4758,8 @@ static int tg_unthrottle_up(struct task_group *tg, void *data)

    cfs_rq->throttle_count--;
    if (!cfs_rq->throttle_count) {
    - cfs_rq->throttled_clock_task_time += rq_clock_task(rq) -
    - cfs_rq->throttled_clock_task;
    + cfs_rq->throttled_clock_pelt_time += rq_clock_pelt(rq) -
    + cfs_rq->throttled_clock_pelt;

    /* Add cfs_rq with already running entity in the list */
    if (cfs_rq->nr_running >= 1)
    @@ -4776,7 +4776,7 @@ static int tg_throttle_down(struct task_group *tg, void *data)

    /* group is entering throttled state, stop time */
    if (!cfs_rq->throttle_count) {
    - cfs_rq->throttled_clock_task = rq_clock_task(rq);
    + cfs_rq->throttled_clock_pelt = rq_clock_pelt(rq);
    list_del_leaf_cfs_rq(cfs_rq);
    }
    cfs_rq->throttle_count++;
    @@ -5194,7 +5194,7 @@ static void sync_throttle(struct task_group *tg, int cpu)
    pcfs_rq = tg->parent->cfs_rq[cpu];

    cfs_rq->throttle_count = pcfs_rq->throttle_count;
    - cfs_rq->throttled_clock_task = rq_clock_task(cpu_rq(cpu));
    + cfs_rq->throttled_clock_pelt = rq_clock_pelt(cpu_rq(cpu));
    }

    /* conditionally throttle active cfs_rq's from put_prev_entity() */
    diff --git a/kernel/sched/pelt.h b/kernel/sched/pelt.h
    index 45bf08e22207..89150ced09cf 100644
    --- a/kernel/sched/pelt.h
    +++ b/kernel/sched/pelt.h
    @@ -145,9 +145,9 @@ static inline u64 rq_clock_pelt(struct rq *rq)
    static inline u64 cfs_rq_clock_pelt(struct cfs_rq *cfs_rq)
    {
    if (unlikely(cfs_rq->throttle_count))
    - return cfs_rq->throttled_clock_task - cfs_rq->throttled_clock_task_time;
    + return cfs_rq->throttled_clock_pelt - cfs_rq->throttled_clock_pelt_time;

    - return rq_clock_pelt(rq_of(cfs_rq)) - cfs_rq->throttled_clock_task_time;
    + return rq_clock_pelt(rq_of(cfs_rq)) - cfs_rq->throttled_clock_pelt_time;
    }
    #else
    static inline u64 cfs_rq_clock_pelt(struct cfs_rq *cfs_rq)
    diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h
    index 08db8e095e48..8d39f5d99172 100644
    --- a/kernel/sched/sched.h
    +++ b/kernel/sched/sched.h
    @@ -599,8 +599,8 @@ struct cfs_rq {
    s64 runtime_remaining;

    u64 throttled_clock;
    - u64 throttled_clock_task;
    - u64 throttled_clock_task_time;
    + u64 throttled_clock_pelt;
    + u64 throttled_clock_pelt_time;
    int throttled;
    int throttle_count;
    struct list_head throttled_list;
    --
    2.35.1


    \
     
     \ /
      Last update: 2022-06-07 19:52    [W:4.094 / U:1.312 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site