Skip to content

Commit 94b09d7

Browse files
Tiejun Chenozbenh
Tiejun Chen
authored andcommitted
powerpc/hugetlb: Replace __get_cpu_var with get_cpu_var
Replace __get_cpu_var safely with get_cpu_var to avoid the following call trace: [ 7253.637591] BUG: using smp_processor_id() in preemptible [00000000 00000000] code: hugemmap01/9048 [ 7253.637601] caller is free_hugepd_range.constprop.25+0x88/0x1a8 [ 7253.637605] CPU: 1 PID: 9048 Comm: hugemmap01 Not tainted 3.10.20-rt14+ torvalds#114 [ 7253.637606] Call Trace: [ 7253.637617] [cb049d80] [c0007ea4] show_stack+0x4c/0x168 (unreliable) [ 7253.637624] [cb049dc0] [c031c674] debug_smp_processor_id+0x114/0x134 [ 7253.637628] [cb049de0] [c0016d28] free_hugepd_range.constprop.25+0x88/0x1a8 [ 7253.637632] [cb049e00] [c001711c] hugetlb_free_pgd_range+0x6c/0x168 [ 7253.637639] [cb049e40] [c0117408] free_pgtables+0x12c/0x150 [ 7253.637646] [cb049e70] [c011ce38] unmap_region+0xa0/0x11c [ 7253.637671] [cb049ef0] [c011f03c] do_munmap+0x224/0x3bc [ 7253.637676] [cb049f20] [c011f2e0] vm_munmap+0x38/0x5c [ 7253.637682] [cb049f40] [c000ef88] ret_from_syscall+0x0/0x3c [ 7253.637686] --- Exception: c01 at 0xff16004 Signed-off-by: Tiejun Chen<[email protected]> Signed-off-by: Benjamin Herrenschmidt <[email protected]>
1 parent 91b973f commit 94b09d7

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

arch/powerpc/mm/hugetlbpage.c

+3-1
Original file line numberDiff line numberDiff line change
@@ -472,12 +472,13 @@ static void hugepd_free(struct mmu_gather *tlb, void *hugepte)
472472
{
473473
struct hugepd_freelist **batchp;
474474

475-
batchp = &__get_cpu_var(hugepd_freelist_cur);
475+
batchp = &get_cpu_var(hugepd_freelist_cur);
476476

477477
if (atomic_read(&tlb->mm->mm_users) < 2 ||
478478
cpumask_equal(mm_cpumask(tlb->mm),
479479
cpumask_of(smp_processor_id()))) {
480480
kmem_cache_free(hugepte_cache, hugepte);
481+
put_cpu_var(hugepd_freelist_cur);
481482
return;
482483
}
483484

@@ -491,6 +492,7 @@ static void hugepd_free(struct mmu_gather *tlb, void *hugepte)
491492
call_rcu_sched(&(*batchp)->rcu, hugepd_free_rcu_callback);
492493
*batchp = NULL;
493494
}
495+
put_cpu_var(hugepd_freelist_cur);
494496
}
495497
#endif
496498

0 commit comments

Comments
 (0)