diff options
Diffstat (limited to 'mm/util.c')
-rw-r--r-- | mm/util.c | 27 |
1 files changed, 1 insertions, 26 deletions
@@ -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 */ |
233 | static int vm_is_stack_for_task(struct task_struct *t, | 233 | int 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 | */ | ||
245 | struct 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) |
264 | void arch_pick_mmap_layout(struct mm_struct *mm) | 239 | void arch_pick_mmap_layout(struct mm_struct *mm) |
265 | { | 240 | { |