aboutsummaryrefslogtreecommitdiffstats
path: root/mm/util.c
diff options
context:
space:
mode:
Diffstat (limited to 'mm/util.c')
-rw-r--r--mm/util.c27
1 files changed, 1 insertions, 26 deletions
diff --git a/mm/util.c b/mm/util.c
index c108a6542d05..4fb14ca5a419 100644
--- a/mm/util.c
+++ b/mm/util.c
@@ -230,36 +230,11 @@ void __vma_link_list(struct mm_struct *mm, struct vm_area_struct *vma,
230} 230}
231 231
232/* Check if the vma is being used as a stack by this task */ 232/* Check if the vma is being used as a stack by this task */
233static int vm_is_stack_for_task(struct task_struct *t, 233int vma_is_stack_for_task(struct vm_area_struct *vma, struct task_struct *t)
234 struct vm_area_struct *vma)
235{ 234{
236 return (vma->vm_start <= KSTK_ESP(t) && vma->vm_end >= KSTK_ESP(t)); 235 return (vma->vm_start <= KSTK_ESP(t) && vma->vm_end >= KSTK_ESP(t));
237} 236}
238 237
239/*
240 * Check if the vma is being used as a stack.
241 * If is_group is non-zero, check in the entire thread group or else
242 * just check in the current task. Returns the task_struct of the task
243 * that the vma is stack for. Must be called under rcu_read_lock().
244 */
245struct task_struct *task_of_stack(struct task_struct *task,
246 struct vm_area_struct *vma, bool in_group)
247{
248 if (vm_is_stack_for_task(task, vma))
249 return task;
250
251 if (in_group) {
252 struct task_struct *t;
253
254 for_each_thread(task, t) {
255 if (vm_is_stack_for_task(t, vma))
256 return t;
257 }
258 }
259
260 return NULL;
261}
262
263#if defined(CONFIG_MMU) && !defined(HAVE_ARCH_PICK_MMAP_LAYOUT) 238#if defined(CONFIG_MMU) && !defined(HAVE_ARCH_PICK_MMAP_LAYOUT)
264void arch_pick_mmap_layout(struct mm_struct *mm) 239void arch_pick_mmap_layout(struct mm_struct *mm)
265{ 240{