Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

mm: fix UP THP spin_is_locked BUGs

Fix CONFIG_TRANSPARENT_HUGEPAGE=y CONFIG_SMP=n CONFIG_DEBUG_VM=y
CONFIG_DEBUG_SPINLOCK=n kernel: spin_is_locked() is then always false,
and so triggers some BUGs in Transparent HugePage codepaths.

asm-generic/bug.h mentions this problem, and provides a WARN_ON_SMP(x);
but being too lazy to add VM_BUG_ON_SMP, BUG_ON_SMP, WARN_ON_SMP_ONCE,
VM_WARN_ON_SMP_ONCE, just test NR_CPUS != 1 in the existing VM_BUG_ONs.

Signed-off-by: Hugh Dickins <hughd@google.com>
Cc: Andrea Arcangeli <aarcange@redhat.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Hugh Dickins and committed by
Linus Torvalds
b9980cdc ec44fd42

+3 -3
+2 -2
mm/huge_memory.c
··· 2083 2083 { 2084 2084 struct mm_struct *mm = mm_slot->mm; 2085 2085 2086 - VM_BUG_ON(!spin_is_locked(&khugepaged_mm_lock)); 2086 + VM_BUG_ON(NR_CPUS != 1 && !spin_is_locked(&khugepaged_mm_lock)); 2087 2087 2088 2088 if (khugepaged_test_exit(mm)) { 2089 2089 /* free mm_slot */ ··· 2113 2113 int progress = 0; 2114 2114 2115 2115 VM_BUG_ON(!pages); 2116 - VM_BUG_ON(!spin_is_locked(&khugepaged_mm_lock)); 2116 + VM_BUG_ON(NR_CPUS != 1 && !spin_is_locked(&khugepaged_mm_lock)); 2117 2117 2118 2118 if (khugepaged_scan.mm_slot) 2119 2119 mm_slot = khugepaged_scan.mm_slot;
+1 -1
mm/swap.c
··· 659 659 VM_BUG_ON(!PageHead(page)); 660 660 VM_BUG_ON(PageCompound(page_tail)); 661 661 VM_BUG_ON(PageLRU(page_tail)); 662 - VM_BUG_ON(!spin_is_locked(&zone->lru_lock)); 662 + VM_BUG_ON(NR_CPUS != 1 && !spin_is_locked(&zone->lru_lock)); 663 663 664 664 SetPageLRU(page_tail); 665 665