Skip to content

Commit 70c7605

Browse files
Christoph Hellwigpalmer-dabbelt
authored andcommitted
riscv: pass the mm_struct to __sbi_tlb_flush_range
Move the call mm_cpumask from the callers into __sbi_tlb_flush_range to reduce a bit of duplicate code and prepare for future changes. Signed-off-by: Christoph Hellwig <[email protected]> Tested-by: Guo Ren <[email protected]> Signed-off-by: Palmer Dabbelt <[email protected]>
1 parent c9811e3 commit 70c7605

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

arch/riscv/mm/tlbflush.c

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,10 @@ void flush_tlb_all(void)
1010
sbi_remote_sfence_vma(NULL, 0, -1);
1111
}
1212

13-
/*
14-
* This function must not be called with cmask being null.
15-
* Kernel may panic if cmask is NULL.
16-
*/
17-
static void __sbi_tlb_flush_range(struct cpumask *cmask, unsigned long start,
13+
static void __sbi_tlb_flush_range(struct mm_struct *mm, unsigned long start,
1814
unsigned long size, unsigned long stride)
1915
{
16+
struct cpumask *cmask = mm_cpumask(mm);
2017
struct cpumask hmask;
2118
unsigned int cpuid;
2219

@@ -41,23 +38,23 @@ static void __sbi_tlb_flush_range(struct cpumask *cmask, unsigned long start,
4138

4239
void flush_tlb_mm(struct mm_struct *mm)
4340
{
44-
__sbi_tlb_flush_range(mm_cpumask(mm), 0, -1, PAGE_SIZE);
41+
__sbi_tlb_flush_range(mm, 0, -1, PAGE_SIZE);
4542
}
4643

4744
void flush_tlb_page(struct vm_area_struct *vma, unsigned long addr)
4845
{
49-
__sbi_tlb_flush_range(mm_cpumask(vma->vm_mm), addr, PAGE_SIZE, PAGE_SIZE);
46+
__sbi_tlb_flush_range(vma->vm_mm, addr, PAGE_SIZE, PAGE_SIZE);
5047
}
5148

5249
void flush_tlb_range(struct vm_area_struct *vma, unsigned long start,
5350
unsigned long end)
5451
{
55-
__sbi_tlb_flush_range(mm_cpumask(vma->vm_mm), start, end - start, PAGE_SIZE);
52+
__sbi_tlb_flush_range(vma->vm_mm, start, end - start, PAGE_SIZE);
5653
}
5754
#ifdef CONFIG_TRANSPARENT_HUGEPAGE
5855
void flush_pmd_tlb_range(struct vm_area_struct *vma, unsigned long start,
5956
unsigned long end)
6057
{
61-
__sbi_tlb_flush_range(mm_cpumask(vma->vm_mm), start, end - start, PMD_SIZE);
58+
__sbi_tlb_flush_range(vma->vm_mm, start, end - start, PMD_SIZE);
6259
}
6360
#endif

0 commit comments

Comments
 (0)