+ dump_stack-avoid-the-livelock-of-the-dump_lock.patch added to -mm tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The patch titled
     Subject: dump_stack: avoid the livelock of the dump_lock
has been added to the -mm tree.  Its filename is
     dump_stack-avoid-the-livelock-of-the-dump_lock.patch

This patch should soon appear at
    http://ozlabs.org/~akpm/mmots/broken-out/dump_stack-avoid-the-livelock-of-the-dump_lock.patch
and later at
    http://ozlabs.org/~akpm/mmotm/broken-out/dump_stack-avoid-the-livelock-of-the-dump_lock.patch

Before you just go and hit "reply", please:
   a) Consider who else should be cc'ed
   b) Prefer to cc a suitable mailing list as well
   c) Ideally: find the original patch on the mailing list and do a
      reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***

The -mm tree is included into linux-next and is updated
there every 3-4 working days

------------------------------------------------------
From: Kevin Hao <haokexin@xxxxxxxxx>
Subject: dump_stack: avoid the livelock of the dump_lock

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.

Link: http://lkml.kernel.org/r/20191030031637.6025-1-haokexin@xxxxxxxxx
Fixes: b58d977432c8 ("dump_stack: serialize the output from dump_stack()")
Signed-off-by: Kevin Hao <haokexin@xxxxxxxxx>
Suggested-by: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx>
Cc: <stable@xxxxxxxxxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
---

 lib/dump_stack.c |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

--- a/lib/dump_stack.c~dump_stack-avoid-the-livelock-of-the-dump_lock
+++ a/lib/dump_stack.c
@@ -106,7 +106,11 @@ retry:
 		was_locked = 1;
 	} else {
 		local_irq_restore(flags);
-		cpu_relax();
+		/*
+		 * Wait the lock to release before jumping to atomic_cmpxchg()
+		 * in order to mitigate the thundering herd problem.
+		 */
+		do { cpu_relax(); } while (atomic_read(&dump_lock) != -1);
 		goto retry;
 	}
 
_

Patches currently in -mm which might be from haokexin@xxxxxxxxx are

dump_stack-avoid-the-livelock-of-the-dump_lock.patch




[Index of Archives]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux