<div dir="ltr"><div class="gmail_default" style>Oh well yes, this doesnt quite work on !SMP.</div><div class="gmail_default" style><br></div><div class="gmail_default" style>And this kind of bug is frequent....</div><div class="gmail_default" style>
<br></div><div class="gmail_default" style>See following example :</div><div class="gmail_default" style><br></div><div class="gmail_default" style><div class="gmail_default">commit b9980cdcf2524c5fe15d8cbae9c97b3ed6385563</div>
<div class="gmail_default">Author: Hugh Dickins <<a href="mailto:hughd@google.com">hughd@google.com</a>></div><div class="gmail_default">Date: Wed Feb 8 17:13:40 2012 -0800</div><div class="gmail_default"><br></div>
<div class="gmail_default"> mm: fix UP THP spin_is_locked BUGs</div><div class="gmail_default"> </div><div class="gmail_default"> Fix CONFIG_TRANSPARENT_HUGEPAGE=y CONFIG_SMP=n CONFIG_DEBUG_VM=y</div><div class="gmail_default">
CONFIG_DEBUG_SPINLOCK=n kernel: spin_is_locked() is then always false,</div><div class="gmail_default"> and so triggers some BUGs in Transparent HugePage codepaths.</div><div class="gmail_default"> </div><div class="gmail_default">
asm-generic/bug.h mentions this problem, and provides a WARN_ON_SMP(x);</div><div class="gmail_default"> but being too lazy to add VM_BUG_ON_SMP, BUG_ON_SMP, WARN_ON_SMP_ONCE,</div><div class="gmail_default"> VM_WARN_ON_SMP_ONCE, just test NR_CPUS != 1 in the existing VM_BUG_ONs.</div>
<div class="gmail_default"> </div><div class="gmail_default"> Signed-off-by: Hugh Dickins <<a href="mailto:hughd@google.com">hughd@google.com</a>></div><div class="gmail_default"> Cc: Andrea Arcangeli <<a href="mailto:aarcange@redhat.com">aarcange@redhat.com</a>></div>
<div class="gmail_default"> Cc: <<a href="mailto:stable@vger.kernel.org">stable@vger.kernel.org</a>></div><div class="gmail_default"> Signed-off-by: Andrew Morton <<a href="mailto:akpm@linux-foundation.org">akpm@linux-foundation.org</a>></div>
<div class="gmail_default"> Signed-off-by: Linus Torvalds <<a href="mailto:torvalds@linux-foundation.org">torvalds@linux-foundation.org</a>></div><div class="gmail_default"><br></div><div class="gmail_default">diff --git a/mm/huge_memory.c b/mm/huge_memory.c</div>
<div class="gmail_default">index b3ffc21..91d3efb 100644</div><div class="gmail_default">--- a/mm/huge_memory.c</div><div class="gmail_default">+++ b/mm/huge_memory.c</div><div class="gmail_default">@@ -2083,7 +2083,7 @@ static void collect_mm_slot(struct mm_slot *mm_slot)</div>
<div class="gmail_default"> {</div><div class="gmail_default"> struct mm_struct *mm = mm_slot->mm;</div><div class="gmail_default"> </div><div class="gmail_default">- VM_BUG_ON(!spin_is_locked(&khugepaged_mm_lock));</div>
<div class="gmail_default">+ VM_BUG_ON(NR_CPUS != 1 && !spin_is_locked(&khugepaged_mm_lock));</div><div><br></div></div><div class="gmail_default" style><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">
On Sun, Jan 13, 2013 at 1:39 PM, Felix Fietkau <span dir="ltr"><<a href="mailto:nbd@openwrt.org" target="_blank">nbd@openwrt.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">On 2013-01-13 7:03 PM, Eric Dumazet wrote:<br>
> I suspect a bug in the spin_is_locked() implementation on your arch, as<br>
> he socket lock should be held at this point.<br>
</div>I don't think this is an arch implementation bug, this probably happens<br>
on all !SMP systems. See this bit from include/linux/spinlock_up.h:<br>
<br>
#define arch_spin_is_locked(lock) ((void)(lock), 0)<br>
<span class="HOEnZb"><font color="#888888"><br>
- Felix<br>
<br>
</font></span></blockquote></div><br></div>