Skip to content

Commit afd1a8b

Browse files
lizf-oshtejun
authored andcommitted
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>
1 parent 5d8ba82 commit afd1a8b

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

‎kernel/cpuset.c‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1535,6 +1535,8 @@ typedef enum {
15351535
FILE_MEMORY_MIGRATE,
15361536
FILE_CPULIST,
15371537
FILE_MEMLIST,
1538+
FILE_EFFECTIVE_CPULIST,
1539+
FILE_EFFECTIVE_MEMLIST,
15381540
FILE_CPU_EXCLUSIVE,
15391541
FILE_MEM_EXCLUSIVE,
15401542
FILE_MEM_HARDWALL,
@@ -1701,6 +1703,12 @@ static int cpuset_common_seq_show(struct seq_file *sf, void *v)
17011703
case FILE_MEMLIST:
17021704
s += nodelist_scnprintf(s, count, cs->mems_allowed);
17031705
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;
17041712
default:
17051713
ret = -EINVAL;
17061714
goto out_unlock;
@@ -1785,6 +1793,18 @@ static struct cftype files[] = {
17851793
.private = FILE_MEMLIST,
17861794
},
17871795

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+
17881808
{
17891809
.name = "cpu_exclusive",
17901810
.read_u64 = cpuset_read_u64,

0 commit comments

Comments
 (0)