mm/hugetlb: add tlb_remove_hugetlb_entry for handling hugetlb pages
authorAneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Tue, 13 Dec 2016 00:42:37 +0000 (16:42 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Tue, 13 Dec 2016 02:55:07 +0000 (18:55 -0800)
This add tlb_remove_hugetlb_entry similar to tlb_remove_pmd_tlb_entry.

Link: http://lkml.kernel.org/r/20161026084839.27299-4-aneesh.kumar@linux.vnet.ibm.com
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Cc: "Kirill A. Shutemov" <kirill@shutemov.name>
Cc: Dan Williams <dan.j.williams@intel.com>
Cc: Ross Zwisler <ross.zwisler@linux.intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
arch/arm/include/asm/tlb.h
arch/ia64/include/asm/tlb.h
arch/s390/include/asm/tlb.h
arch/sh/include/asm/tlb.h
arch/um/include/asm/tlb.h
include/asm-generic/tlb.h
mm/hugetlb.c

index 1e25cd80589e7370eee54dedb18d355d3bf66e48..82841ba1f51f72ce13ba9a2cdff22a5509df6dba 100644 (file)
@@ -186,6 +186,8 @@ tlb_remove_tlb_entry(struct mmu_gather *tlb, pte_t *ptep, unsigned long addr)
        tlb_add_flush(tlb, addr);
 }
 
+#define tlb_remove_huge_tlb_entry(h, tlb, ptep, address)       \
+       tlb_remove_tlb_entry(tlb, ptep, address)
 /*
  * In the case of tlb vma handling, we can optimise these away in the
  * case where we're doing a full MM flush.  When we're doing a munmap,
index 77e541cf0e5d560b4325511f2c18d050d2ca5ddf..b3f369ab844da7a456517e04676a52c3d91d86ba 100644 (file)
@@ -283,6 +283,9 @@ do {                                                        \
        __tlb_remove_tlb_entry(tlb, ptep, addr);        \
 } while (0)
 
+#define tlb_remove_huge_tlb_entry(h, tlb, ptep, address)       \
+       tlb_remove_tlb_entry(tlb, ptep, address)
+
 #define pte_free_tlb(tlb, ptep, address)               \
 do {                                                   \
        tlb->need_flush = 1;                            \
index 15711de1040358098fd864caad1d1f3b472b2301..094440b59f9e7e1803961cdfcbb8345638b12a88 100644 (file)
@@ -162,5 +162,7 @@ static inline void pud_free_tlb(struct mmu_gather *tlb, pud_t *pud,
 #define tlb_remove_tlb_entry(tlb, ptep, addr)  do { } while (0)
 #define tlb_remove_pmd_tlb_entry(tlb, pmdp, addr)      do { } while (0)
 #define tlb_migrate_finish(mm)                 do { } while (0)
+#define tlb_remove_huge_tlb_entry(h, tlb, ptep, address)       \
+       tlb_remove_tlb_entry(tlb, ptep, address)
 
 #endif /* _S390_TLB_H */
index 025cdb1032f6f9db7f30cfa54ccf10047772ee83..e7d15e8c75c1de36d3f1c79731d46fc78cc75759 100644 (file)
@@ -65,6 +65,9 @@ tlb_remove_tlb_entry(struct mmu_gather *tlb, pte_t *ptep, unsigned long address)
                tlb->end = address + PAGE_SIZE;
 }
 
+#define tlb_remove_huge_tlb_entry(h, tlb, ptep, address)       \
+       tlb_remove_tlb_entry(tlb, ptep, address)
+
 /*
  * In the case of tlb vma handling, we can optimise these away in the
  * case where we're doing a full MM flush.  When we're doing a munmap,
index 821ff0acfe17f7f9e4264be04d7d346731bd6b4e..a4427029c3c8eeec7a9b9085a58bedb60f891581 100644 (file)
@@ -141,6 +141,9 @@ static inline void tlb_remove_page_size(struct mmu_gather *tlb,
                __tlb_remove_tlb_entry(tlb, ptep, address);     \
        } while (0)
 
+#define tlb_remove_huge_tlb_entry(h, tlb, ptep, address)       \
+       tlb_remove_tlb_entry(tlb, ptep, address)
+
 #define pte_free_tlb(tlb, ptep, addr) __pte_free_tlb(tlb, ptep, addr)
 
 #define pud_free_tlb(tlb, pudp, addr) __pud_free_tlb(tlb, pudp, addr)
index dba727becd5f963e4ebafe4f2c8b8c5047312ab9..38c2b708df6ea5ad0021427a07113f976dbbb0dd 100644 (file)
@@ -220,6 +220,12 @@ static inline bool __tlb_remove_pte_page(struct mmu_gather *tlb, struct page *pa
                __tlb_remove_tlb_entry(tlb, ptep, address);     \
        } while (0)
 
+#define tlb_remove_huge_tlb_entry(h, tlb, ptep, address)            \
+       do {                                                         \
+               __tlb_adjust_range(tlb, address, huge_page_size(h)); \
+               __tlb_remove_tlb_entry(tlb, ptep, address);          \
+       } while (0)
+
 /**
  * tlb_remove_pmd_tlb_entry - remember a pmd mapping for later tlb invalidation
  * This is a nop so far, because only x86 needs it.
index c12296f62e8d0561d149ad401be1680334dd8379..8e519da7242deb779fca7e36c9f193acca063ea0 100644 (file)
@@ -3336,7 +3336,7 @@ void __unmap_hugepage_range(struct mmu_gather *tlb, struct vm_area_struct *vma,
                }
 
                pte = huge_ptep_get_and_clear(mm, address, ptep);
-               tlb_remove_tlb_entry(tlb, ptep, address);
+               tlb_remove_huge_tlb_entry(h, tlb, ptep, address);
                if (huge_pte_dirty(pte))
                        set_page_dirty(page);