diff options
Diffstat (limited to 'kernel/sched.c')
-rw-r--r-- | kernel/sched.c | 59 |
1 files changed, 30 insertions, 29 deletions
diff --git a/kernel/sched.c b/kernel/sched.c index d906f72b42d2..6625c3c4b10d 100644 --- a/kernel/sched.c +++ b/kernel/sched.c | |||
@@ -55,6 +55,7 @@ | |||
55 | #include <linux/cpuset.h> | 55 | #include <linux/cpuset.h> |
56 | #include <linux/percpu.h> | 56 | #include <linux/percpu.h> |
57 | #include <linux/kthread.h> | 57 | #include <linux/kthread.h> |
58 | #include <linux/proc_fs.h> | ||
58 | #include <linux/seq_file.h> | 59 | #include <linux/seq_file.h> |
59 | #include <linux/sysctl.h> | 60 | #include <linux/sysctl.h> |
60 | #include <linux/syscalls.h> | 61 | #include <linux/syscalls.h> |
@@ -227,9 +228,8 @@ static void start_rt_bandwidth(struct rt_bandwidth *rt_b) | |||
227 | 228 | ||
228 | now = hrtimer_cb_get_time(&rt_b->rt_period_timer); | 229 | now = hrtimer_cb_get_time(&rt_b->rt_period_timer); |
229 | hrtimer_forward(&rt_b->rt_period_timer, now, rt_b->rt_period); | 230 | hrtimer_forward(&rt_b->rt_period_timer, now, rt_b->rt_period); |
230 | hrtimer_start(&rt_b->rt_period_timer, | 231 | hrtimer_start_expires(&rt_b->rt_period_timer, |
231 | rt_b->rt_period_timer.expires, | 232 | HRTIMER_MODE_ABS); |
232 | HRTIMER_MODE_ABS); | ||
233 | } | 233 | } |
234 | spin_unlock(&rt_b->rt_runtime_lock); | 234 | spin_unlock(&rt_b->rt_runtime_lock); |
235 | } | 235 | } |
@@ -819,6 +819,13 @@ const_debug unsigned int sysctl_sched_nr_migrate = 32; | |||
819 | unsigned int sysctl_sched_shares_ratelimit = 250000; | 819 | unsigned int sysctl_sched_shares_ratelimit = 250000; |
820 | 820 | ||
821 | /* | 821 | /* |
822 | * Inject some fuzzyness into changing the per-cpu group shares | ||
823 | * this avoids remote rq-locks at the expense of fairness. | ||
824 | * default: 4 | ||
825 | */ | ||
826 | unsigned int sysctl_sched_shares_thresh = 4; | ||
827 | |||
828 | /* | ||
822 | * period over which we measure -rt task cpu usage in us. | 829 | * period over which we measure -rt task cpu usage in us. |
823 | * default: 1s | 830 | * default: 1s |
824 | */ | 831 | */ |
@@ -1064,7 +1071,7 @@ static void hrtick_start(struct rq *rq, u64 delay) | |||
1064 | struct hrtimer *timer = &rq->hrtick_timer; | 1071 | struct hrtimer *timer = &rq->hrtick_timer; |
1065 | ktime_t time = ktime_add_ns(timer->base->get_time(), delay); | 1072 | ktime_t time = ktime_add_ns(timer->base->get_time(), delay); |
1066 | 1073 | ||
1067 | timer->expires = time; | 1074 | hrtimer_set_expires(timer, time); |
1068 | 1075 | ||
1069 | if (rq == this_rq()) { | 1076 | if (rq == this_rq()) { |
1070 | hrtimer_restart(timer); | 1077 | hrtimer_restart(timer); |
@@ -1454,8 +1461,8 @@ static void __set_se_shares(struct sched_entity *se, unsigned long shares); | |||
1454 | * Calculate and set the cpu's group shares. | 1461 | * Calculate and set the cpu's group shares. |
1455 | */ | 1462 | */ |
1456 | static void | 1463 | static void |
1457 | __update_group_shares_cpu(struct task_group *tg, int cpu, | 1464 | update_group_shares_cpu(struct task_group *tg, int cpu, |
1458 | unsigned long sd_shares, unsigned long sd_rq_weight) | 1465 | unsigned long sd_shares, unsigned long sd_rq_weight) |
1459 | { | 1466 | { |
1460 | int boost = 0; | 1467 | int boost = 0; |
1461 | unsigned long shares; | 1468 | unsigned long shares; |
@@ -1486,19 +1493,23 @@ __update_group_shares_cpu(struct task_group *tg, int cpu, | |||
1486 | * | 1493 | * |
1487 | */ | 1494 | */ |
1488 | shares = (sd_shares * rq_weight) / (sd_rq_weight + 1); | 1495 | shares = (sd_shares * rq_weight) / (sd_rq_weight + 1); |
1496 | shares = clamp_t(unsigned long, shares, MIN_SHARES, MAX_SHARES); | ||
1489 | 1497 | ||
1490 | /* | 1498 | if (abs(shares - tg->se[cpu]->load.weight) > |
1491 | * record the actual number of shares, not the boosted amount. | 1499 | sysctl_sched_shares_thresh) { |
1492 | */ | 1500 | struct rq *rq = cpu_rq(cpu); |
1493 | tg->cfs_rq[cpu]->shares = boost ? 0 : shares; | 1501 | unsigned long flags; |
1494 | tg->cfs_rq[cpu]->rq_weight = rq_weight; | ||
1495 | 1502 | ||
1496 | if (shares < MIN_SHARES) | 1503 | spin_lock_irqsave(&rq->lock, flags); |
1497 | shares = MIN_SHARES; | 1504 | /* |
1498 | else if (shares > MAX_SHARES) | 1505 | * record the actual number of shares, not the boosted amount. |
1499 | shares = MAX_SHARES; | 1506 | */ |
1507 | tg->cfs_rq[cpu]->shares = boost ? 0 : shares; | ||
1508 | tg->cfs_rq[cpu]->rq_weight = rq_weight; | ||
1500 | 1509 | ||
1501 | __set_se_shares(tg->se[cpu], shares); | 1510 | __set_se_shares(tg->se[cpu], shares); |
1511 | spin_unlock_irqrestore(&rq->lock, flags); | ||
1512 | } | ||
1502 | } | 1513 | } |
1503 | 1514 | ||
1504 | /* | 1515 | /* |
@@ -1527,14 +1538,8 @@ static int tg_shares_up(struct task_group *tg, void *data) | |||
1527 | if (!rq_weight) | 1538 | if (!rq_weight) |
1528 | rq_weight = cpus_weight(sd->span) * NICE_0_LOAD; | 1539 | rq_weight = cpus_weight(sd->span) * NICE_0_LOAD; |
1529 | 1540 | ||
1530 | for_each_cpu_mask(i, sd->span) { | 1541 | for_each_cpu_mask(i, sd->span) |
1531 | struct rq *rq = cpu_rq(i); | 1542 | update_group_shares_cpu(tg, i, shares, rq_weight); |
1532 | unsigned long flags; | ||
1533 | |||
1534 | spin_lock_irqsave(&rq->lock, flags); | ||
1535 | __update_group_shares_cpu(tg, i, shares, rq_weight); | ||
1536 | spin_unlock_irqrestore(&rq->lock, flags); | ||
1537 | } | ||
1538 | 1543 | ||
1539 | return 0; | 1544 | return 0; |
1540 | } | 1545 | } |
@@ -4443,12 +4448,8 @@ need_resched_nonpreemptible: | |||
4443 | if (sched_feat(HRTICK)) | 4448 | if (sched_feat(HRTICK)) |
4444 | hrtick_clear(rq); | 4449 | hrtick_clear(rq); |
4445 | 4450 | ||
4446 | /* | 4451 | spin_lock_irq(&rq->lock); |
4447 | * Do the rq-clock update outside the rq lock: | ||
4448 | */ | ||
4449 | local_irq_disable(); | ||
4450 | update_rq_clock(rq); | 4452 | update_rq_clock(rq); |
4451 | spin_lock(&rq->lock); | ||
4452 | clear_tsk_need_resched(prev); | 4453 | clear_tsk_need_resched(prev); |
4453 | 4454 | ||
4454 | if (prev->state && !(preempt_count() & PREEMPT_ACTIVE)) { | 4455 | if (prev->state && !(preempt_count() & PREEMPT_ACTIVE)) { |