From: Arseniy Krasnov <a.krasnov@samsung.com>
To: linux@arm.linux.org.uk, mingo@redhat.com, peterz@infradead.org
Cc: a.krasnov@samsung.com, v.tyrtov@samsung.com,
s.rogachev@samsung.com, linux-kernel@vger.kernel.org,
Tarek Dakhran <t.dakhran@samsung.com>,
Sergey Dyasly <s.dyasly@samsung.com>,
Dmitriy Safonov <d.safonov@partner.samsung.com>,
Ilya Maximets <i.maximets@samsung.com>
Subject: [PATCH 04/13] hperf_hmp: scheduler initialization routines.
Date: Fri, 06 Nov 2015 15:02:38 +0300 [thread overview]
Message-ID: <1446811367-23783-5-git-send-email-a.krasnov@samsung.com> (raw)
In-Reply-To: <1446811367-23783-1-git-send-email-a.krasnov@samsung.com>
Adds new fields to 'rq' structure and routine called during fair class
setup, which initializes some HMP scheduler variables: big and little cluster
masks. They are read from kernel config(if set), else default values are used.
Signed-off-by: Tarek Dakhran <t.dakhran@samsung.com>
Signed-off-by: Sergey Dyasly <s.dyasly@samsung.com>
Signed-off-by: Dmitriy Safonov <d.safonov@partner.samsung.com>
Signed-off-by: Arseniy Krasnov <a.krasnov@samsung.com>
Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
---
kernel/sched/core.c | 4 ++++
kernel/sched/fair.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++
kernel/sched/sched.h | 15 +++++++++++++++
3 files changed, 65 insertions(+)
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index e3a632f..8747e06 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -7488,6 +7488,10 @@ void __init sched_init(void)
#endif
init_rq_hrtick(rq);
atomic_set(&rq->nr_iowait, 0);
+#ifdef CONFIG_HPERF_HMP
+ rq->druntime_sum = 0;
+ rq->nr_hmp_tasks = 0;
+#endif
}
set_load_weight(&init_task);
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 9a5e60f..c57007f 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -100,6 +100,11 @@ const_debug unsigned int sysctl_sched_migration_cost = 500000UL;
*/
unsigned int __read_mostly sysctl_sched_shares_window = 10000000UL;
+#ifdef CONFIG_HPERF_HMP
+extern void hmp_set_cpu_masks(struct cpumask *, struct cpumask *);
+static unsigned int freq_scale_cpu_power[CONFIG_NR_CPUS];
+#endif /* CONFIG_HPERF_HMP */
+
#ifdef CONFIG_CFS_BANDWIDTH
/*
* Amount of runtime to allocate from global (tg) to local (per-cfs_rq) pool
@@ -8305,8 +8310,38 @@ void show_numa_stats(struct task_struct *p, struct seq_file *m)
#endif /* CONFIG_NUMA_BALANCING */
#endif /* CONFIG_SCHED_DEBUG */
+#ifdef CONFIG_HPERF_HMP
+static unsigned long default_fast_mask = 0x0F;
+static unsigned long default_slow_mask = 0xF0;
+
+void hmp_set_cpu_masks(struct cpumask *fast_mask, struct cpumask *slow_mask)
+{
+ cpumask_clear(fast_mask);
+ cpumask_clear(slow_mask);
+
+ /* try to parse CPU masks from config */
+ if (strlen(CONFIG_HMP_FAST_CPU_MASK) &&
+ strlen(CONFIG_HMP_SLOW_CPU_MASK)) {
+ if (cpumask_parse(CONFIG_HMP_FAST_CPU_MASK, fast_mask) ||
+ cpumask_parse(CONFIG_HMP_SLOW_CPU_MASK, slow_mask))
+ pr_err("hperf_hmp: Failed to get CPU masks from config!\n");
+ else
+ return;
+ }
+
+ pr_err("hperf_hmp: Fast mask will be: %08lX, slow mask: %08lX\n",
+ default_fast_mask, default_slow_mask);
+
+ fast_mask->bits[0] = default_fast_mask;
+ slow_mask->bits[0] = default_slow_mask;
+}
+#endif
+
__init void init_sched_fair_class(void)
{
+#ifdef CONFIG_HPERF_HMP
+ int cpu;
+#endif
#ifdef CONFIG_SMP
open_softirq(SCHED_SOFTIRQ, run_rebalance_domains);
@@ -8315,6 +8350,17 @@ __init void init_sched_fair_class(void)
zalloc_cpumask_var(&nohz.idle_cpus_mask, GFP_NOWAIT);
cpu_notifier(sched_ilb_notifier, 0);
#endif
+
+#ifdef CONFIG_HPERF_HMP
+ for_each_possible_cpu(cpu)
+ freq_scale_cpu_power[cpu] = SCHED_CAPACITY_SCALE;
+ hmp_set_cpu_masks(cpu_fastest_mask, cpu_slowest_mask);
+ pr_info("hperf_hmp: fast CPUs mask: %08X\n",
+ (unsigned int)cpumask_bits(cpu_fastest_mask)[0]);
+ pr_info("hperf_hmp: slow CPUs mask: %08X\n",
+ (unsigned int)cpumask_bits(cpu_slowest_mask)[0]);
+#endif
+
#endif /* SMP */
}
diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h
index 6d2a119..94828dc 100644
--- a/kernel/sched/sched.h
+++ b/kernel/sched/sched.h
@@ -597,6 +597,11 @@ struct rq {
*/
unsigned long nr_uninterruptible;
+#ifdef CONFIG_HPERF_HMP
+ /* shows the amount of accumulated unfairness by tasks of this rq */
+ long druntime_sum;
+ unsigned int nr_hmp_tasks;
+#endif
struct task_struct *curr, *idle, *stop;
unsigned long next_balance;
struct mm_struct *prev_mm;
@@ -892,6 +897,16 @@ static inline unsigned int group_first_cpu(struct sched_group *group)
extern int group_balance_cpu(struct sched_group *sg);
+#ifdef CONFIG_HPERF_HMP
+extern struct cpumask *cpu_fastest_mask;
+extern struct cpumask *cpu_slowest_mask;
+
+static inline bool cpu_is_fastest(int cpu)
+{
+ return cpumask_test_cpu(cpu, cpu_fastest_mask);
+}
+#endif
+
#else
static inline void sched_ttwu_pending(void) { }
--
1.9.1
next prev parent reply other threads:[~2015-11-06 12:05 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-06 12:02 [PATCH 00/13] High performance balancing logic for big.LITTLE Arseniy Krasnov
2015-11-06 12:02 ` [PATCH 01/13] hperf_hmp: add new config for arm and arm64 Arseniy Krasnov
2015-11-06 12:02 ` [PATCH 02/13] hperf_hmp: introduce hew domain flag Arseniy Krasnov
2015-11-06 12:02 ` [PATCH 03/13] hperf_hmp: add sched domains initialization Arseniy Krasnov
2015-11-06 12:02 ` Arseniy Krasnov [this message]
2015-11-06 12:02 ` [PATCH 05/13] hperf_hmp: introduce druntime metric Arseniy Krasnov
2015-11-06 12:02 ` [PATCH 06/13] hperf_hmp: is_hmp_imbalance introduced Arseniy Krasnov
2015-11-06 12:02 ` [PATCH 07/13] hperf_hmp: migration auxiliary functions Arseniy Krasnov
2015-11-06 13:03 ` kbuild test robot
2015-11-06 12:02 ` [PATCH 08/13] hperf_hmp: swap tasks function Arseniy Krasnov
2015-11-06 12:02 ` [PATCH 09/13] hperf_hmp: one way balancing function Arseniy Krasnov
2015-11-06 12:02 ` [PATCH 10/13] hperf_hmp: idle pull function Arseniy Krasnov
2015-11-06 12:02 ` [PATCH 11/13] hperf_hmp: task CPU selection logic Arseniy Krasnov
2015-11-06 12:29 ` kbuild test robot
2015-11-06 12:02 ` [PATCH 12/13] hperf_hmp: rest of logic Arseniy Krasnov
2015-11-06 12:02 ` [PATCH 13/13] hperf_hmp: cpufreq routines Arseniy Krasnov
2015-11-07 9:52 ` [PATCH 00/13] High performance balancing logic for big.LITTLE Peter Zijlstra
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1446811367-23783-5-git-send-email-a.krasnov@samsung.com \
--to=a.krasnov@samsung.com \
--cc=d.safonov@partner.samsung.com \
--cc=i.maximets@samsung.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@arm.linux.org.uk \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=s.dyasly@samsung.com \
--cc=s.rogachev@samsung.com \
--cc=t.dakhran@samsung.com \
--cc=v.tyrtov@samsung.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®