Commit e29cf08b authored by Mel Gorman's avatar Mel Gorman Committed by Ingo Molnar

sched/numa: Report a NUMA task group ID

It is desirable to model from userspace how the scheduler groups tasks
over time. This patch adds an ID to the numa_group and reports it via
/proc/PID/status.
Signed-off-by: default avatarMel Gorman <mgorman@suse.de>
Reviewed-by: default avatarRik van Riel <riel@redhat.com>
Cc: Andrea Arcangeli <aarcange@redhat.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
Signed-off-by: default avatarPeter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/1381141781-10992-45-git-send-email-mgorman@suse.deSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
parent 8c8a743c
...@@ -183,6 +183,7 @@ static inline void task_state(struct seq_file *m, struct pid_namespace *ns, ...@@ -183,6 +183,7 @@ static inline void task_state(struct seq_file *m, struct pid_namespace *ns,
seq_printf(m, seq_printf(m,
"State:\t%s\n" "State:\t%s\n"
"Tgid:\t%d\n" "Tgid:\t%d\n"
"Ngid:\t%d\n"
"Pid:\t%d\n" "Pid:\t%d\n"
"PPid:\t%d\n" "PPid:\t%d\n"
"TracerPid:\t%d\n" "TracerPid:\t%d\n"
...@@ -190,6 +191,7 @@ static inline void task_state(struct seq_file *m, struct pid_namespace *ns, ...@@ -190,6 +191,7 @@ static inline void task_state(struct seq_file *m, struct pid_namespace *ns,
"Gid:\t%d\t%d\t%d\t%d\n", "Gid:\t%d\t%d\t%d\t%d\n",
get_task_state(p), get_task_state(p),
task_tgid_nr_ns(p, ns), task_tgid_nr_ns(p, ns),
task_numa_group_id(p),
pid_nr_ns(pid, ns), pid_nr_ns(pid, ns),
ppid, tpid, ppid, tpid,
from_kuid_munged(user_ns, cred->uid), from_kuid_munged(user_ns, cred->uid),
......
...@@ -1452,12 +1452,17 @@ struct task_struct { ...@@ -1452,12 +1452,17 @@ struct task_struct {
#ifdef CONFIG_NUMA_BALANCING #ifdef CONFIG_NUMA_BALANCING
extern void task_numa_fault(int last_node, int node, int pages, bool migrated); extern void task_numa_fault(int last_node, int node, int pages, bool migrated);
extern pid_t task_numa_group_id(struct task_struct *p);
extern void set_numabalancing_state(bool enabled); extern void set_numabalancing_state(bool enabled);
#else #else
static inline void task_numa_fault(int last_node, int node, int pages, static inline void task_numa_fault(int last_node, int node, int pages,
bool migrated) bool migrated)
{ {
} }
static inline pid_t task_numa_group_id(struct task_struct *p)
{
return 0;
}
static inline void set_numabalancing_state(bool enabled) static inline void set_numabalancing_state(bool enabled)
{ {
} }
......
...@@ -893,12 +893,18 @@ struct numa_group { ...@@ -893,12 +893,18 @@ struct numa_group {
spinlock_t lock; /* nr_tasks, tasks */ spinlock_t lock; /* nr_tasks, tasks */
int nr_tasks; int nr_tasks;
pid_t gid;
struct list_head task_list; struct list_head task_list;
struct rcu_head rcu; struct rcu_head rcu;
atomic_long_t faults[0]; atomic_long_t faults[0];
}; };
pid_t task_numa_group_id(struct task_struct *p)
{
return p->numa_group ? p->numa_group->gid : 0;
}
static inline int task_faults_idx(int nid, int priv) static inline int task_faults_idx(int nid, int priv)
{ {
return 2 * nid + priv; return 2 * nid + priv;
...@@ -1265,6 +1271,7 @@ static void task_numa_group(struct task_struct *p, int cpupid) ...@@ -1265,6 +1271,7 @@ static void task_numa_group(struct task_struct *p, int cpupid)
atomic_set(&grp->refcount, 1); atomic_set(&grp->refcount, 1);
spin_lock_init(&grp->lock); spin_lock_init(&grp->lock);
INIT_LIST_HEAD(&grp->task_list); INIT_LIST_HEAD(&grp->task_list);
grp->gid = p->pid;
for (i = 0; i < 2*nr_node_ids; i++) for (i = 0; i < 2*nr_node_ids; i++)
atomic_long_set(&grp->faults[i], p->numa_faults[i]); atomic_long_set(&grp->faults[i], p->numa_faults[i]);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment