Skip to content

Commit d01d482

Browse files
heicarstIngo Molnar
authored andcommitted
sched: Always show Cpus_allowed field in /proc/<pid>/status
The Cpus_allowed fields in /proc/<pid>/status is currently only shown in case of CONFIG_CPUSETS. However their contents are also useful for the !CONFIG_CPUSETS case. So change the current behaviour and always show these fields. Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Oleg Nesterov <oleg@redhat.com> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> LKML-Reference: <20090921090627.GD4649@osiris.boeblingen.de.ibm.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
1 parent 0d721ce commit d01d482

2 files changed

Lines changed: 12 additions & 7 deletions

File tree

‎fs/proc/array.c‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,16 @@ static inline void task_context_switch_counts(struct seq_file *m,
321321
p->nivcsw);
322322
}
323323

324+
static void task_cpus_allowed(struct seq_file *m, struct task_struct *task)
325+
{
326+
seq_printf(m, "Cpus_allowed:\t");
327+
seq_cpumask(m, &task->cpus_allowed);
328+
seq_printf(m, "\n");
329+
seq_printf(m, "Cpus_allowed_list:\t");
330+
seq_cpumask_list(m, &task->cpus_allowed);
331+
seq_printf(m, "\n");
332+
}
333+
324334
int proc_pid_status(struct seq_file *m, struct pid_namespace *ns,
325335
struct pid *pid, struct task_struct *task)
326336
{
@@ -335,6 +345,7 @@ int proc_pid_status(struct seq_file *m, struct pid_namespace *ns,
335345
}
336346
task_sig(m, task);
337347
task_cap(m, task);
348+
task_cpus_allowed(m, task);
338349
cpuset_task_status_allowed(m, task);
339350
#if defined(CONFIG_S390)
340351
task_show_regs(m, task);

‎kernel/cpuset.c‎

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2499,15 +2499,9 @@ const struct file_operations proc_cpuset_operations = {
24992499
};
25002500
#endif /* CONFIG_PROC_PID_CPUSET */
25012501

2502-
/* Display task cpus_allowed, mems_allowed in /proc/<pid>/status file. */
2502+
/* Display task mems_allowed in /proc/<pid>/status file. */
25032503
void cpuset_task_status_allowed(struct seq_file *m, struct task_struct *task)
25042504
{
2505-
seq_printf(m, "Cpus_allowed:\t");
2506-
seq_cpumask(m, &task->cpus_allowed);
2507-
seq_printf(m, "\n");
2508-
seq_printf(m, "Cpus_allowed_list:\t");
2509-
seq_cpumask_list(m, &task->cpus_allowed);
2510-
seq_printf(m, "\n");
25112505
seq_printf(m, "Mems_allowed:\t");
25122506
seq_nodemask(m, &task->mems_allowed);
25132507
seq_printf(m, "\n");

0 commit comments

Comments
 (0)