tlb.c (f26e8817b235d8764363bffcc9cbfc61867371f2) | tlb.c (c7d9f77d33a779ad582d8b2284ba007931ebd894) |
---|---|
1/* arch/sparc64/mm/tlb.c 2 * 3 * Copyright (C) 2004 David S. Miller <davem@redhat.com> 4 */ 5 6#include <linux/kernel.h> 7#include <linux/percpu.h> 8#include <linux/mm.h> --- 53 unchanged lines hidden (view full) --- 62 struct tlb_batch *tb = this_cpu_ptr(&tlb_batch); 63 64 if (tb->tlb_nr) 65 flush_tlb_pending(); 66 tb->active = 0; 67} 68 69static void tlb_batch_add_one(struct mm_struct *mm, unsigned long vaddr, | 1/* arch/sparc64/mm/tlb.c 2 * 3 * Copyright (C) 2004 David S. Miller <davem@redhat.com> 4 */ 5 6#include <linux/kernel.h> 7#include <linux/percpu.h> 8#include <linux/mm.h> --- 53 unchanged lines hidden (view full) --- 62 struct tlb_batch *tb = this_cpu_ptr(&tlb_batch); 63 64 if (tb->tlb_nr) 65 flush_tlb_pending(); 66 tb->active = 0; 67} 68 69static void tlb_batch_add_one(struct mm_struct *mm, unsigned long vaddr, |
70 bool exec, bool huge) | 70 bool exec, unsigned int hugepage_shift) |
71{ 72 struct tlb_batch *tb = &get_cpu_var(tlb_batch); 73 unsigned long nr; 74 75 vaddr &= PAGE_MASK; 76 if (exec) 77 vaddr |= 0x1UL; 78 79 nr = tb->tlb_nr; 80 81 if (unlikely(nr != 0 && mm != tb->mm)) { 82 flush_tlb_pending(); 83 nr = 0; 84 } 85 86 if (!tb->active) { | 71{ 72 struct tlb_batch *tb = &get_cpu_var(tlb_batch); 73 unsigned long nr; 74 75 vaddr &= PAGE_MASK; 76 if (exec) 77 vaddr |= 0x1UL; 78 79 nr = tb->tlb_nr; 80 81 if (unlikely(nr != 0 && mm != tb->mm)) { 82 flush_tlb_pending(); 83 nr = 0; 84 } 85 86 if (!tb->active) { |
87 flush_tsb_user_page(mm, vaddr, huge); | 87 flush_tsb_user_page(mm, vaddr, hugepage_shift); |
88 global_flush_tlb_page(mm, vaddr); 89 goto out; 90 } 91 92 if (nr == 0) { 93 tb->mm = mm; | 88 global_flush_tlb_page(mm, vaddr); 89 goto out; 90 } 91 92 if (nr == 0) { 93 tb->mm = mm; |
94 tb->huge = huge; | 94 tb->hugepage_shift = hugepage_shift; |
95 } 96 | 95 } 96 |
97 if (tb->huge != huge) { | 97 if (tb->hugepage_shift != hugepage_shift) { |
98 flush_tlb_pending(); | 98 flush_tlb_pending(); |
99 tb->huge = huge; | 99 tb->hugepage_shift = hugepage_shift; |
100 nr = 0; 101 } 102 103 tb->vaddrs[nr] = vaddr; 104 tb->tlb_nr = ++nr; 105 if (nr >= TLB_BATCH_NR) 106 flush_tlb_pending(); 107 108out: 109 put_cpu_var(tlb_batch); 110} 111 112void tlb_batch_add(struct mm_struct *mm, unsigned long vaddr, | 100 nr = 0; 101 } 102 103 tb->vaddrs[nr] = vaddr; 104 tb->tlb_nr = ++nr; 105 if (nr >= TLB_BATCH_NR) 106 flush_tlb_pending(); 107 108out: 109 put_cpu_var(tlb_batch); 110} 111 112void tlb_batch_add(struct mm_struct *mm, unsigned long vaddr, |
113 pte_t *ptep, pte_t orig, int fullmm) | 113 pte_t *ptep, pte_t orig, int fullmm, 114 unsigned int hugepage_shift) |
114{ | 115{ |
115 bool huge = is_hugetlb_pte(orig); 116 | |
117 if (tlb_type != hypervisor && 118 pte_dirty(orig)) { 119 unsigned long paddr, pfn = pte_pfn(orig); 120 struct address_space *mapping; 121 struct page *page; 122 123 if (!pfn_valid(pfn)) 124 goto no_cache_flush; --- 9 unchanged lines hidden (view full) --- 134 135 paddr = (unsigned long) page_address(page); 136 if ((paddr ^ vaddr) & (1 << 13)) 137 flush_dcache_page_all(mm, page); 138 } 139 140no_cache_flush: 141 if (!fullmm) | 116 if (tlb_type != hypervisor && 117 pte_dirty(orig)) { 118 unsigned long paddr, pfn = pte_pfn(orig); 119 struct address_space *mapping; 120 struct page *page; 121 122 if (!pfn_valid(pfn)) 123 goto no_cache_flush; --- 9 unchanged lines hidden (view full) --- 133 134 paddr = (unsigned long) page_address(page); 135 if ((paddr ^ vaddr) & (1 << 13)) 136 flush_dcache_page_all(mm, page); 137 } 138 139no_cache_flush: 140 if (!fullmm) |
142 tlb_batch_add_one(mm, vaddr, pte_exec(orig), huge); | 141 tlb_batch_add_one(mm, vaddr, pte_exec(orig), hugepage_shift); |
143} 144 145#ifdef CONFIG_TRANSPARENT_HUGEPAGE 146static void tlb_batch_pmd_scan(struct mm_struct *mm, unsigned long vaddr, 147 pmd_t pmd) 148{ 149 unsigned long end; 150 pte_t *pte; --- 131 unchanged lines hidden --- | 142} 143 144#ifdef CONFIG_TRANSPARENT_HUGEPAGE 145static void tlb_batch_pmd_scan(struct mm_struct *mm, unsigned long vaddr, 146 pmd_t pmd) 147{ 148 unsigned long end; 149 pte_t *pte; --- 131 unchanged lines hidden --- |