diff options
author | Hugh Dickins <hughd@google.com> | 2012-02-08 20:13:40 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-02-08 22:03:51 -0500 |
commit | b9980cdcf2524c5fe15d8cbae9c97b3ed6385563 (patch) | |
tree | 18295d2fe860bcdaae87138b44023abadfcd24d4 | |
parent | ec44fd429879f7d4f28021f1a7f9fb0b5f831aab (diff) |
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>
-rw-r--r-- | mm/huge_memory.c | 4 | ||||
-rw-r--r-- | mm/swap.c | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/mm/huge_memory.c b/mm/huge_memory.c index b3ffc21ce801..91d3efb25d15 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c | |||
@@ -2083,7 +2083,7 @@ static void collect_mm_slot(struct mm_slot *mm_slot) | |||
2083 | { | 2083 | { |
2084 | struct mm_struct *mm = mm_slot->mm; | 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 | if (khugepaged_test_exit(mm)) { | 2088 | if (khugepaged_test_exit(mm)) { |
2089 | /* free mm_slot */ | 2089 | /* free mm_slot */ |
@@ -2113,7 +2113,7 @@ static unsigned int khugepaged_scan_mm_slot(unsigned int pages, | |||
2113 | int progress = 0; | 2113 | int progress = 0; |
2114 | 2114 | ||
2115 | VM_BUG_ON(!pages); | 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 | if (khugepaged_scan.mm_slot) | 2118 | if (khugepaged_scan.mm_slot) |
2119 | mm_slot = khugepaged_scan.mm_slot; | 2119 | mm_slot = khugepaged_scan.mm_slot; |
@@ -659,7 +659,7 @@ void lru_add_page_tail(struct zone* zone, | |||
659 | VM_BUG_ON(!PageHead(page)); | 659 | VM_BUG_ON(!PageHead(page)); |
660 | VM_BUG_ON(PageCompound(page_tail)); | 660 | VM_BUG_ON(PageCompound(page_tail)); |
661 | VM_BUG_ON(PageLRU(page_tail)); | 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 | SetPageLRU(page_tail); | 664 | SetPageLRU(page_tail); |
665 | 665 | ||