Skip to content

sched/eevdf: propagate min slice when {throttle, unthrottle}_cfs_rq #1293

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions kernel/sched/fair.c
Original file line number Diff line number Diff line change
Expand Up @@ -5890,6 +5890,7 @@ static bool throttle_cfs_rq(struct cfs_rq *cfs_rq)
struct sched_entity *se;
long queued_delta, runnable_delta, idle_delta, dequeue = 1;
long rq_h_nr_queued = rq->cfs.h_nr_queued;
u64 slice = 0;

raw_spin_lock(&cfs_b->lock);
/* This will start the period timer if necessary */
Expand Down Expand Up @@ -5950,6 +5951,7 @@ static bool throttle_cfs_rq(struct cfs_rq *cfs_rq)
if (qcfs_rq->load.weight) {
/* Avoid re-evaluating load for this entity: */
se = parent_entity(se);
slice = cfs_rq_min_slice(qcfs_rq);
break;
}
}
Expand All @@ -5963,6 +5965,11 @@ static bool throttle_cfs_rq(struct cfs_rq *cfs_rq)
update_load_avg(qcfs_rq, se, 0);
se_update_runnable(se);

se->slice = slice;
if (se != qcfs_rq->curr)
min_vruntime_cb_propagate(&se->run_node, NULL);
slice = cfs_rq_min_slice(qcfs_rq);

if (cfs_rq_is_idle(group_cfs_rq(se)))
idle_delta = cfs_rq->h_nr_queued;

Expand Down Expand Up @@ -5996,6 +6003,7 @@ void unthrottle_cfs_rq(struct cfs_rq *cfs_rq)
struct sched_entity *se;
long queued_delta, runnable_delta, idle_delta;
long rq_h_nr_queued = rq->cfs.h_nr_queued;
u64 slice = 0;

se = cfs_rq->tg->se[cpu_of(rq)];

Expand Down Expand Up @@ -6041,6 +6049,11 @@ void unthrottle_cfs_rq(struct cfs_rq *cfs_rq)
dequeue_entity(qcfs_rq, se, flags);
} else if (se->on_rq)
break;

if (slice) {
se->slice = slice;
se->custom_slice = 1;
}
enqueue_entity(qcfs_rq, se, ENQUEUE_WAKEUP);

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should update of slice here:

slice = cfs_rq_min_slice(qcfs_rq);

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if (cfs_rq_is_idle(group_cfs_rq(se)))
Expand All @@ -6064,6 +6077,11 @@ void unthrottle_cfs_rq(struct cfs_rq *cfs_rq)
if (cfs_rq_is_idle(group_cfs_rq(se)))
idle_delta = cfs_rq->h_nr_queued;

se->slice = slice;
if (se != qcfs_rq->curr)
min_vruntime_cb_propagate(&se->run_node, NULL);
slice = cfs_rq_min_slice(qcfs_rq);

qcfs_rq->h_nr_queued += queued_delta;
qcfs_rq->h_nr_runnable += runnable_delta;
qcfs_rq->h_nr_idle += idle_delta;
Expand Down