diff options
Diffstat (limited to 'mm')
| -rw-r--r-- | mm/fremap.c | 12 | ||||
| -rw-r--r-- | mm/hugetlb.c | 8 | ||||
| -rw-r--r-- | mm/memory_hotplug.c | 6 | ||||
| -rw-r--r-- | mm/mlock.c | 11 | ||||
| -rw-r--r-- | mm/mmap.c | 4 | 
5 files changed, 21 insertions, 20 deletions
diff --git a/mm/fremap.c b/mm/fremap.c index 4723ac8d2fc..87da3590c61 100644 --- a/mm/fremap.c +++ b/mm/fremap.c @@ -204,10 +204,8 @@ get_write_lock:  			unsigned long addr;  			struct file *file = get_file(vma->vm_file); -			vm_flags = vma->vm_flags; -			if (!(flags & MAP_NONBLOCK)) -				vm_flags |= VM_POPULATE; -			addr = mmap_region(file, start, size, vm_flags, pgoff); +			addr = mmap_region(file, start, size, +					vma->vm_flags, pgoff);  			fput(file);  			if (IS_ERR_VALUE(addr)) {  				err = addr; @@ -226,12 +224,6 @@ get_write_lock:  		mutex_unlock(&mapping->i_mmap_mutex);  	} -	if (!(flags & MAP_NONBLOCK) && !(vma->vm_flags & VM_POPULATE)) { -		if (!has_write_lock) -			goto get_write_lock; -		vma->vm_flags |= VM_POPULATE; -	} -  	if (vma->vm_flags & VM_LOCKED) {  		/*  		 * drop PG_Mlocked flag for over-mapped range diff --git a/mm/hugetlb.c b/mm/hugetlb.c index 0a0be33bb19..ca9a7c6d7e9 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -2124,8 +2124,12 @@ int hugetlb_report_node_meminfo(int nid, char *buf)  /* Return the number pages of memory we physically have, in PAGE_SIZE units. */  unsigned long hugetlb_total_pages(void)  { -	struct hstate *h = &default_hstate; -	return h->nr_huge_pages * pages_per_huge_page(h); +	struct hstate *h; +	unsigned long nr_total_pages = 0; + +	for_each_hstate(h) +		nr_total_pages += h->nr_huge_pages * pages_per_huge_page(h); +	return nr_total_pages;  }  static int hugetlb_acct_memory(struct hstate *h, long delta) diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c index 9597eec8239..ee376576081 100644 --- a/mm/memory_hotplug.c +++ b/mm/memory_hotplug.c @@ -1779,7 +1779,11 @@ void try_offline_node(int nid)  	for (i = 0; i < MAX_NR_ZONES; i++) {  		struct zone *zone = pgdat->node_zones + i; -		if (zone->wait_table) +		/* +		 * wait_table may be allocated from boot memory, +		 * here only free if it's allocated by vmalloc. +		 */ +		if (is_vmalloc_addr(zone->wait_table))  			vfree(zone->wait_table);  	} diff --git a/mm/mlock.c b/mm/mlock.c index 1c5e33fce63..79b7cf7d1bc 100644 --- a/mm/mlock.c +++ b/mm/mlock.c @@ -358,7 +358,7 @@ static int do_mlock(unsigned long start, size_t len, int on)  		newflags = vma->vm_flags & ~VM_LOCKED;  		if (on) -			newflags |= VM_LOCKED | VM_POPULATE; +			newflags |= VM_LOCKED;  		tmp = vma->vm_end;  		if (tmp > end) @@ -418,8 +418,7 @@ int __mm_populate(unsigned long start, unsigned long len, int ignore_errors)  		 * range with the first VMA. Also, skip undesirable VMA types.  		 */  		nend = min(end, vma->vm_end); -		if ((vma->vm_flags & (VM_IO | VM_PFNMAP | VM_POPULATE)) != -		    VM_POPULATE) +		if (vma->vm_flags & (VM_IO | VM_PFNMAP))  			continue;  		if (nstart < vma->vm_start)  			nstart = vma->vm_start; @@ -492,9 +491,9 @@ static int do_mlockall(int flags)  	struct vm_area_struct * vma, * prev = NULL;  	if (flags & MCL_FUTURE) -		current->mm->def_flags |= VM_LOCKED | VM_POPULATE; +		current->mm->def_flags |= VM_LOCKED;  	else -		current->mm->def_flags &= ~(VM_LOCKED | VM_POPULATE); +		current->mm->def_flags &= ~VM_LOCKED;  	if (flags == MCL_FUTURE)  		goto out; @@ -503,7 +502,7 @@ static int do_mlockall(int flags)  		newflags = vma->vm_flags & ~VM_LOCKED;  		if (flags & MCL_CURRENT) -			newflags |= VM_LOCKED | VM_POPULATE; +			newflags |= VM_LOCKED;  		/* Ignore errors */  		mlock_fixup(vma, &prev, vma->vm_start, vma->vm_end, newflags); diff --git a/mm/mmap.c b/mm/mmap.c index 2664a47cec9..6466699b16c 100644 --- a/mm/mmap.c +++ b/mm/mmap.c @@ -1306,7 +1306,9 @@ unsigned long do_mmap_pgoff(struct file *file, unsigned long addr,  	}  	addr = mmap_region(file, addr, len, vm_flags, pgoff); -	if (!IS_ERR_VALUE(addr) && (vm_flags & VM_POPULATE)) +	if (!IS_ERR_VALUE(addr) && +	    ((vm_flags & VM_LOCKED) || +	     (flags & (MAP_POPULATE | MAP_NONBLOCK)) == MAP_POPULATE))  		*populate = len;  	return addr;  }  |