/* * Save get_task_policy() for show_numa_map(). */ static void hold_task_mempolicy(struct proc_maps_private *priv) { struct task_struct *task = priv->task; task_lock(task); priv->task_mempolicy = get_task_policy(task); mpol_get(priv->task_mempolicy); task_unlock(task); }
static void sched_show_numa(struct task_struct *p, struct seq_file *m) { #ifdef CONFIG_NUMA_BALANCING struct mempolicy *pol; int node, i; if (p->mm) P(mm->numa_scan_seq); task_lock(p); pol = p->mempolicy; if (pol && !(pol->flags & MPOL_F_MORON)) pol = NULL; mpol_get(pol); task_unlock(p); SEQ_printf(m, "numa_migrations, %ld\n", xchg(&p->numa_pages_migrated, 0)); for_each_online_node(node) { for (i = 0; i < 2; i++) { unsigned long nr_faults = -1; int cpu_current, home_node; if (p->numa_faults) nr_faults = p->numa_faults[2*node + i]; cpu_current = !i ? (task_node(p) == node) : (pol && node_isset(node, pol->v.nodes)); home_node = (p->numa_preferred_nid == node); SEQ_printf(m, "numa_faults, %d, %d, %d, %d, %ld\n", i, node, cpu_current, home_node, nr_faults); } } mpol_put(pol); #endif }
static void sched_show_numa(struct task_struct *p, struct seq_file *m) { #ifdef CONFIG_NUMA_BALANCING struct mempolicy *pol; if (p->mm) P(mm->numa_scan_seq); task_lock(p); pol = p->mempolicy; if (pol && !(pol->flags & MPOL_F_MORON)) pol = NULL; mpol_get(pol); task_unlock(p); P(numa_pages_migrated); P(numa_preferred_nid); P(total_numa_faults); SEQ_printf(m, "current_node=%d, numa_group_id=%d\n", task_node(p), task_numa_group_id(p)); show_numa_stats(p, m); mpol_put(pol); #endif }