lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Fri, 25 Aug 2017 04:54:18 -0700
From:   tip-bot for Jesper Dangaard Brouer <tipbot@...or.com>
To:     linux-tip-commits@...r.kernel.org
Cc:     peterz@...radead.org, jolsa@...nel.org, brouer@...hat.com,
        tglx@...utronix.de, linux-kernel@...r.kernel.org, mingo@...nel.org,
        acme@...nel.org, torvalds@...ux-foundation.org, hpa@...or.com
Subject: [tip:perf/core] tracing, perf: Adjust code layout in
 get_recursion_context()

Commit-ID:  d0618410eced4eb092295fad10312a4545fcdfaf
Gitweb:     http://git.kernel.org/tip/d0618410eced4eb092295fad10312a4545fcdfaf
Author:     Jesper Dangaard Brouer <brouer@...hat.com>
AuthorDate: Tue, 22 Aug 2017 19:22:43 +0200
Committer:  Ingo Molnar <mingo@...nel.org>
CommitDate: Fri, 25 Aug 2017 11:04:18 +0200

tracing, perf: Adjust code layout in get_recursion_context()

In an XDP redirect applications using tracepoint xdp:xdp_redirect to
diagnose TX overrun, I noticed perf_swevent_get_recursion_context()
was consuming 2% CPU. This was reduced to 1.85% with this simple
change.

Looking at the annotated asm code, it was clear that the unlikely case
in_nmi() test was chosen (by the compiler) as the most likely
event/branch.  This small adjustment makes the compiler (GCC version
7.1.1 20170622 (Red Hat 7.1.1-3)) put in_nmi() as an unlikely branch.

Signed-off-by: Jesper Dangaard Brouer <brouer@...hat.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@...radead.org>
Cc: Arnaldo Carvalho de Melo <acme@...nel.org>
Cc: Jiri Olsa <jolsa@...nel.org>
Cc: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: Peter Zijlstra <peterz@...radead.org>
Cc: Thomas Gleixner <tglx@...utronix.de>
Link: http://lkml.kernel.org/r/150342256382.16595.986861478681783732.stgit@firesoul
Signed-off-by: Ingo Molnar <mingo@...nel.org>
---
 kernel/events/internal.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/events/internal.h b/kernel/events/internal.h
index 5377c59..843e970 100644
--- a/kernel/events/internal.h
+++ b/kernel/events/internal.h
@@ -208,7 +208,7 @@ static inline int get_recursion_context(int *recursion)
 {
 	int rctx;
 
-	if (in_nmi())
+	if (unlikely(in_nmi()))
 		rctx = 3;
 	else if (in_irq())
 		rctx = 2;

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