linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm: fix UP THP spin_is_locked BUGs
@ 2012-02-08  0:00 Hugh Dickins
  2012-02-08  0:12 ` Andrew Morton
  0 siblings, 1 reply; 4+ messages in thread
From: Hugh Dickins @ 2012-02-08  0:00 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Andrea Arcangeli, linux-mm

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>
---

 mm/huge_memory.c |    4 ++--
 mm/swap.c        |    2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

--- 3.3-rc2/mm/huge_memory.c	2012-01-20 08:42:35.304020840 -0800
+++ linux/mm/huge_memory.c	2012-02-07 15:37:18.581666053 -0800
@@ -2083,7 +2083,7 @@ static void collect_mm_slot(struct mm_sl
 {
 	struct mm_struct *mm = mm_slot->mm;
 
-	VM_BUG_ON(!spin_is_locked(&khugepaged_mm_lock));
+	VM_BUG_ON(NR_CPUS != 1 && !spin_is_locked(&khugepaged_mm_lock));
 
 	if (khugepaged_test_exit(mm)) {
 		/* free mm_slot */
@@ -2113,7 +2113,7 @@ static unsigned int khugepaged_scan_mm_s
 	int progress = 0;
 
 	VM_BUG_ON(!pages);
-	VM_BUG_ON(!spin_is_locked(&khugepaged_mm_lock));
+	VM_BUG_ON(NR_CPUS != 1 && !spin_is_locked(&khugepaged_mm_lock));
 
 	if (khugepaged_scan.mm_slot)
 		mm_slot = khugepaged_scan.mm_slot;
--- 3.3-rc2/mm/swap.c	2012-01-20 08:42:35.324020840 -0800
+++ linux/mm/swap.c	2012-02-07 15:37:18.581666053 -0800
@@ -659,7 +659,7 @@ void lru_add_page_tail(struct zone* zone
 	VM_BUG_ON(!PageHead(page));
 	VM_BUG_ON(PageCompound(page_tail));
 	VM_BUG_ON(PageLRU(page_tail));
-	VM_BUG_ON(!spin_is_locked(&zone->lru_lock));
+	VM_BUG_ON(NR_CPUS != 1 && !spin_is_locked(&zone->lru_lock));
 
 	SetPageLRU(page_tail);
 

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] mm: fix UP THP spin_is_locked BUGs
  2012-02-08  0:00 [PATCH] mm: fix UP THP spin_is_locked BUGs Hugh Dickins
@ 2012-02-08  0:12 ` Andrew Morton
  2012-02-08  0:33   ` Hugh Dickins
  0 siblings, 1 reply; 4+ messages in thread
From: Andrew Morton @ 2012-02-08  0:12 UTC (permalink / raw)
  To: Hugh Dickins; +Cc: Andrea Arcangeli, linux-mm

On Tue, 7 Feb 2012 16:00:46 -0800 (PST)
Hugh Dickins <hughd@google.com> wrote:

> 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>
> ---
> 
>  mm/huge_memory.c |    4 ++--
>  mm/swap.c        |    2 +-
>  2 files changed, 3 insertions(+), 3 deletions(-)
> 
> --- 3.3-rc2/mm/huge_memory.c	2012-01-20 08:42:35.304020840 -0800
> +++ linux/mm/huge_memory.c	2012-02-07 15:37:18.581666053 -0800
> @@ -2083,7 +2083,7 @@ static void collect_mm_slot(struct mm_sl
>  {
>  	struct mm_struct *mm = mm_slot->mm;
>  
> -	VM_BUG_ON(!spin_is_locked(&khugepaged_mm_lock));
> +	VM_BUG_ON(NR_CPUS != 1 && !spin_is_locked(&khugepaged_mm_lock));

We do have assert_spin_locked(), but I couldn't see any way of using it
while observing these laziness constraints ;)

Should we patch -stable too?

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] mm: fix UP THP spin_is_locked BUGs
  2012-02-08  0:12 ` Andrew Morton
@ 2012-02-08  0:33   ` Hugh Dickins
  2012-02-08  2:35     ` Andrew Morton
  0 siblings, 1 reply; 4+ messages in thread
From: Hugh Dickins @ 2012-02-08  0:33 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Andrea Arcangeli, linux-mm

On Tue, 7 Feb 2012, Andrew Morton wrote:
> On Tue, 7 Feb 2012 16:00:46 -0800 (PST)
> Hugh Dickins <hughd@google.com> wrote:
> 
> > +++ linux/mm/huge_memory.c	2012-02-07 15:37:18.581666053 -0800
> > @@ -2083,7 +2083,7 @@ static void collect_mm_slot(struct mm_sl
> >  {
> >  	struct mm_struct *mm = mm_slot->mm;
> >  
> > -	VM_BUG_ON(!spin_is_locked(&khugepaged_mm_lock));
> > +	VM_BUG_ON(NR_CPUS != 1 && !spin_is_locked(&khugepaged_mm_lock));
> 
> We do have assert_spin_locked(), but I couldn't see any way of using it
> while observing these laziness constraints ;)

;) I didn't know about assert_spin_locked().  Hmm, fs/dcache.c seems
to be using that successfully.  We could forget about the VM_ part of
it and respin the patch with assert_spin_locked().  I don't really
mind either way: but happy to let laziness win the day - I'm back
on an SMP kernel by now anyway.

> 
> Should we patch -stable too?

People seem to have survived very well without it so far, I think
it's an unusual config combination, and quickly obvious if anyone
hits it.  But I've no objection if you think it deserves -stable.

Hugh

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] mm: fix UP THP spin_is_locked BUGs
  2012-02-08  0:33   ` Hugh Dickins
@ 2012-02-08  2:35     ` Andrew Morton
  0 siblings, 0 replies; 4+ messages in thread
From: Andrew Morton @ 2012-02-08  2:35 UTC (permalink / raw)
  To: Hugh Dickins; +Cc: Andrea Arcangeli, linux-mm

On Tue, 7 Feb 2012 16:33:18 -0800 (PST) Hugh Dickins <hughd@google.com> wrote:

> > Should we patch -stable too?
> 
> People seem to have survived very well without it so far, I think
> it's an unusual config combination, and quickly obvious if anyone
> hits it.  But I've no objection if you think it deserves -stable.

We may as well, I guess.  Runtime BUG() is rather unpleasant.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-02-08  2:34 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-02-08  0:00 [PATCH] mm: fix UP THP spin_is_locked BUGs Hugh Dickins
2012-02-08  0:12 ` Andrew Morton
2012-02-08  0:33   ` Hugh Dickins
2012-02-08  2:35     ` Andrew Morton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).