[PATCH 5/5] fs/proc/task_mmu.c: change m_start() to rely on priv->mm and avoid mm_access()

From: Oleg Nesterov
Date: Sun Aug 03 2014 - 17:23:03 EST


Finally we can change m_start() to avoid mm_access(), it can simply do
atomic_inc_not_zero(mm_users).

I'll try to verify, if this is the only change we need, then this one
line change doesn't deserve a separate patch.

Signed-off-by: Oleg Nesterov <oleg@xxxxxxxxxx>
---
fs/proc/task_mmu.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c
index 1cc623d..7ec8eb5 100644
--- a/fs/proc/task_mmu.c
+++ b/fs/proc/task_mmu.c
@@ -165,9 +165,9 @@ static void *m_start(struct seq_file *m, loff_t *pos)
if (!priv->task)
return ERR_PTR(-ESRCH);

- mm = mm_access(priv->task, PTRACE_MODE_READ);
- if (!mm || IS_ERR(mm))
- return mm;
+ mm = priv->mm;
+ if (!mm || !atomic_inc_not_zero(&mm->mm_users))
+ return NULL;
down_read(&mm->mmap_sem);

tail_vma = get_gate_vma(mm);
--
1.5.5.1


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/