lkml.org 
[lkml]   [2010]   [Aug]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] mm: code improvement of check_stack_guard_page
On Sun, 15 Aug 2010 13:07:56 +0800
jovi zhang <bookjovi@gmail.com> wrote:

> little code improvement of check_stack_guard_page function.
> this commit is on top of commit "mm: keep a guard page below a grow-down
> stack segment" of linus.
>

Hmm. difference in binary code finally ?

-Kame

> diff --git a/mm/memory.c b/mm/memory.c
> index 9b3b73f..643b112 100644
> --- a/mm/memory.c
> +++ b/mm/memory.c
> @@ -2768,13 +2768,15 @@ out_release:
> */
> static inline int check_stack_guard_page(struct vm_area_struct *vma,
> unsigned long address)
> {
> - address &= PAGE_MASK;
> - if ((vma->vm_flags & VM_GROWSDOWN) && address == vma->vm_start) {
> - address -= PAGE_SIZE;
> - if (find_vma(vma->vm_mm, address) != vma)
> - return -ENOMEM;
> -
> - expand_stack(vma, address);
> + if (vma->vm_flags & VM_GROWSDOWN) {
> + address &= PAGE_MASK;
> + if(address == vma->vm_start) {
> + address -= PAGE_SIZE;
> + if (unlikely(find_vma(vma->vm_mm, address) != vma))
> + return -ENOMEM;
> +
> + expand_stack(vma, address);
> + }
> }
> return 0;
> }



\
 
 \ /
  Last update: 2010-08-18 04:09    [W:0.169 / U:0.012 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site