[PATCH] mm: code improvement of check_stack_guard_page function
From: jovi zhang
Date: Sun Aug 15 2010 - 01:30:28 EST
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.
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;
}
N§²æìr¸yúèØb²X¬¶ÇvØ^)Þ{.nÇ+·¥{±êçzX§¶¡Ü}©²ÆzÚ&j:+v¨¾«êçzZ+Ê+zf£¢·h§~Ûiÿûàz¹®w¥¢¸?¨èÚ&¢)ßfù^jÇy§m
á@A«a¶Úÿ0¶ìh®åi