X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=mm%2Fnommu.c;h=c61677bd1f626e684dc00cd6693bcc0eba8dc05d;hb=64ba3f394c830ec48a1c31b53dcae312c56f1604;hp=2fff336a234eb5a66848de478d5829ca7267f2ae;hpb=16c70f8c1b54b61c3b951b6fb220df250fe09b32;p=linux-2.6.git diff --git a/mm/nommu.c b/mm/nommu.c index 2fff336a2..c61677bd1 100644 --- a/mm/nommu.c +++ b/mm/nommu.c @@ -159,7 +159,7 @@ void *__vmalloc(unsigned long size, gfp_t gfp_mask, pgprot_t prot) /* * kmalloc doesn't like __GFP_HIGHMEM for some reason */ - return kmalloc(size, (gfp_mask | __GFP_COMP) & ~__GFP_HIGHMEM); + return kmalloc(size, gfp_mask & ~__GFP_HIGHMEM); } struct page * vmalloc_to_page(void *addr) @@ -623,7 +623,7 @@ static int do_mmap_private(struct vm_area_struct *vma, unsigned long len) * - note that this may not return a page-aligned address if the object * we're allocating is smaller than a page */ - base = kmalloc(len, GFP_KERNEL|__GFP_COMP); + base = kmalloc(len, GFP_KERNEL); if (!base) goto enomem; @@ -1070,7 +1070,6 @@ int remap_pfn_range(struct vm_area_struct *vma, unsigned long from, vma->vm_start = vma->vm_pgoff << PAGE_SHIFT; return 0; } -EXPORT_SYMBOL(remap_pfn_range); void swap_unplug_io_fn(struct backing_dev_info *bdi, struct page *page) { @@ -1091,7 +1090,6 @@ void unmap_mapping_range(struct address_space *mapping, int even_cows) { } -EXPORT_SYMBOL(unmap_mapping_range); /* * Check that a process has enough memory to allocate a new virtual @@ -1124,7 +1122,7 @@ int __vm_enough_memory(long pages, int cap_sys_admin) if (sysctl_overcommit_memory == OVERCOMMIT_GUESS) { unsigned long n; - free = global_page_state(NR_FILE_PAGES); + free = get_page_cache_size(); free += nr_swap_pages; /* @@ -1149,26 +1147,14 @@ int __vm_enough_memory(long pages, int cap_sys_admin) * only call if we're about to fail. */ n = nr_free_pages(); - - /* - * Leave reserved pages. The pages are not for anonymous pages. - */ - if (n <= totalreserve_pages) - goto error; - else - n -= totalreserve_pages; - - /* - * Leave the last 3% for root - */ if (!cap_sys_admin) n -= n / 32; free += n; if (free > pages) return 0; - - goto error; + vm_unacct_memory(pages); + return -ENOMEM; } allowed = totalram_pages * sysctl_overcommit_ratio / 100; @@ -1189,7 +1175,7 @@ int __vm_enough_memory(long pages, int cap_sys_admin) */ if (atomic_read(&vm_committed_space) < (long)allowed) return 0; -error: + vm_unacct_memory(pages); return -ENOMEM;