Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 250937
b: refs/heads/master
c: 5b52fc8
h: refs/heads/master
i:
  250935: 3df5ef2
v: v3
  • Loading branch information
Stephen Wilson authored and Linus Torvalds committed May 25, 2011
1 parent 4bddfd8 commit bfd8c95
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 10 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: f2beb7983613ecca20a61604f01ab50cc7a797e6
refs/heads/master: 5b52fc890bece77bffb9fade69239f71384ef02b
36 changes: 27 additions & 9 deletions trunk/fs/proc/task_mmu.c
Original file line number Diff line number Diff line change
Expand Up @@ -871,6 +871,11 @@ struct numa_maps {
unsigned long node[MAX_NUMNODES];
};

struct numa_maps_private {
struct proc_maps_private proc_maps;
struct numa_maps md;
};

static void gather_stats(struct page *page, struct numa_maps *md, int pte_dirty)
{
int count = page_mapcount(page);
Expand Down Expand Up @@ -963,9 +968,10 @@ static int gather_hugetbl_stats(pte_t *pte, unsigned long hmask,
*/
static int show_numa_map(struct seq_file *m, void *v)
{
struct proc_maps_private *priv = m->private;
struct numa_maps_private *numa_priv = m->private;
struct proc_maps_private *proc_priv = &numa_priv->proc_maps;
struct vm_area_struct *vma = v;
struct numa_maps *md;
struct numa_maps *md = &numa_priv->md;
struct file *file = vma->vm_file;
struct mm_struct *mm = vma->vm_mm;
struct mm_walk walk = {};
Expand All @@ -976,9 +982,8 @@ static int show_numa_map(struct seq_file *m, void *v)
if (!mm)
return 0;

md = kzalloc(sizeof(struct numa_maps), GFP_KERNEL);
if (!md)
return 0;
/* Ensure we start with an empty set of numa_maps statistics. */
memset(md, 0, sizeof(*md));

md->vma = vma;

Expand All @@ -987,7 +992,7 @@ static int show_numa_map(struct seq_file *m, void *v)
walk.private = md;
walk.mm = mm;

pol = get_vma_policy(priv->task, vma, vma->vm_start);
pol = get_vma_policy(proc_priv->task, vma, vma->vm_start);
mpol_to_str(buffer, sizeof(buffer), pol, 0);
mpol_cond_put(pol);

Expand Down Expand Up @@ -1034,12 +1039,12 @@ static int show_numa_map(struct seq_file *m, void *v)
seq_printf(m, " N%d=%lu", n, md->node[n]);
out:
seq_putc(m, '\n');
kfree(md);

if (m->count < m->size)
m->version = (vma != priv->tail_vma) ? vma->vm_start : 0;
m->version = (vma != proc_priv->tail_vma) ? vma->vm_start : 0;
return 0;
}

static const struct seq_operations proc_pid_numa_maps_op = {
.start = m_start,
.next = m_next,
Expand All @@ -1049,7 +1054,20 @@ static const struct seq_operations proc_pid_numa_maps_op = {

static int numa_maps_open(struct inode *inode, struct file *file)
{
return do_maps_open(inode, file, &proc_pid_numa_maps_op);
struct numa_maps_private *priv;
int ret = -ENOMEM;
priv = kzalloc(sizeof(*priv), GFP_KERNEL);
if (priv) {
priv->proc_maps.pid = proc_pid(inode);
ret = seq_open(file, &proc_pid_numa_maps_op);
if (!ret) {
struct seq_file *m = file->private_data;
m->private = priv;
} else {
kfree(priv);
}
}
return ret;
}

const struct file_operations proc_numa_maps_operations = {
Expand Down

0 comments on commit bfd8c95

Please sign in to comment.