diff options
| -rw-r--r-- | include/linux/sched.h | 2 | ||||
| -rw-r--r-- | kernel/sched.c | 12 | ||||
| -rw-r--r-- | kernel/sched_fair.c | 13 | ||||
| -rw-r--r-- | kernel/sched_features.h | 1 | ||||
| -rw-r--r-- | kernel/sched_idletask.c | 6 | ||||
| -rw-r--r-- | kernel/sched_rt.c | 2 |
6 files changed, 22 insertions, 14 deletions
diff --git a/include/linux/sched.h b/include/linux/sched.h index b3b7a8f32477..d8e699b55858 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
| @@ -897,7 +897,7 @@ struct sched_class { | |||
| 897 | void (*yield_task) (struct rq *rq); | 897 | void (*yield_task) (struct rq *rq); |
| 898 | int (*select_task_rq)(struct task_struct *p, int sync); | 898 | int (*select_task_rq)(struct task_struct *p, int sync); |
| 899 | 899 | ||
| 900 | void (*check_preempt_curr) (struct rq *rq, struct task_struct *p); | 900 | void (*check_preempt_curr) (struct rq *rq, struct task_struct *p, int sync); |
| 901 | 901 | ||
| 902 | struct task_struct * (*pick_next_task) (struct rq *rq); | 902 | struct task_struct * (*pick_next_task) (struct rq *rq); |
| 903 | void (*put_prev_task) (struct rq *rq, struct task_struct *p); | 903 | void (*put_prev_task) (struct rq *rq, struct task_struct *p); |
diff --git a/kernel/sched.c b/kernel/sched.c index 0d8905a1b8ca..ad9d39b021f8 100644 --- a/kernel/sched.c +++ b/kernel/sched.c | |||
| @@ -604,9 +604,9 @@ struct rq { | |||
| 604 | 604 | ||
| 605 | static DEFINE_PER_CPU_SHARED_ALIGNED(struct rq, runqueues); | 605 | static DEFINE_PER_CPU_SHARED_ALIGNED(struct rq, runqueues); |
| 606 | 606 | ||
| 607 | static inline void check_preempt_curr(struct rq *rq, struct task_struct *p) | 607 | static inline void check_preempt_curr(struct rq *rq, struct task_struct *p, int sync) |
| 608 | { | 608 | { |
| 609 | rq->curr->sched_class->check_preempt_curr(rq, p); | 609 | rq->curr->sched_class->check_preempt_curr(rq, p, sync); |
| 610 | } | 610 | } |
| 611 | 611 | ||
| 612 | static inline int cpu_of(struct rq *rq) | 612 | static inline int cpu_of(struct rq *rq) |
| @@ -2282,7 +2282,7 @@ out_running: | |||
| 2282 | trace_mark(kernel_sched_wakeup, | 2282 | trace_mark(kernel_sched_wakeup, |
| 2283 | "pid %d state %ld ## rq %p task %p rq->curr %p", | 2283 | "pid %d state %ld ## rq %p task %p rq->curr %p", |
| 2284 | p->pid, p->state, rq, p, rq->curr); | 2284 | p->pid, p->state, rq, p, rq->curr); |
| 2285 | check_preempt_curr(rq, p); | 2285 | check_preempt_curr(rq, p, sync); |
| 2286 | 2286 | ||
| 2287 | p->state = TASK_RUNNING; | 2287 | p->state = TASK_RUNNING; |
| 2288 | #ifdef CONFIG_SMP | 2288 | #ifdef CONFIG_SMP |
| @@ -2417,7 +2417,7 @@ void wake_up_new_task(struct task_struct *p, unsigned long clone_flags) | |||
| 2417 | trace_mark(kernel_sched_wakeup_new, | 2417 | trace_mark(kernel_sched_wakeup_new, |
| 2418 | "pid %d state %ld ## rq %p task %p rq->curr %p", | 2418 | "pid %d state %ld ## rq %p task %p rq->curr %p", |
| 2419 | p->pid, p->state, rq, p, rq->curr); | 2419 | p->pid, p->state, rq, p, rq->curr); |
| 2420 | check_preempt_curr(rq, p); | 2420 | check_preempt_curr(rq, p, 0); |
| 2421 | #ifdef CONFIG_SMP | 2421 | #ifdef CONFIG_SMP |
| 2422 | if (p->sched_class->task_wake_up) | 2422 | if (p->sched_class->task_wake_up) |
| 2423 | p->sched_class->task_wake_up(rq, p); | 2423 | p->sched_class->task_wake_up(rq, p); |
| @@ -2877,7 +2877,7 @@ static void pull_task(struct rq *src_rq, struct task_struct *p, | |||
| 2877 | * Note that idle threads have a prio of MAX_PRIO, for this test | 2877 | * Note that idle threads have a prio of MAX_PRIO, for this test |
| 2878 | * to be always true for them. | 2878 | * to be always true for them. |
| 2879 | */ | 2879 | */ |
| 2880 | check_preempt_curr(this_rq, p); | 2880 | check_preempt_curr(this_rq, p, 0); |
| 2881 | } | 2881 | } |
| 2882 | 2882 | ||
| 2883 | /* | 2883 | /* |
| @@ -6007,7 +6007,7 @@ static int __migrate_task(struct task_struct *p, int src_cpu, int dest_cpu) | |||
| 6007 | set_task_cpu(p, dest_cpu); | 6007 | set_task_cpu(p, dest_cpu); |
| 6008 | if (on_rq) { | 6008 | if (on_rq) { |
| 6009 | activate_task(rq_dest, p, 0); | 6009 | activate_task(rq_dest, p, 0); |
| 6010 | check_preempt_curr(rq_dest, p); | 6010 | check_preempt_curr(rq_dest, p, 0); |
| 6011 | } | 6011 | } |
| 6012 | done: | 6012 | done: |
| 6013 | ret = 1; | 6013 | ret = 1; |
diff --git a/kernel/sched_fair.c b/kernel/sched_fair.c index a10ac0bcee64..7328383690f1 100644 --- a/kernel/sched_fair.c +++ b/kernel/sched_fair.c | |||
| @@ -1331,7 +1331,7 @@ static inline int depth_se(struct sched_entity *se) | |||
| 1331 | /* | 1331 | /* |
| 1332 | * Preempt the current task with a newly woken task if needed: | 1332 | * Preempt the current task with a newly woken task if needed: |
| 1333 | */ | 1333 | */ |
| 1334 | static void check_preempt_wakeup(struct rq *rq, struct task_struct *p) | 1334 | static void check_preempt_wakeup(struct rq *rq, struct task_struct *p, int sync) |
| 1335 | { | 1335 | { |
| 1336 | struct task_struct *curr = rq->curr; | 1336 | struct task_struct *curr = rq->curr; |
| 1337 | struct cfs_rq *cfs_rq = task_cfs_rq(curr); | 1337 | struct cfs_rq *cfs_rq = task_cfs_rq(curr); |
| @@ -1367,6 +1367,13 @@ static void check_preempt_wakeup(struct rq *rq, struct task_struct *p) | |||
| 1367 | if (!sched_feat(WAKEUP_PREEMPT)) | 1367 | if (!sched_feat(WAKEUP_PREEMPT)) |
| 1368 | return; | 1368 | return; |
| 1369 | 1369 | ||
| 1370 | if (sched_feat(WAKEUP_OVERLAP) && sync && | ||
| 1371 | se->avg_overlap < sysctl_sched_migration_cost && | ||
| 1372 | pse->avg_overlap < sysctl_sched_migration_cost) { | ||
| 1373 | resched_task(curr); | ||
| 1374 | return; | ||
| 1375 | } | ||
| 1376 | |||
| 1370 | /* | 1377 | /* |
| 1371 | * preemption test can be made between sibling entities who are in the | 1378 | * preemption test can be made between sibling entities who are in the |
| 1372 | * same cfs_rq i.e who have a common parent. Walk up the hierarchy of | 1379 | * same cfs_rq i.e who have a common parent. Walk up the hierarchy of |
| @@ -1649,7 +1656,7 @@ static void prio_changed_fair(struct rq *rq, struct task_struct *p, | |||
| 1649 | if (p->prio > oldprio) | 1656 | if (p->prio > oldprio) |
| 1650 | resched_task(rq->curr); | 1657 | resched_task(rq->curr); |
| 1651 | } else | 1658 | } else |
| 1652 | check_preempt_curr(rq, p); | 1659 | check_preempt_curr(rq, p, 0); |
| 1653 | } | 1660 | } |
| 1654 | 1661 | ||
| 1655 | /* | 1662 | /* |
| @@ -1666,7 +1673,7 @@ static void switched_to_fair(struct rq *rq, struct task_struct *p, | |||
| 1666 | if (running) | 1673 | if (running) |
| 1667 | resched_task(rq->curr); | 1674 | resched_task(rq->curr); |
| 1668 | else | 1675 | else |
| 1669 | check_preempt_curr(rq, p); | 1676 | check_preempt_curr(rq, p, 0); |
| 1670 | } | 1677 | } |
| 1671 | 1678 | ||
| 1672 | /* Account for a task changing its policy or group. | 1679 | /* Account for a task changing its policy or group. |
diff --git a/kernel/sched_features.h b/kernel/sched_features.h index 9353ca78154e..bf027a7accf8 100644 --- a/kernel/sched_features.h +++ b/kernel/sched_features.h | |||
| @@ -11,3 +11,4 @@ SCHED_FEAT(ASYM_GRAN, 1) | |||
| 11 | SCHED_FEAT(LB_BIAS, 1) | 11 | SCHED_FEAT(LB_BIAS, 1) |
| 12 | SCHED_FEAT(LB_WAKEUP_UPDATE, 1) | 12 | SCHED_FEAT(LB_WAKEUP_UPDATE, 1) |
| 13 | SCHED_FEAT(ASYM_EFF_LOAD, 1) | 13 | SCHED_FEAT(ASYM_EFF_LOAD, 1) |
| 14 | SCHED_FEAT(WAKEUP_OVERLAP, 1) | ||
diff --git a/kernel/sched_idletask.c b/kernel/sched_idletask.c index 3a4f92dbbe66..dec4ccabe2f5 100644 --- a/kernel/sched_idletask.c +++ b/kernel/sched_idletask.c | |||
| @@ -14,7 +14,7 @@ static int select_task_rq_idle(struct task_struct *p, int sync) | |||
| 14 | /* | 14 | /* |
| 15 | * Idle tasks are unconditionally rescheduled: | 15 | * Idle tasks are unconditionally rescheduled: |
| 16 | */ | 16 | */ |
| 17 | static void check_preempt_curr_idle(struct rq *rq, struct task_struct *p) | 17 | static void check_preempt_curr_idle(struct rq *rq, struct task_struct *p, int sync) |
| 18 | { | 18 | { |
| 19 | resched_task(rq->idle); | 19 | resched_task(rq->idle); |
| 20 | } | 20 | } |
| @@ -76,7 +76,7 @@ static void switched_to_idle(struct rq *rq, struct task_struct *p, | |||
| 76 | if (running) | 76 | if (running) |
| 77 | resched_task(rq->curr); | 77 | resched_task(rq->curr); |
| 78 | else | 78 | else |
| 79 | check_preempt_curr(rq, p); | 79 | check_preempt_curr(rq, p, 0); |
| 80 | } | 80 | } |
| 81 | 81 | ||
| 82 | static void prio_changed_idle(struct rq *rq, struct task_struct *p, | 82 | static void prio_changed_idle(struct rq *rq, struct task_struct *p, |
| @@ -93,7 +93,7 @@ static void prio_changed_idle(struct rq *rq, struct task_struct *p, | |||
| 93 | if (p->prio > oldprio) | 93 | if (p->prio > oldprio) |
| 94 | resched_task(rq->curr); | 94 | resched_task(rq->curr); |
| 95 | } else | 95 | } else |
| 96 | check_preempt_curr(rq, p); | 96 | check_preempt_curr(rq, p, 0); |
| 97 | } | 97 | } |
| 98 | 98 | ||
| 99 | /* | 99 | /* |
diff --git a/kernel/sched_rt.c b/kernel/sched_rt.c index 552310798dad..6d2d0a5d030b 100644 --- a/kernel/sched_rt.c +++ b/kernel/sched_rt.c | |||
| @@ -783,7 +783,7 @@ static void check_preempt_equal_prio(struct rq *rq, struct task_struct *p) | |||
| 783 | /* | 783 | /* |
| 784 | * Preempt the current task with a newly woken task if needed: | 784 | * Preempt the current task with a newly woken task if needed: |
| 785 | */ | 785 | */ |
| 786 | static void check_preempt_curr_rt(struct rq *rq, struct task_struct *p) | 786 | static void check_preempt_curr_rt(struct rq *rq, struct task_struct *p, int sync) |
| 787 | { | 787 | { |
| 788 | if (p->prio < rq->curr->prio) { | 788 | if (p->prio < rq->curr->prio) { |
| 789 | resched_task(rq->curr); | 789 | resched_task(rq->curr); |
