]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
dump_stack: avoid the livelock of the dump_lock
authorKevin Hao <haokexin@gmail.com>
Wed, 6 Nov 2019 05:16:57 +0000 (21:16 -0800)
committerStefan Bader <stefan.bader@canonical.com>
Tue, 26 Nov 2019 12:16:05 +0000 (13:16 +0100)
commit0f85211dcc4d079bd3acda8981c3416e4295caf5
tree729e81d00c183d43f5e8eb6680fe348a0523d70f
parent43bc0c0a135c7ac0878c3d83170761ce47d9b990
dump_stack: avoid the livelock of the dump_lock

BugLink: https://bugs.launchpad.net/bugs/1853519
commit 5cbf2fff3bba8d3c6a4d47c1754de1cf57e2b01f upstream.

In the current code, we use the atomic_cmpxchg() to serialize the output
of the dump_stack(), but this implementation suffers the thundering herd
problem.  We have observed such kind of livelock on a Marvell cn96xx
board(24 cpus) when heavily using the dump_stack() in a kprobe handler.
Actually we can let the competitors to wait for the releasing of the
lock before jumping to atomic_cmpxchg().  This will definitely mitigate
the thundering herd problem.  Thanks Linus for the suggestion.

[akpm@linux-foundation.org: fix comment]
Link: http://lkml.kernel.org/r/20191030031637.6025-1-haokexin@gmail.com
Fixes: b58d977432c8 ("dump_stack: serialize the output from dump_stack()")
Signed-off-by: Kevin Hao <haokexin@gmail.com>
Suggested-by: Linus Torvalds <torvalds@linux-foundation.org>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
lib/dump_stack.c