fair.c (5787443f556e81c2d6ec943367be8866e7af6e4a) fair.c (b2f7d7507982ed56d301ba0f75f040fd1e930214)
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * Completely Fair Scheduling (CFS) Class (SCHED_NORMAL/SCHED_BATCH)
4 *
5 * Copyright (C) 2007 Red Hat, Inc., Ingo Molnar <mingo@redhat.com>
6 *
7 * Interactivity improvements by Mike Galbraith
8 * (C) 2007 Mike Galbraith <efault@gmx.de>

--- 8254 unchanged lines hidden (view full) ---

8263 int next_buddy_marked = 0;
8264 int cse_is_idle, pse_is_idle;
8265
8266 if (unlikely(se == pse))
8267 return;
8268
8269 /*
8270 * This is possible from callers such as attach_tasks(), in which we
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * Completely Fair Scheduling (CFS) Class (SCHED_NORMAL/SCHED_BATCH)
4 *
5 * Copyright (C) 2007 Red Hat, Inc., Ingo Molnar <mingo@redhat.com>
6 *
7 * Interactivity improvements by Mike Galbraith
8 * (C) 2007 Mike Galbraith <efault@gmx.de>

--- 8254 unchanged lines hidden (view full) ---

8263 int next_buddy_marked = 0;
8264 int cse_is_idle, pse_is_idle;
8265
8266 if (unlikely(se == pse))
8267 return;
8268
8269 /*
8270 * This is possible from callers such as attach_tasks(), in which we
8271 * unconditionally check_preempt_curr() after an enqueue (which may have
8271 * unconditionally wakeup_preempt() after an enqueue (which may have
8272 * lead to a throttle). This both saves work and prevents false
8273 * next-buddy nomination below.
8274 */
8275 if (unlikely(throttled_hierarchy(cfs_rq_of(pse))))
8276 return;
8277
8278 if (sched_feat(NEXT_BUDDY) && !(wake_flags & WF_FORK)) {
8279 set_next_buddy(pse);

--- 882 unchanged lines hidden (view full) ---

9162 * attach_task() -- attach the task detached by detach_task() to its new rq.
9163 */
9164static void attach_task(struct rq *rq, struct task_struct *p)
9165{
9166 lockdep_assert_rq_held(rq);
9167
9168 WARN_ON_ONCE(task_rq(p) != rq);
9169 activate_task(rq, p, ENQUEUE_NOCLOCK);
8272 * lead to a throttle). This both saves work and prevents false
8273 * next-buddy nomination below.
8274 */
8275 if (unlikely(throttled_hierarchy(cfs_rq_of(pse))))
8276 return;
8277
8278 if (sched_feat(NEXT_BUDDY) && !(wake_flags & WF_FORK)) {
8279 set_next_buddy(pse);

--- 882 unchanged lines hidden (view full) ---

9162 * attach_task() -- attach the task detached by detach_task() to its new rq.
9163 */
9164static void attach_task(struct rq *rq, struct task_struct *p)
9165{
9166 lockdep_assert_rq_held(rq);
9167
9168 WARN_ON_ONCE(task_rq(p) != rq);
9169 activate_task(rq, p, ENQUEUE_NOCLOCK);
9170 check_preempt_curr(rq, p, 0);
9170 wakeup_preempt(rq, p, 0);
9171}
9172
9173/*
9174 * attach_one_task() -- attaches the task returned from detach_one_task() to
9175 * its new rq.
9176 */
9177static void attach_one_task(struct rq *rq, struct task_struct *p)
9178{

--- 3457 unchanged lines hidden (view full) ---

12636 * Reschedule if we are currently running on this runqueue and
12637 * our priority decreased, or if we are not currently running on
12638 * this runqueue and our priority is higher than the current's
12639 */
12640 if (task_current(rq, p)) {
12641 if (p->prio > oldprio)
12642 resched_curr(rq);
12643 } else
9171}
9172
9173/*
9174 * attach_one_task() -- attaches the task returned from detach_one_task() to
9175 * its new rq.
9176 */
9177static void attach_one_task(struct rq *rq, struct task_struct *p)
9178{

--- 3457 unchanged lines hidden (view full) ---

12636 * Reschedule if we are currently running on this runqueue and
12637 * our priority decreased, or if we are not currently running on
12638 * this runqueue and our priority is higher than the current's
12639 */
12640 if (task_current(rq, p)) {
12641 if (p->prio > oldprio)
12642 resched_curr(rq);
12643 } else
12644 check_preempt_curr(rq, p, 0);
12644 wakeup_preempt(rq, p, 0);
12645}
12646
12647#ifdef CONFIG_FAIR_GROUP_SCHED
12648/*
12649 * Propagate the changes of the sched_entity across the tg tree to make it
12650 * visible to the root
12651 */
12652static void propagate_entity_cfs_rq(struct sched_entity *se)

--- 85 unchanged lines hidden (view full) ---

12738 /*
12739 * We were most likely switched from sched_rt, so
12740 * kick off the schedule if running, otherwise just see
12741 * if we can still preempt the current task.
12742 */
12743 if (task_current(rq, p))
12744 resched_curr(rq);
12745 else
12645}
12646
12647#ifdef CONFIG_FAIR_GROUP_SCHED
12648/*
12649 * Propagate the changes of the sched_entity across the tg tree to make it
12650 * visible to the root
12651 */
12652static void propagate_entity_cfs_rq(struct sched_entity *se)

--- 85 unchanged lines hidden (view full) ---

12738 /*
12739 * We were most likely switched from sched_rt, so
12740 * kick off the schedule if running, otherwise just see
12741 * if we can still preempt the current task.
12742 */
12743 if (task_current(rq, p))
12744 resched_curr(rq);
12745 else
12746 check_preempt_curr(rq, p, 0);
12746 wakeup_preempt(rq, p, 0);
12747 }
12748}
12749
12750/* Account for a task changing its policy or group.
12751 *
12752 * This routine is mostly called to set cfs_rq->curr field when a task
12753 * migrates between groups/classes.
12754 */

