Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
[platform/adaptation/renesas_rcar/renesas_kernel.git] / mm / memory.c
index 7c7fa7b..5736170 100644 (file)
@@ -206,6 +206,8 @@ void tlb_gather_mmu(struct mmu_gather *tlb, struct mm_struct *mm, bool fullmm)
        tlb->mm = mm;
 
        tlb->fullmm     = fullmm;
+       tlb->start      = -1UL;
+       tlb->end        = 0;
        tlb->need_flush = 0;
        tlb->fast_mode  = (num_possible_cpus() == 1);
        tlb->local.next = NULL;
@@ -248,6 +250,8 @@ void tlb_finish_mmu(struct mmu_gather *tlb, unsigned long start, unsigned long e
 {
        struct mmu_gather_batch *batch, *next;
 
+       tlb->start = start;
+       tlb->end   = end;
        tlb_flush_mmu(tlb);
 
        /* keep the page table cache within bounds */
@@ -1204,6 +1208,11 @@ again:
         */
        if (force_flush) {
                force_flush = 0;
+
+#ifdef HAVE_GENERIC_MMU_GATHER
+               tlb->start = addr;
+               tlb->end = end;
+#endif
                tlb_flush_mmu(tlb);
                if (addr != end)
                        goto again;
@@ -1334,8 +1343,11 @@ static void unmap_single_vma(struct mmu_gather *tlb,
                         * Since no pte has actually been setup, it is
                         * safe to do nothing in this case.
                         */
-                       if (vma->vm_file)
-                               unmap_hugepage_range(vma, start, end, NULL);
+                       if (vma->vm_file) {
+                               mutex_lock(&vma->vm_file->f_mapping->i_mmap_mutex);
+                               __unmap_hugepage_range_final(tlb, vma, start, end, NULL);
+                               mutex_unlock(&vma->vm_file->f_mapping->i_mmap_mutex);
+                       }
                } else
                        unmap_page_range(tlb, vma, start, end, details);
        }
@@ -3929,7 +3941,7 @@ void print_vma_addr(char *prefix, unsigned long ip)
                        free_page((unsigned long)buf);
                }
        }
-       up_read(&current->mm->mmap_sem);
+       up_read(&mm->mmap_sem);
 }
 
 #ifdef CONFIG_PROVE_LOCKING