Merge to Fedora kernel-2.6.18-1.2257_FC5 patched with stable patch-2.6.18.5-vs2.0...
[linux-2.6.git] / mm / fremap.c
index 7be2ae6..24e84dd 100644 (file)
@@ -15,6 +15,7 @@
 #include <linux/rmap.h>
 #include <linux/module.h>
 #include <linux/syscalls.h>
+#include <linux/vs_base.h>
 #include <linux/vs_memory.h>
 
 #include <asm/mmu_context.h>
@@ -76,10 +77,9 @@ int install_page(struct mm_struct *mm, struct vm_area_struct *vma,
                err = -ENOMEM;
                if (page_mapcount(page) > INT_MAX/2)
                        goto unlock;
+               if (!vx_rsspages_avail(mm, 1))
+                       goto unlock;
        }
-       err = -ENOMEM;
-       if (!vx_rsspages_avail(mm, 1))
-               goto unlock;
 
        if (pte_none(*pte) || !zap_pte(mm, vma, addr, pte))
                inc_mm_counter(mm, file_rss);