Merge branches 'acpi-ec' and 'acpi-x86'
[linux-2.6-microblaze.git] / mm / mmap.c
index d681a20..94ae183 100644 (file)
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -53,6 +53,9 @@
 #include <asm/tlb.h>
 #include <asm/mmu_context.h>
 
+#define CREATE_TRACE_POINTS
+#include <trace/events/mmap.h>
+
 #include "internal.h"
 
 #ifndef arch_mmap_check
@@ -1848,7 +1851,7 @@ unacct_error:
        return error;
 }
 
-unsigned long unmapped_area(struct vm_unmapped_area_info *info)
+static unsigned long unmapped_area(struct vm_unmapped_area_info *info)
 {
        /*
         * We implement the search by looking for an rbtree node that
@@ -1951,7 +1954,7 @@ found:
        return gap_start;
 }
 
-unsigned long unmapped_area_topdown(struct vm_unmapped_area_info *info)
+static unsigned long unmapped_area_topdown(struct vm_unmapped_area_info *info)
 {
        struct mm_struct *mm = current->mm;
        struct vm_area_struct *vma;
@@ -2050,6 +2053,27 @@ found_highest:
        return gap_end;
 }
 
+/*
+ * Search for an unmapped address range.
+ *
+ * We are looking for a range that:
+ * - does not intersect with any VMA;
+ * - is contained within the [low_limit, high_limit) interval;
+ * - is at least the desired size.
+ * - satisfies (begin_addr & align_mask) == (align_offset & align_mask)
+ */
+unsigned long vm_unmapped_area(struct vm_unmapped_area_info *info)
+{
+       unsigned long addr;
+
+       if (info->flags & VM_UNMAPPED_AREA_TOPDOWN)
+               addr = unmapped_area_topdown(info);
+       else
+               addr = unmapped_area(info);
+
+       trace_vm_unmapped_area(addr, info);
+       return addr;
+}
 
 #ifndef arch_get_mmap_end
 #define arch_get_mmap_end(addr)        (TASK_SIZE)