deadline.c (3bd3706251ee8ab67e69d9340ac2abdca217e733) | deadline.c (d6a3b247627a3bc0551504eb305d624cc6fb5453) |
---|---|
1// SPDX-License-Identifier: GPL-2.0 2/* 3 * Deadline Scheduling Class (SCHED_DEADLINE) 4 * 5 * Earliest Deadline First (EDF) + Constant Bandwidth Server (CBS). 6 * 7 * Tasks that periodically executes their instances for less than their 8 * runtime won't miss any of their deadlines. --- 524 unchanged lines hidden (view full) --- 533 later_rq = find_lock_later_rq(p, rq); 534 if (!later_rq) { 535 int cpu; 536 537 /* 538 * If we cannot preempt any rq, fall back to pick any 539 * online CPU: 540 */ | 1// SPDX-License-Identifier: GPL-2.0 2/* 3 * Deadline Scheduling Class (SCHED_DEADLINE) 4 * 5 * Earliest Deadline First (EDF) + Constant Bandwidth Server (CBS). 6 * 7 * Tasks that periodically executes their instances for less than their 8 * runtime won't miss any of their deadlines. --- 524 unchanged lines hidden (view full) --- 533 later_rq = find_lock_later_rq(p, rq); 534 if (!later_rq) { 535 int cpu; 536 537 /* 538 * If we cannot preempt any rq, fall back to pick any 539 * online CPU: 540 */ |
541 cpu = cpumask_any_and(cpu_active_mask, p->cpus_ptr); | 541 cpu = cpumask_any_and(cpu_active_mask, &p->cpus_allowed); |
542 if (cpu >= nr_cpu_ids) { 543 /* 544 * Failed to find any suitable CPU. 545 * The task will never come back! 546 */ 547 BUG_ON(dl_bandwidth_enabled()); 548 549 /* --- 171 unchanged lines hidden (view full) --- 721 * assigned (function returns true if it can't). We are in fact applying 722 * one of the CBS rules: when a task wakes up, if the residual runtime 723 * over residual deadline fits within the allocated bandwidth, then we 724 * can keep the current (absolute) deadline and residual budget without 725 * disrupting the schedulability of the system. Otherwise, we should 726 * refill the runtime and set the deadline a period in the future, 727 * because keeping the current (absolute) deadline of the task would 728 * result in breaking guarantees promised to other tasks (refer to | 542 if (cpu >= nr_cpu_ids) { 543 /* 544 * Failed to find any suitable CPU. 545 * The task will never come back! 546 */ 547 BUG_ON(dl_bandwidth_enabled()); 548 549 /* --- 171 unchanged lines hidden (view full) --- 721 * assigned (function returns true if it can't). We are in fact applying 722 * one of the CBS rules: when a task wakes up, if the residual runtime 723 * over residual deadline fits within the allocated bandwidth, then we 724 * can keep the current (absolute) deadline and residual budget without 725 * disrupting the schedulability of the system. Otherwise, we should 726 * refill the runtime and set the deadline a period in the future, 727 * because keeping the current (absolute) deadline of the task would 728 * result in breaking guarantees promised to other tasks (refer to |
729 * Documentation/scheduler/sched-deadline.txt for more information). | 729 * Documentation/scheduler/sched-deadline.rst for more information). |
730 * 731 * This function returns true if: 732 * 733 * runtime / (deadline - t) > dl_runtime / dl_deadline , 734 * 735 * IOW we can't recycle current parameters. 736 * 737 * Notice that the bandwidth check is done against the deadline. For --- 1081 unchanged lines hidden (view full) --- 1819#ifdef CONFIG_SMP 1820 1821/* Only try algorithms three times */ 1822#define DL_MAX_TRIES 3 1823 1824static int pick_dl_task(struct rq *rq, struct task_struct *p, int cpu) 1825{ 1826 if (!task_running(rq, p) && | 730 * 731 * This function returns true if: 732 * 733 * runtime / (deadline - t) > dl_runtime / dl_deadline , 734 * 735 * IOW we can't recycle current parameters. 736 * 737 * Notice that the bandwidth check is done against the deadline. For --- 1081 unchanged lines hidden (view full) --- 1819#ifdef CONFIG_SMP 1820 1821/* Only try algorithms three times */ 1822#define DL_MAX_TRIES 3 1823 1824static int pick_dl_task(struct rq *rq, struct task_struct *p, int cpu) 1825{ 1826 if (!task_running(rq, p) && |
1827 cpumask_test_cpu(cpu, p->cpus_ptr)) | 1827 cpumask_test_cpu(cpu, &p->cpus_allowed)) |
1828 return 1; 1829 return 0; 1830} 1831 1832/* 1833 * Return the earliest pushable rq's task, which is suitable to be executed 1834 * on the CPU, NULL otherwise: 1835 */ --- 133 unchanged lines hidden (view full) --- 1969 */ 1970 later_rq = NULL; 1971 break; 1972 } 1973 1974 /* Retry if something changed. */ 1975 if (double_lock_balance(rq, later_rq)) { 1976 if (unlikely(task_rq(task) != rq || | 1828 return 1; 1829 return 0; 1830} 1831 1832/* 1833 * Return the earliest pushable rq's task, which is suitable to be executed 1834 * on the CPU, NULL otherwise: 1835 */ --- 133 unchanged lines hidden (view full) --- 1969 */ 1970 later_rq = NULL; 1971 break; 1972 } 1973 1974 /* Retry if something changed. */ 1975 if (double_lock_balance(rq, later_rq)) { 1976 if (unlikely(task_rq(task) != rq || |
1977 !cpumask_test_cpu(later_rq->cpu, task->cpus_ptr) || | 1977 !cpumask_test_cpu(later_rq->cpu, &task->cpus_allowed) || |
1978 task_running(rq, task) || 1979 !dl_task(task) || 1980 !task_on_rq_queued(task))) { 1981 double_unlock_balance(rq, later_rq); 1982 later_rq = NULL; 1983 break; 1984 } 1985 } --- 770 unchanged lines hidden --- | 1978 task_running(rq, task) || 1979 !dl_task(task) || 1980 !task_on_rq_queued(task))) { 1981 double_unlock_balance(rq, later_rq); 1982 later_rq = NULL; 1983 break; 1984 } 1985 } --- 770 unchanged lines hidden --- |