maple_tree: separate ma_state node from status
[linux-2.6-microblaze.git] / mm / util.c
index aa01f6e..5a6a980 100644 (file)
--- a/mm/util.c
+++ b/mm/util.c
@@ -414,6 +414,15 @@ static int mmap_is_legacy(struct rlimit *rlim_stack)
 
 static unsigned long mmap_base(unsigned long rnd, struct rlimit *rlim_stack)
 {
+#ifdef CONFIG_STACK_GROWSUP
+       /*
+        * For an upwards growing stack the calculation is much simpler.
+        * Memory for the maximum stack size is reserved at the top of the
+        * task. mmap_base starts directly below the stack and grows
+        * downwards.
+        */
+       return PAGE_ALIGN_DOWN(mmap_upper_limit(rlim_stack) - rnd);
+#else
        unsigned long gap = rlim_stack->rlim_cur;
        unsigned long pad = stack_guard_gap;
 
@@ -431,6 +440,7 @@ static unsigned long mmap_base(unsigned long rnd, struct rlimit *rlim_stack)
                gap = MAX_GAP;
 
        return PAGE_ALIGN(STACK_TOP - gap - rnd);
+#endif
 }
 
 void arch_pick_mmap_layout(struct mm_struct *mm, struct rlimit *rlim_stack)
@@ -1037,11 +1047,11 @@ int __weak memcmp_pages(struct page *page1, struct page *page2)
        char *addr1, *addr2;
        int ret;
 
-       addr1 = kmap_atomic(page1);
-       addr2 = kmap_atomic(page2);
+       addr1 = kmap_local_page(page1);
+       addr2 = kmap_local_page(page2);
        ret = memcmp(addr1, addr2, PAGE_SIZE);
-       kunmap_atomic(addr2);
-       kunmap_atomic(addr1);
+       kunmap_local(addr2);
+       kunmap_local(addr1);
        return ret;
 }