mm/hugetlbfs: unmap pages if page fault raced with hole punch
[sfrench/cifs-2.6.git] / fs / file.c
index 1aed0add16a2c05d88249472744e6048232aea88..1fbc5c0555a9caefb153f9b07cbc716583ef658e 100644 (file)
--- a/fs/file.c
+++ b/fs/file.c
@@ -37,11 +37,12 @@ static void *alloc_fdmem(size_t size)
         * vmalloc() if the allocation size will be considered "large" by the VM.
         */
        if (size <= (PAGE_SIZE << PAGE_ALLOC_COSTLY_ORDER)) {
-               void *data = kmalloc(size, GFP_KERNEL|__GFP_NOWARN|__GFP_NORETRY);
+               void *data = kmalloc(size, GFP_KERNEL_ACCOUNT |
+                                    __GFP_NOWARN | __GFP_NORETRY);
                if (data != NULL)
                        return data;
        }
-       return vmalloc(size);
+       return __vmalloc(size, GFP_KERNEL_ACCOUNT | __GFP_HIGHMEM, PAGE_KERNEL);
 }
 
 static void __free_fdtable(struct fdtable *fdt)
@@ -126,7 +127,7 @@ static struct fdtable * alloc_fdtable(unsigned int nr)
        if (unlikely(nr > sysctl_nr_open))
                nr = ((sysctl_nr_open - 1) | (BITS_PER_LONG - 1)) + 1;
 
-       fdt = kmalloc(sizeof(struct fdtable), GFP_KERNEL);
+       fdt = kmalloc(sizeof(struct fdtable), GFP_KERNEL_ACCOUNT);
        if (!fdt)
                goto out;
        fdt->max_fds = nr;