--- 342 unchanged lines hidden (view full) ---

13097 */
13098DEFINE_SCHED_CLASS(fair) = {
13099
13100 .enqueue_task = enqueue_task_fair,
13101 .dequeue_task = dequeue_task_fair,
13102 .yield_task = yield_task_fair,
13103 .yield_to_task = yield_to_task_fair,
13104
12747 }
12748}
12749
12750/* Account for a task changing its policy or group.
12751 *
12752 * This routine is mostly called to set cfs_rq->curr field when a task
12753 * migrates between groups/classes.
12754 */

--- 342 unchanged lines hidden (view full) ---

13097 */
13098DEFINE_SCHED_CLASS(fair) = {
13099
13100 .enqueue_task = enqueue_task_fair,
13101 .dequeue_task = dequeue_task_fair,
13102 .yield_task = yield_task_fair,
13103 .yield_to_task = yield_to_task_fair,
13104
13105 .check_preempt_curr = check_preempt_wakeup_fair,
13105 .wakeup_preempt = check_preempt_wakeup_fair,
13106
13107 .pick_next_task = __pick_next_task_fair,
13108 .put_prev_task = put_prev_task_fair,
13109 .set_next_task = set_next_task_fair,
13110
13111#ifdef CONFIG_SMP
13112 .balance = balance_fair,
13113 .pick_task = pick_task_fair,

--- 97 unchanged lines hidden ---
13106
13107 .pick_next_task = __pick_next_task_fair,
13108 .put_prev_task = put_prev_task_fair,
13109 .set_next_task = set_next_task_fair,
13110
13111#ifdef CONFIG_SMP
13112 .balance = balance_fair,
13113 .pick_task = pick_task_fair,

--- 97 unchanged lines hidden ---