diff options
Diffstat (limited to 'fs/proc')
-rw-r--r-- | fs/proc/task_mmu.c | 34 |
1 files changed, 10 insertions, 24 deletions
diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c index e182fc51ec2b..bb16c967eefd 100644 --- a/fs/proc/task_mmu.c +++ b/fs/proc/task_mmu.c | |||
@@ -138,12 +138,12 @@ static void vma_stop(struct proc_maps_private *priv) | |||
138 | mmput(mm); | 138 | mmput(mm); |
139 | } | 139 | } |
140 | 140 | ||
141 | static void *m_start(struct seq_file *m, loff_t *pos) | 141 | static void *m_start(struct seq_file *m, loff_t *ppos) |
142 | { | 142 | { |
143 | struct proc_maps_private *priv = m->private; | 143 | struct proc_maps_private *priv = m->private; |
144 | struct mm_struct *mm; | 144 | struct mm_struct *mm; |
145 | struct vm_area_struct *vma, *tail_vma = NULL; | 145 | struct vm_area_struct *vma; |
146 | loff_t l = *pos; | 146 | unsigned int pos = *ppos; |
147 | 147 | ||
148 | priv->task = get_pid_task(priv->pid, PIDTYPE_PID); | 148 | priv->task = get_pid_task(priv->pid, PIDTYPE_PID); |
149 | if (!priv->task) | 149 | if (!priv->task) |
@@ -152,33 +152,19 @@ static void *m_start(struct seq_file *m, loff_t *pos) | |||
152 | mm = priv->mm; | 152 | mm = priv->mm; |
153 | if (!mm || !atomic_inc_not_zero(&mm->mm_users)) | 153 | if (!mm || !atomic_inc_not_zero(&mm->mm_users)) |
154 | return NULL; | 154 | return NULL; |
155 | down_read(&mm->mmap_sem); | ||
156 | 155 | ||
157 | tail_vma = get_gate_vma(mm); | 156 | down_read(&mm->mmap_sem); |
158 | priv->tail_vma = tail_vma; | ||
159 | hold_task_mempolicy(priv); | 157 | hold_task_mempolicy(priv); |
158 | priv->tail_vma = get_gate_vma(mm); | ||
160 | 159 | ||
161 | /* | 160 | if (pos < mm->map_count) { |
162 | * Check the vma index is within the range and do | 161 | for (vma = mm->mmap; pos; pos--) |
163 | * sequential scan until m_index. | ||
164 | */ | ||
165 | vma = NULL; | ||
166 | if ((unsigned long)l < mm->map_count) { | ||
167 | vma = mm->mmap; | ||
168 | while (l-- && vma) | ||
169 | vma = vma->vm_next; | 162 | vma = vma->vm_next; |
170 | goto out; | ||
171 | } | ||
172 | |||
173 | if (l != mm->map_count) | ||
174 | tail_vma = NULL; /* After gate vma */ | ||
175 | |||
176 | out: | ||
177 | if (vma) | ||
178 | return vma; | 163 | return vma; |
164 | } | ||
179 | 165 | ||
180 | if (tail_vma) | 166 | if (pos == mm->map_count && priv->tail_vma) |
181 | return tail_vma; | 167 | return priv->tail_vma; |
182 | 168 | ||
183 | vma_stop(priv); | 169 | vma_stop(priv); |
184 | return NULL; | 170 | return NULL; |