diff options
author | David S. Miller <davem@davemloft.net> | 2011-12-30 13:04:14 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-12-30 13:04:14 -0500 |
commit | 7f8e3234c5f7fbdb06be050c8a1907e9c36d7c61 (patch) | |
tree | d6e9edb2087fa4a97b2cc3d585a0189672a14cf4 /mm | |
parent | 8ade06c616b34b4237c0ed77d1ff0ce04ad7d056 (diff) | |
parent | 89307babf966165171547f105e2253dec261cfa5 (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Diffstat (limited to 'mm')
-rw-r--r-- | mm/hugetlb.c | 2 | ||||
-rw-r--r-- | mm/mempolicy.c | 11 |
2 files changed, 11 insertions, 2 deletions
diff --git a/mm/hugetlb.c b/mm/hugetlb.c index 73f17c0293c0..2316840b337a 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c | |||
@@ -901,7 +901,6 @@ retry: | |||
901 | h->resv_huge_pages += delta; | 901 | h->resv_huge_pages += delta; |
902 | ret = 0; | 902 | ret = 0; |
903 | 903 | ||
904 | spin_unlock(&hugetlb_lock); | ||
905 | /* Free the needed pages to the hugetlb pool */ | 904 | /* Free the needed pages to the hugetlb pool */ |
906 | list_for_each_entry_safe(page, tmp, &surplus_list, lru) { | 905 | list_for_each_entry_safe(page, tmp, &surplus_list, lru) { |
907 | if ((--needed) < 0) | 906 | if ((--needed) < 0) |
@@ -915,6 +914,7 @@ retry: | |||
915 | VM_BUG_ON(page_count(page)); | 914 | VM_BUG_ON(page_count(page)); |
916 | enqueue_huge_page(h, page); | 915 | enqueue_huge_page(h, page); |
917 | } | 916 | } |
917 | spin_unlock(&hugetlb_lock); | ||
918 | 918 | ||
919 | /* Free unnecessary surplus pages to the buddy allocator */ | 919 | /* Free unnecessary surplus pages to the buddy allocator */ |
920 | free: | 920 | free: |
diff --git a/mm/mempolicy.c b/mm/mempolicy.c index adc395481813..c3fdbcb17658 100644 --- a/mm/mempolicy.c +++ b/mm/mempolicy.c | |||
@@ -636,6 +636,7 @@ static int mbind_range(struct mm_struct *mm, unsigned long start, | |||
636 | struct vm_area_struct *prev; | 636 | struct vm_area_struct *prev; |
637 | struct vm_area_struct *vma; | 637 | struct vm_area_struct *vma; |
638 | int err = 0; | 638 | int err = 0; |
639 | pgoff_t pgoff; | ||
639 | unsigned long vmstart; | 640 | unsigned long vmstart; |
640 | unsigned long vmend; | 641 | unsigned long vmend; |
641 | 642 | ||
@@ -643,13 +644,21 @@ static int mbind_range(struct mm_struct *mm, unsigned long start, | |||
643 | if (!vma || vma->vm_start > start) | 644 | if (!vma || vma->vm_start > start) |
644 | return -EFAULT; | 645 | return -EFAULT; |
645 | 646 | ||
647 | if (start > vma->vm_start) | ||
648 | prev = vma; | ||
649 | |||
646 | for (; vma && vma->vm_start < end; prev = vma, vma = next) { | 650 | for (; vma && vma->vm_start < end; prev = vma, vma = next) { |
647 | next = vma->vm_next; | 651 | next = vma->vm_next; |
648 | vmstart = max(start, vma->vm_start); | 652 | vmstart = max(start, vma->vm_start); |
649 | vmend = min(end, vma->vm_end); | 653 | vmend = min(end, vma->vm_end); |
650 | 654 | ||
655 | if (mpol_equal(vma_policy(vma), new_pol)) | ||
656 | continue; | ||
657 | |||
658 | pgoff = vma->vm_pgoff + | ||
659 | ((vmstart - vma->vm_start) >> PAGE_SHIFT); | ||
651 | prev = vma_merge(mm, prev, vmstart, vmend, vma->vm_flags, | 660 | prev = vma_merge(mm, prev, vmstart, vmend, vma->vm_flags, |
652 | vma->anon_vma, vma->vm_file, vma->vm_pgoff, | 661 | vma->anon_vma, vma->vm_file, pgoff, |
653 | new_pol); | 662 | new_pol); |
654 | if (prev) { | 663 | if (prev) { |
655 | vma = prev; | 664 | vma = prev; |