From: Rohit Jain <rohit.k.jain@oracle.com>
To: linux-kernel@vger.kernel.org
Cc: peterz@infradead.org, mingo@redhat.com,
steven.sistare@oracle.com, joelaf@google.com, jbacik@fb.com,
riel@redhat.com, juri.lelli@redhat.com, dhaval.giani@oracle.com,
efault@gmx.de
Subject: [RFC 2/2] Introduce sysctl(s) for the migration costs
Date: Thu, 8 Feb 2018 14:19:55 -0800 [thread overview]
Message-ID: <1518128395-14606-3-git-send-email-rohit.k.jain@oracle.com> (raw)
In-Reply-To: <1518128395-14606-1-git-send-email-rohit.k.jain@oracle.com>
This patch introduces the sysctl for sched_domain based migration costs.
These in turn can be used for performance tuning of workloads.
Signed-off-by: Rohit Jain <rohit.k.jain@oracle.com>
---
include/linux/sched/sysctl.h | 2 ++
kernel/sched/fair.c | 4 +++-
kernel/sched/topology.c | 8 ++++----
kernel/sysctl.c | 14 ++++++++++++++
4 files changed, 23 insertions(+), 5 deletions(-)
diff --git a/include/linux/sched/sysctl.h b/include/linux/sched/sysctl.h
index 1c1a151..d597f6c 100644
--- a/include/linux/sched/sysctl.h
+++ b/include/linux/sched/sysctl.h
@@ -39,6 +39,8 @@ extern unsigned int sysctl_numa_balancing_scan_size;
#ifdef CONFIG_SCHED_DEBUG
extern __read_mostly unsigned int sysctl_sched_migration_cost;
+extern __read_mostly unsigned int sysctl_sched_core_migration_cost;
+extern __read_mostly unsigned int sysctl_sched_thread_migration_cost;
extern __read_mostly unsigned int sysctl_sched_nr_migrate;
extern __read_mostly unsigned int sysctl_sched_time_avg;
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 61d3508..f395adc 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -99,7 +99,9 @@ unsigned int sysctl_sched_child_runs_first __read_mostly;
unsigned int sysctl_sched_wakeup_granularity = 1000000UL;
unsigned int normalized_sysctl_sched_wakeup_granularity = 1000000UL;
-const_debug unsigned int sysctl_sched_migration_cost = 500000UL;
+const_debug unsigned int sysctl_sched_migration_cost = 500000UL;
+const_debug unsigned int sysctl_sched_core_migration_cost = 500000UL;
+const_debug unsigned int sysctl_sched_thread_migration_cost = 0UL;
#ifdef CONFIG_SMP
/*
diff --git a/kernel/sched/topology.c b/kernel/sched/topology.c
index bcd8c64..fc147db 100644
--- a/kernel/sched/topology.c
+++ b/kernel/sched/topology.c
@@ -1148,14 +1148,14 @@ sd_init(struct sched_domain_topology_level *tl,
sd->flags |= SD_PREFER_SIBLING;
sd->imbalance_pct = 110;
sd->smt_gain = 1178; /* ~15% */
- sd->sched_migration_cost = 0;
+ sd->sched_migration_cost = sysctl_sched_thread_migration_cost;
} else if (sd->flags & SD_SHARE_PKG_RESOURCES) {
sd->flags |= SD_PREFER_SIBLING;
sd->imbalance_pct = 117;
sd->cache_nice_tries = 1;
sd->busy_idx = 2;
- sd->sched_migration_cost = 500000UL;
+ sd->sched_migration_cost = sysctl_sched_core_migration_cost;
#ifdef CONFIG_NUMA
} else if (sd->flags & SD_NUMA) {
@@ -1164,7 +1164,7 @@ sd_init(struct sched_domain_topology_level *tl,
sd->idle_idx = 2;
sd->flags |= SD_SERIALIZE;
- sd->sched_migration_cost = 5000000UL;
+ sd->sched_migration_cost = sysctl_sched_migration_cost;
if (sched_domains_numa_distance[tl->numa_level] > RECLAIM_DISTANCE) {
sd->flags &= ~(SD_BALANCE_EXEC |
SD_BALANCE_FORK |
@@ -1177,7 +1177,7 @@ sd_init(struct sched_domain_topology_level *tl,
sd->cache_nice_tries = 1;
sd->busy_idx = 2;
sd->idle_idx = 1;
- sd->sched_migration_cost = 5000000UL;
+ sd->sched_migration_cost = sysctl_sched_migration_cost;
}
/*
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index 557d467..0920795 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -356,6 +356,20 @@ static struct ctl_table kern_table[] = {
.proc_handler = proc_dointvec,
},
{
+ .procname = "sched_core_migration_cost_ns",
+ .data = &sysctl_sched_core_migration_cost,
+ .maxlen = sizeof(unsigned int),
+ .mode = 0644,
+ .proc_handler = proc_dointvec,
+ },
+ {
+ .procname = "sched_thread_migration_cost_ns",
+ .data = &sysctl_sched_thread_migration_cost,
+ .maxlen = sizeof(unsigned int),
+ .mode = 0644,
+ .proc_handler = proc_dointvec,
+ },
+ {
.procname = "sched_nr_migrate",
.data = &sysctl_sched_nr_migrate,
.maxlen = sizeof(unsigned int),
--
2.7.4
next prev parent reply other threads:[~2018-02-08 22:16 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-08 22:19 [RFC 0/2] sched: Make idle_balance smarter about topology Rohit Jain
2018-02-08 22:19 ` [RFC 1/2] sched: reduce migration cost between faster caches for idle_balance Rohit Jain
2018-02-09 3:42 ` Mike Galbraith
2018-02-09 16:08 ` Steven Sistare
2018-02-10 6:37 ` Mike Galbraith
2018-02-15 16:35 ` Steven Sistare
2018-02-15 18:07 ` Mike Galbraith
2018-02-15 18:21 ` Steven Sistare
2018-02-15 18:39 ` Mike Galbraith
2018-02-15 18:07 ` Rohit Jain
2018-02-16 4:53 ` Mike Galbraith
2018-02-08 22:19 ` Rohit Jain [this message]
2018-02-09 3:54 ` [RFC 2/2] Introduce sysctl(s) for the migration costs Mike Galbraith
2018-02-09 16:10 ` Steven Sistare
2018-02-09 17:08 ` Mike Galbraith
2018-02-09 17:33 ` Steven Sistare
2018-02-09 17:50 ` Mike Galbraith
2018-02-12 15:28 ` 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=1518128395-14606-3-git-send-email-rohit.k.jain@oracle.com \
--to=rohit.k.jain@oracle.com \
--cc=dhaval.giani@oracle.com \
--cc=efault@gmx.de \
--cc=jbacik@fb.com \
--cc=joelaf@google.com \
--cc=juri.lelli@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=riel@redhat.com \
--cc=steven.sistare@oracle.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®