Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 56aa4129 authored by Rusty Russell's avatar Rusty Russell Committed by Benjamin Herrenschmidt
Browse files

cpumask: Use mm_cpumask() wrapper instead of cpu_vm_mask



Makes code futureproof against the impending change to mm->cpu_vm_mask.

It's also a chance to use the new cpumask_ ops which take a pointer
(the older ones are deprecated, but there's no hurry for arch code).

Signed-off-by: default avatarRusty Russell <rusty@rustcorp.com.au>
Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
parent f5ac590e
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -31,7 +31,7 @@ static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next,
			     struct task_struct *tsk)
{
	/* Mark this context has been used on the new CPU */
	cpu_set(smp_processor_id(), next->cpu_vm_mask);
	cpumask_set_cpu(smp_processor_id(), mm_cpumask(next));

	/* 32-bit keeps track of the current PGDIR in the thread struct */
#ifdef CONFIG_PPC32
+4 −6
Original line number Diff line number Diff line
@@ -859,7 +859,7 @@ int hash_page(unsigned long ea, unsigned long access, unsigned long trap)
	unsigned long vsid;
	struct mm_struct *mm;
	pte_t *ptep;
	cpumask_t tmp;
	const struct cpumask *tmp;
	int rc, user_region = 0, local = 0;
	int psize, ssize;

@@ -907,8 +907,8 @@ int hash_page(unsigned long ea, unsigned long access, unsigned long trap)
		return 1;

	/* Check CPU locality */
	tmp = cpumask_of_cpu(smp_processor_id());
	if (user_region && cpus_equal(mm->cpu_vm_mask, tmp))
	tmp = cpumask_of(smp_processor_id());
	if (user_region && cpumask_equal(mm_cpumask(mm), tmp))
		local = 1;

#ifdef CONFIG_HUGETLB_PAGE
@@ -1024,7 +1024,6 @@ void hash_preload(struct mm_struct *mm, unsigned long ea,
	unsigned long vsid;
	void *pgdir;
	pte_t *ptep;
	cpumask_t mask;
	unsigned long flags;
	int local = 0;
	int ssize;
@@ -1067,8 +1066,7 @@ void hash_preload(struct mm_struct *mm, unsigned long ea,
	local_irq_save(flags);

	/* Is that local to this CPU ? */
	mask = cpumask_of_cpu(smp_processor_id());
	if (cpus_equal(mm->cpu_vm_mask, mask))
	if (cpumask_equal(mm_cpumask(mm), cpumask_of(smp_processor_id())))
		local = 1;

	/* Hash it in */
+1 −1
Original line number Diff line number Diff line
@@ -97,7 +97,7 @@ static unsigned int steal_context_smp(unsigned int id)
		mm->context.id = MMU_NO_CONTEXT;

		/* Mark it stale on all CPUs that used this mm */
		for_each_cpu_mask_nr(cpu, mm->cpu_vm_mask)
		for_each_cpu(cpu, mm_cpumask(mm))
			__set_bit(id, stale_map[cpu]);
		return id;
	}
+1 −2
Original line number Diff line number Diff line
@@ -82,11 +82,10 @@ static void pte_free_submit(struct pte_freelist_batch *batch)
void pgtable_free_tlb(struct mmu_gather *tlb, pgtable_free_t pgf)
{
	/* This is safe since tlb_gather_mmu has disabled preemption */
        cpumask_t local_cpumask = cpumask_of_cpu(smp_processor_id());
	struct pte_freelist_batch **batchp = &__get_cpu_var(pte_freelist_cur);

	if (atomic_read(&tlb->mm->mm_users) < 2 ||
	    cpus_equal(tlb->mm->cpu_vm_mask, local_cpumask)) {
	    cpumask_equal(mm_cpumask(tlb->mm), cpumask_of(smp_processor_id()))){
		pgtable_free(pgf);
		return;
	}
+3 −3
Original line number Diff line number Diff line
@@ -139,12 +139,12 @@ void hpte_need_flush(struct mm_struct *mm, unsigned long addr,
 */
void __flush_tlb_pending(struct ppc64_tlb_batch *batch)
{
	cpumask_t tmp;
	const struct cpumask *tmp;
	int i, local = 0;

	i = batch->index;
	tmp = cpumask_of_cpu(smp_processor_id());
	if (cpus_equal(batch->mm->cpu_vm_mask, tmp))
	tmp = cpumask_of(smp_processor_id());
	if (cpumask_equal(mm_cpumask(batch->mm), tmp))
		local = 1;
	if (i == 1)
		flush_hash_page(batch->vaddr[0], batch->pte[0],
Loading