diff options
author | Li Zefan <lizefan@huawei.com> | 2014-07-09 04:49:25 -0400 |
---|---|---|
committer | Tejun Heo <tj@kernel.org> | 2014-07-09 15:56:18 -0400 |
commit | afd1a8b3e0bc4d045d762dfdbc4d0cee189893a4 (patch) | |
tree | e552df774556b1b91271da1107831834d809c1de /kernel/cpuset.c | |
parent | 5d8ba82c3a1f10b77bf39ee3e7670d6789a8d149 (diff) |
cpuset: export effective masks to userspace
cpuset.cpus and cpuset.mems are the configured masks, and we need
to export effective masks to userspace, so users know the real
cpus_allowed and mems_allowed that apply to the tasks in a cpuset.
v2:
- export those masks unconditionally, suggested by Tejun.
Signed-off-by: Li Zefan <lizefan@huawei.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
Diffstat (limited to 'kernel/cpuset.c')
-rw-r--r-- | kernel/cpuset.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/kernel/cpuset.c b/kernel/cpuset.c index 65878a74a66b..53a9bbf16391 100644 --- a/kernel/cpuset.c +++ b/kernel/cpuset.c | |||
@@ -1535,6 +1535,8 @@ typedef enum { | |||
1535 | FILE_MEMORY_MIGRATE, | 1535 | FILE_MEMORY_MIGRATE, |
1536 | FILE_CPULIST, | 1536 | FILE_CPULIST, |
1537 | FILE_MEMLIST, | 1537 | FILE_MEMLIST, |
1538 | FILE_EFFECTIVE_CPULIST, | ||
1539 | FILE_EFFECTIVE_MEMLIST, | ||
1538 | FILE_CPU_EXCLUSIVE, | 1540 | FILE_CPU_EXCLUSIVE, |
1539 | FILE_MEM_EXCLUSIVE, | 1541 | FILE_MEM_EXCLUSIVE, |
1540 | FILE_MEM_HARDWALL, | 1542 | FILE_MEM_HARDWALL, |
@@ -1701,6 +1703,12 @@ static int cpuset_common_seq_show(struct seq_file *sf, void *v) | |||
1701 | case FILE_MEMLIST: | 1703 | case FILE_MEMLIST: |
1702 | s += nodelist_scnprintf(s, count, cs->mems_allowed); | 1704 | s += nodelist_scnprintf(s, count, cs->mems_allowed); |
1703 | break; | 1705 | break; |
1706 | case FILE_EFFECTIVE_CPULIST: | ||
1707 | s += cpulist_scnprintf(s, count, cs->effective_cpus); | ||
1708 | break; | ||
1709 | case FILE_EFFECTIVE_MEMLIST: | ||
1710 | s += nodelist_scnprintf(s, count, cs->effective_mems); | ||
1711 | break; | ||
1704 | default: | 1712 | default: |
1705 | ret = -EINVAL; | 1713 | ret = -EINVAL; |
1706 | goto out_unlock; | 1714 | goto out_unlock; |
@@ -1786,6 +1794,18 @@ static struct cftype files[] = { | |||
1786 | }, | 1794 | }, |
1787 | 1795 | ||
1788 | { | 1796 | { |
1797 | .name = "effective_cpus", | ||
1798 | .seq_show = cpuset_common_seq_show, | ||
1799 | .private = FILE_EFFECTIVE_CPULIST, | ||
1800 | }, | ||
1801 | |||
1802 | { | ||
1803 | .name = "effective_mems", | ||
1804 | .seq_show = cpuset_common_seq_show, | ||
1805 | .private = FILE_EFFECTIVE_MEMLIST, | ||
1806 | }, | ||
1807 | |||
1808 | { | ||
1789 | .name = "cpu_exclusive", | 1809 | .name = "cpu_exclusive", |
1790 | .read_u64 = cpuset_read_u64, | 1810 | .read_u64 = cpuset_read_u64, |
1791 | .write_u64 = cpuset_write_u64, | 1811 | .write_u64 = cpuset_write_u64, |