From: 王贇 <yun.wang@linux.alibaba.com>
To: Peter Zijlstra <peterz@infradead.org>,
hannes@cmpxchg.org, mhocko@kernel.org, vdavydov.dev@gmail.com,
Ingo Molnar <mingo@redhat.com>
Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org,
mcgrof@kernel.org, keescook@chromium.org,
linux-fsdevel@vger.kernel.org, cgroups@vger.kernel.org,
"Michal Koutný" <mkoutny@suse.com>,
"Hillf Danton" <hdanton@sina.com>
Subject: [PATCH v2 2/4] numa: append per-node execution time in cpu.numa_stat
Date: Tue, 16 Jul 2019 11:40:35 +0800 [thread overview]
Message-ID: <6973a1bf-88f2-b54e-726d-8b7d95d80197@linux.alibaba.com> (raw)
In-Reply-To: <65c1987f-bcce-2165-8c30-cf8cf3454591@linux.alibaba.com>
This patch introduced numa execution time information, to imply the numa
efficiency.
By doing 'cat /sys/fs/cgroup/cpu/CGROUP_PATH/cpu.numa_stat', we see new
output line heading with 'exectime', like:
exectime 311900 407166
which means the tasks of this cgroup executed 311900 micro seconds on
node 0, and 407166 ms on node 1.
Combined with the memory node info from memory cgroup, we can estimate
the numa efficiency, for example if the memory.numa_stat show:
total=206892 N0=21933 N1=185171
By monitoring the increments, if the topology keep in this way and
locality is not nice, then it imply numa balancing can't help migrate
the memory from node 1 to 0 which is accessing by tasks on node 0, or
tasks can't migrate to node 1 for some reason, then you may consider
to bind the workloads on the cpus of node 1.
Signed-off-by: Michael Wang <yun.wang@linux.alibaba.com>
---
Since v1:
* move implementation from memory cgroup into cpu group
* exectime now accounting in hierarchical way
* change member name into jiffies
kernel/sched/core.c | 12 ++++++++++++
kernel/sched/fair.c | 2 ++
kernel/sched/sched.h | 1 +
3 files changed, 15 insertions(+)
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 71a8d3ed8495..f8aa73aa879b 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -7307,6 +7307,18 @@ static int cpu_numa_stat_show(struct seq_file *sf, void *v)
}
seq_putc(sf, '\n');
+ seq_puts(sf, "exectime");
+ for_each_online_node(nr) {
+ int cpu;
+ u64 sum = 0;
+
+ for_each_cpu(cpu, cpumask_of_node(nr))
+ sum += per_cpu(tg->numa_stat->jiffies, cpu);
+
+ seq_printf(sf, " %u", jiffies_to_msecs(sum));
+ }
+ seq_putc(sf, '\n');
+
return 0;
}
#endif
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index cd716355d70e..2c362266af76 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -2652,6 +2652,8 @@ static void update_tg_numa_stat(struct task_struct *p)
if (idx != -1)
this_cpu_inc(tg->numa_stat->locality[idx]);
+ this_cpu_inc(tg->numa_stat->jiffies);
+
tg = tg->parent;
}
diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h
index 685a9e670880..456f83f7f595 100644
--- a/kernel/sched/sched.h
+++ b/kernel/sched/sched.h
@@ -360,6 +360,7 @@ struct cfs_bandwidth {
struct numa_stat {
u64 locality[NR_NL_INTERVAL];
+ u64 jiffies;
};
#endif
--
2.14.4.44.g2045bb6
next prev parent reply other threads:[~2019-07-16 3:40 UTC|newest]
Thread overview: 59+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-22 2:10 [RFC PATCH 0/5] NUMA Balancer Suite 王贇
2019-04-22 2:11 ` [RFC PATCH 1/5] numa: introduce per-cgroup numa balancing locality, statistic 王贇
2019-04-23 8:44 ` Peter Zijlstra
2019-04-23 9:14 ` 王贇
2019-04-23 8:46 ` Peter Zijlstra
2019-04-23 9:32 ` 王贇
2019-04-23 8:47 ` Peter Zijlstra
2019-04-23 9:33 ` 王贇
2019-04-23 9:46 ` Peter Zijlstra
2019-04-22 2:12 ` [RFC PATCH 2/5] numa: append per-node execution info in memory.numa_stat 王贇
2019-04-23 8:52 ` Peter Zijlstra
2019-04-23 9:36 ` 王贇
2019-04-23 9:46 ` Peter Zijlstra
2019-04-23 10:01 ` 王贇
2019-04-22 2:13 ` [RFC PATCH 3/5] numa: introduce per-cgroup preferred numa node 王贇
2019-04-23 8:55 ` Peter Zijlstra
2019-04-23 9:41 ` 王贇
2019-04-22 2:14 ` [RFC PATCH 4/5] numa: introduce numa balancer infrastructure 王贇
2019-04-22 2:21 ` [RFC PATCH 5/5] numa: numa balancer 王贇
2019-04-23 9:05 ` Peter Zijlstra
2019-04-23 9:59 ` 王贇
2019-04-22 14:34 ` [RFC PATCH 0/5] NUMA Balancer Suite 禹舟键
2019-04-23 2:14 ` 王贇
2019-07-03 3:26 ` [PATCH 0/4] per cpu cgroup numa suite 王贇
2019-07-03 3:28 ` [PATCH 1/4] numa: introduce per-cgroup numa balancing locality, statistic 王贇
2019-07-11 13:43 ` Peter Zijlstra
2019-07-12 3:15 ` 王贇
2019-07-11 13:47 ` Peter Zijlstra
2019-07-12 3:43 ` 王贇
2019-07-12 7:58 ` Peter Zijlstra
2019-07-12 9:11 ` 王贇
2019-07-12 9:42 ` Peter Zijlstra
2019-07-12 10:10 ` 王贇
2019-07-15 2:09 ` 王贇
2019-07-15 12:10 ` Michal Koutný
2019-07-16 2:41 ` 王贇
2019-07-19 16:47 ` Michal Koutný
2019-07-03 3:29 ` [PATCH 2/4] numa: append per-node execution info in memory.numa_stat 王贇
2019-07-11 13:45 ` Peter Zijlstra
2019-07-12 3:17 ` 王贇
2019-07-03 3:32 ` [PATCH 3/4] numa: introduce numa group per task group 王贇
2019-07-11 14:10 ` Peter Zijlstra
2019-07-12 4:03 ` 王贇
2019-07-03 3:34 ` [PATCH 4/4] numa: introduce numa cling feature 王贇
2019-07-08 2:25 ` [PATCH v2 " 王贇
2019-07-11 14:27 ` [PATCH " Peter Zijlstra
2019-07-12 3:10 ` 王贇
2019-07-12 7:53 ` Peter Zijlstra
2019-07-12 8:58 ` 王贇
2019-07-22 3:44 ` 王贇
2019-07-11 9:00 ` [PATCH 0/4] per cgroup numa suite 王贇
2019-07-16 3:38 ` [PATCH v2 0/4] per-cgroup " 王贇
2019-07-16 3:39 ` [PATCH v2 1/4] numa: introduce per-cgroup numa balancing locality statistic 王贇
2019-07-16 3:40 ` 王贇 [this message]
2019-07-19 16:39 ` [PATCH v2 2/4] numa: append per-node execution time in cpu.numa_stat Michal Koutný
2019-07-22 2:36 ` 王贇
2019-07-16 3:41 ` [PATCH v2 3/4] numa: introduce numa group per task group 王贇
2019-07-25 2:33 ` [PATCH v2 0/4] per-cgroup numa suite 王贇
2019-08-06 1:33 ` 王贇
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=6973a1bf-88f2-b54e-726d-8b7d95d80197@linux.alibaba.com \
--to=yun.wang@linux.alibaba.com \
--cc=cgroups@vger.kernel.org \
--cc=hannes@cmpxchg.org \
--cc=hdanton@sina.com \
--cc=keescook@chromium.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mcgrof@kernel.org \
--cc=mhocko@kernel.org \
--cc=mingo@redhat.com \
--cc=mkoutny@suse.com \
--cc=peterz@infradead.org \
--cc=vdavydov.dev@gmail.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