diff options
Diffstat (limited to 'mm')
-rw-r--r-- | mm/bootmem.c | 14 | ||||
-rw-r--r-- | mm/mempolicy.c | 7 | ||||
-rw-r--r-- | mm/nommu.c | 17 | ||||
-rw-r--r-- | mm/page_alloc.c | 3 | ||||
-rw-r--r-- | mm/vmscan.c | 4 |
5 files changed, 34 insertions, 11 deletions
diff --git a/mm/bootmem.c b/mm/bootmem.c index c1330cc19783..8ec4e4c2a179 100644 --- a/mm/bootmem.c +++ b/mm/bootmem.c @@ -61,9 +61,17 @@ static unsigned long __init init_bootmem_core (pg_data_t *pgdat, { bootmem_data_t *bdata = pgdat->bdata; unsigned long mapsize = ((end - start)+7)/8; - - pgdat->pgdat_next = pgdat_list; - pgdat_list = pgdat; + static struct pglist_data *pgdat_last; + + pgdat->pgdat_next = NULL; + /* Add new nodes last so that bootmem always starts + searching in the first nodes, not the last ones */ + if (pgdat_last) + pgdat_last->pgdat_next = pgdat; + else { + pgdat_list = pgdat; + pgdat_last = pgdat; + } mapsize = ALIGN(mapsize, sizeof(long)); bdata->node_bootmem_map = phys_to_virt(mapstart << PAGE_SHIFT); diff --git a/mm/mempolicy.c b/mm/mempolicy.c index afa06e184d88..9033f0859aa8 100644 --- a/mm/mempolicy.c +++ b/mm/mempolicy.c @@ -333,8 +333,13 @@ check_range(struct mm_struct *mm, unsigned long start, unsigned long end, if (prev && prev->vm_end < vma->vm_start) return ERR_PTR(-EFAULT); if ((flags & MPOL_MF_STRICT) && !is_vm_hugetlb_page(vma)) { + unsigned long endvma = vma->vm_end; + if (endvma > end) + endvma = end; + if (vma->vm_start > start) + start = vma->vm_start; err = check_pgd_range(vma->vm_mm, - vma->vm_start, vma->vm_end, nodes); + start, endvma, nodes); if (err) { first = ERR_PTR(err); break; diff --git a/mm/nommu.c b/mm/nommu.c index fd4e8df0f02d..064d70442895 100644 --- a/mm/nommu.c +++ b/mm/nommu.c @@ -57,6 +57,11 @@ DECLARE_RWSEM(nommu_vma_sem); struct vm_operations_struct generic_file_vm_ops = { }; +EXPORT_SYMBOL(vmalloc); +EXPORT_SYMBOL(vfree); +EXPORT_SYMBOL(vmalloc_to_page); +EXPORT_SYMBOL(vmalloc_32); + /* * Handle all mappings that got truncated by a "truncate()" * system call. @@ -142,6 +147,8 @@ int get_user_pages(struct task_struct *tsk, struct mm_struct *mm, return(i); } +EXPORT_SYMBOL(get_user_pages); + DEFINE_RWLOCK(vmlist_lock); struct vm_struct *vmlist; @@ -852,7 +859,7 @@ unsigned long do_mmap_pgoff(struct file *file, error_getting_vma: up_write(&nommu_vma_sem); kfree(vml); - printk("Allocation of vml for %lu byte allocation from process %d failed\n", + printk("Allocation of vma for %lu byte allocation from process %d failed\n", len, current->pid); show_free_areas(); return -ENOMEM; @@ -909,7 +916,7 @@ int do_munmap(struct mm_struct *mm, unsigned long addr, size_t len) for (parent = &mm->context.vmlist; *parent; parent = &(*parent)->next) if ((*parent)->vma->vm_start == addr && - (*parent)->vma->vm_end == end) + ((len == 0) || ((*parent)->vma->vm_end == end))) goto found; printk("munmap of non-mmaped memory by process %d (%s): %p\n", @@ -1054,7 +1061,8 @@ struct vm_area_struct *find_extend_vma(struct mm_struct *mm, unsigned long addr) int remap_pfn_range(struct vm_area_struct *vma, unsigned long from, unsigned long to, unsigned long size, pgprot_t prot) { - return -EPERM; + vma->vm_start = vma->vm_pgoff << PAGE_SHIFT; + return 0; } void swap_unplug_io_fn(struct backing_dev_info *bdi, struct page *page) @@ -1073,9 +1081,10 @@ void arch_unmap_area(struct mm_struct *mm, unsigned long addr) void update_mem_hiwater(struct task_struct *tsk) { - unsigned long rss = get_mm_counter(tsk->mm, rss); + unsigned long rss; if (likely(tsk->mm)) { + rss = get_mm_counter(tsk->mm, rss); if (tsk->mm->hiwater_rss < rss) tsk->mm->hiwater_rss = rss; if (tsk->mm->hiwater_vm < tsk->mm->total_vm) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index c5823c395f71..ae2903339e71 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -22,6 +22,7 @@ #include <linux/pagemap.h> #include <linux/bootmem.h> #include <linux/compiler.h> +#include <linux/kernel.h> #include <linux/module.h> #include <linux/suspend.h> #include <linux/pagevec.h> @@ -117,7 +118,7 @@ static void bad_page(const char *function, struct page *page) set_page_count(page, 0); reset_page_mapcount(page); page->mapping = NULL; - tainted |= TAINT_BAD_PAGE; + add_taint(TAINT_BAD_PAGE); } #ifndef CONFIG_HUGETLB_PAGE diff --git a/mm/vmscan.c b/mm/vmscan.c index a740778f688d..0ea71e887bb6 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -1258,9 +1258,9 @@ void wakeup_kswapd(struct zone *zone, int order) pgdat->kswapd_max_order = order; if (!cpuset_zone_allowed(zone, __GFP_HARDWALL)) return; - if (!waitqueue_active(&zone->zone_pgdat->kswapd_wait)) + if (!waitqueue_active(&pgdat->kswapd_wait)) return; - wake_up_interruptible(&zone->zone_pgdat->kswapd_wait); + wake_up_interruptible(&pgdat->kswapd_wait); } #ifdef CONFIG_PM |