summaryrefslogtreecommitdiff
path: root/kernel/sched
diff options
context:
space:
mode:
authorBlagovest Kolenichev <bkolenichev@codeaurora.org>2017-12-12 03:32:55 -0800
committerBlagovest Kolenichev <bkolenichev@codeaurora.org>2017-12-12 14:25:27 -0800
commit3bda2b55b41dacecc8fdf44d9066e54b3a0b827a (patch)
tree01ca34176aaf0401099dcc89ed8297c072c9ff3e /kernel/sched
parentaaf4841e27b932dec6fae2703fae284627f335fb (diff)
parentaed4c54ad104104ac693e8a0d6b6b3f7e409bc81 (diff)
Merge android-4.4.96 (aed4c54) into msm-4.4
* refs/heads/tmp-aed4c54 Linux 4.4.96 Revert "drm: bridge: add DT bindings for TI ths8135" ecryptfs: fix dereference of NULL user_key_payload x86/microcode/intel: Disable late loading on model 79 regulator: fan53555: fix I2C device ids can: kvaser_usb: Ignore CMD_FLUSH_QUEUE_REPLY messages can: kvaser_usb: Correct return value in printout can: sun4i: fix loopback mode scsi: sg: Re-fix off by one in sg_fill_request_table() scsi: zfcp: fix erp_action use-before-initialize in REC action trace assoc_array: Fix a buggy node-splitting case Input: gtco - fix potential out-of-bound access Input: elan_i2c - add ELAN0611 to the ACPI table xen/gntdev: avoid out of bounds access in case of partial gntdev_mmap() fuse: fix READDIRPLUS skipping an entry spi: uapi: spidev: add missing ioctl header usb: xhci: Handle error condition in xhci_stop_device() ceph: unlock dangling spinlock in try_flush_caps() ALSA: hda - fix headset mic problem for Dell machines with alc236 ALSA: hda/realtek - Add support for ALC236/ALC3204 workqueue: replace pool->manager_arb mutex with a flag sched: EAS: upmigrate misfit current task sched: avoid pushing tasks to an offline CPU sched: Extend active balance to accept 'push_task' argument Revert "sched/core: Warn if ENERGY_AWARE is enabled but data is missing" Revert "sched/core: fix have_sched_energy_data build warning" FROMLIST: kbuild: clang: fix build failures with sparse check Revert "Revert "UPSTREAM: efi/libstub/arm64: Set -fpie when building the EFI stub"" BACKPORT: efi/libstub: Unify command line param parsing Conflicts: drivers/usb/host/xhci-hub.c kernel/sched/core.c kernel/sched/fair.c Change-Id: Ie36ce5de516f02b2d553043009d9afee64e7ff24 Signed-off-by: Blagovest Kolenichev <bkolenichev@codeaurora.org>
Diffstat (limited to 'kernel/sched')
-rw-r--r--kernel/sched/core.c25
-rw-r--r--kernel/sched/fair.c110
-rw-r--r--kernel/sched/sched.h4
3 files changed, 48 insertions, 91 deletions
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index eacfd2ac56a1..9dd9640bfe82 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -99,10 +99,6 @@
ATOMIC_NOTIFIER_HEAD(load_alert_notifier_head);
-#ifdef CONFIG_SMP
-static bool have_sched_energy_data(void);
-#endif
-
DEFINE_MUTEX(sched_domains_mutex);
DEFINE_PER_CPU_SHARED_ALIGNED(struct rq, runqueues);
@@ -205,11 +201,6 @@ static int sched_feat_set(char *cmp)
sysctl_sched_features &= ~(1UL << i);
sched_feat_disable(i);
} else {
-#ifdef CONFIG_SMP
- if (i == __SCHED_FEAT_ENERGY_AWARE)
- WARN(!have_sched_energy_data(),
- "Missing sched energy data\n");
-#endif
sysctl_sched_features |= (1UL << i);
sched_feat_enable(i);
}
@@ -7202,19 +7193,6 @@ static void init_sched_groups_capacity(int cpu, struct sched_domain *sd)
atomic_set(&sg->sgc->nr_busy_cpus, sg->group_weight);
}
-static bool have_sched_energy_data(void)
-{
- int cpu;
-
- for_each_possible_cpu(cpu) {
- if (!rcu_dereference(per_cpu(sd_scs, cpu)) ||
- !rcu_dereference(per_cpu(sd_ea, cpu)))
- return false;
- }
-
- return true;
-}
-
/*
* Check that the per-cpu provided sd energy data is consistent for all cpus
* within the mask.
@@ -8031,9 +8009,6 @@ static int build_sched_domains(const struct cpumask *cpu_map,
}
rcu_read_unlock();
- WARN(sched_feat(ENERGY_AWARE) && !have_sched_energy_data(),
- "Missing data for energy aware scheduling\n");
-
ret = 0;
error:
__free_domain_allocs(&d, alloc_state, cpu_map);
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 9263ffd5673f..b3a8411bac2b 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -3660,68 +3660,6 @@ static inline int migration_needed(struct task_struct *p, int cpu)
return 0;
}
-static inline int
-kick_active_balance(struct rq *rq, struct task_struct *p, int new_cpu)
-{
- unsigned long flags;
- int rc = 0;
-
- /* Invoke active balance to force migrate currently running task */
- raw_spin_lock_irqsave(&rq->lock, flags);
- if (!rq->active_balance) {
- rq->active_balance = 1;
- rq->push_cpu = new_cpu;
- get_task_struct(p);
- rq->push_task = p;
- rc = 1;
- }
- raw_spin_unlock_irqrestore(&rq->lock, flags);
-
- return rc;
-}
-
-static DEFINE_RAW_SPINLOCK(migration_lock);
-
-static bool do_migration(int reason, int new_cpu, int cpu)
-{
- if ((reason == UP_MIGRATION || reason == DOWN_MIGRATION)
- && same_cluster(new_cpu, cpu))
- return false;
-
- /* Inter cluster high irqload migrations are OK */
- return new_cpu != cpu;
-}
-
-/*
- * Check if currently running task should be migrated to a better cpu.
- *
- * Todo: Effect this via changes to nohz_balancer_kick() and load balance?
- */
-void check_for_migration(struct rq *rq, struct task_struct *p)
-{
- int cpu = cpu_of(rq), new_cpu;
- int active_balance = 0, reason;
-
- reason = migration_needed(p, cpu);
- if (!reason)
- return;
-
- raw_spin_lock(&migration_lock);
- new_cpu = select_best_cpu(p, cpu, reason, 0);
-
- if (do_migration(reason, new_cpu, cpu)) {
- active_balance = kick_active_balance(rq, p, new_cpu);
- if (active_balance)
- mark_reserved(new_cpu);
- }
-
- raw_spin_unlock(&migration_lock);
-
- if (active_balance)
- stop_one_cpu_nowait(cpu, active_load_balance_cpu_stop, rq,
- &rq->active_balance_work);
-}
-
#ifdef CONFIG_CFS_BANDWIDTH
static void init_cfs_rq_hmp_stats(struct cfs_rq *cfs_rq)
@@ -7464,7 +7402,9 @@ done:
/*
* cpu_util_wake: Compute cpu utilization with any contributions from
- * the waking task p removed.
+ * the waking task p removed. check_for_migration() looks for a better CPU of
+ * rq->curr. For that case we should return cpu util with contributions from
+ * currently running task p removed.
*/
static int cpu_util_wake(int cpu, struct task_struct *p)
{
@@ -7477,7 +7417,8 @@ static int cpu_util_wake(int cpu, struct task_struct *p)
* utilization from cpu utilization. Instead just use
* cpu_util for this case.
*/
- if (!walt_disabled && sysctl_sched_use_walt_cpu_util)
+ if (!walt_disabled && sysctl_sched_use_walt_cpu_util &&
+ p->state == TASK_WAKING)
return cpu_util(cpu);
#endif
/* Task has no contribution or is new */
@@ -11582,6 +11523,47 @@ static void rq_offline_fair(struct rq *rq)
unthrottle_offline_cfs_rqs(rq);
}
+static inline int
+kick_active_balance(struct rq *rq, struct task_struct *p, int new_cpu)
+{
+ int rc = 0;
+
+ /* Invoke active balance to force migrate currently running task */
+ raw_spin_lock(&rq->lock);
+ if (!rq->active_balance) {
+ rq->active_balance = 1;
+ rq->push_cpu = new_cpu;
+ get_task_struct(p);
+ rq->push_task = p;
+ rc = 1;
+ }
+ raw_spin_unlock(&rq->lock);
+
+ return rc;
+}
+
+void check_for_migration(struct rq *rq, struct task_struct *p)
+{
+ int new_cpu;
+ int active_balance;
+ int cpu = task_cpu(p);
+
+ if (rq->misfit_task) {
+ if (rq->curr->state != TASK_RUNNING ||
+ rq->curr->nr_cpus_allowed == 1)
+ return;
+
+ new_cpu = select_energy_cpu_brute(p, cpu, 0);
+ if (capacity_orig_of(new_cpu) > capacity_orig_of(cpu)) {
+ active_balance = kick_active_balance(rq, p, new_cpu);
+ if (active_balance)
+ stop_one_cpu_nowait(cpu,
+ active_load_balance_cpu_stop,
+ rq, &rq->active_balance_work);
+ }
+ }
+}
+
#endif /* CONFIG_SMP */
/*
diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h
index cc5ae5ddee6b..df2fd16ca076 100644
--- a/kernel/sched/sched.h
+++ b/kernel/sched/sched.h
@@ -32,8 +32,10 @@ extern long calc_load_fold_active(struct rq *this_rq);
#ifdef CONFIG_SMP
extern void update_cpu_load_active(struct rq *this_rq);
+extern void check_for_migration(struct rq *rq, struct task_struct *p);
#else
static inline void update_cpu_load_active(struct rq *this_rq) { }
+static inline void check_for_migration(struct rq *rq, struct task_struct *p) { }
#endif
/*
@@ -1447,7 +1449,6 @@ static inline bool is_short_burst_task(struct task_struct *p)
p->ravg.avg_sleep_time > sysctl_sched_short_sleep;
}
-extern void check_for_migration(struct rq *rq, struct task_struct *p);
extern void pre_big_task_count_change(const struct cpumask *cpus);
extern void post_big_task_count_change(const struct cpumask *cpus);
extern void set_hmp_defaults(void);
@@ -1707,7 +1708,6 @@ static inline int same_freq_domain(int src_cpu, int dst_cpu)
return 1;
}
-static inline void check_for_migration(struct rq *rq, struct task_struct *p) { }
static inline void pre_big_task_count_change(void) { }
static inline void post_big_task_count_change(void) { }
static inline void set_hmp_defaults(void) { }