aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorJason Baron <jbaron@akamai.com>2016-08-03 16:46:39 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2016-08-04 08:50:07 -0400
commit9049fc745300c5e2236cbfc69f5e8cadb6f1f57c (patch)
tree032e8c7503e5c8c27e7fd177579df82790528d3c /lib
parent1f69bf9c6137602cd028c96b4f8329121ec89231 (diff)
dynamic_debug: add jump label support
Although dynamic debug is often only used for debug builds, sometimes its enabled for production builds as well. Minimize its impact by using jump labels. This reduces the text section by 7000+ bytes in the kernel image below. It does increase data, but this should only be referenced when changing the direction of the branches, and hence usually not in cache. text data bss dec hex filename 8194852 4879776 925696 14000324 d5a0c4 vmlinux.pre 8187337 4960224 925696 14073257 d6bda9 vmlinux.post Link: http://lkml.kernel.org/r/d165b465e8c89bc582d973758d40be44c33f018b.1467837322.git.jbaron@akamai.com Signed-off-by: Jason Baron <jbaron@akamai.com> Cc: "David S. Miller" <davem@davemloft.net> Cc: Arnd Bergmann <arnd@arndb.de> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: Chris Metcalf <cmetcalf@mellanox.com> Cc: Heiko Carstens <heiko.carstens@de.ibm.com> Cc: Joe Perches <joe@perches.com> Cc: Martin Schwidefsky <schwidefsky@de.ibm.com> Cc: Michael Ellerman <mpe@ellerman.id.au> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'lib')
-rw-r--r--lib/dynamic_debug.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c
index fe42b6ec3f0c..da796e2dc4f5 100644
--- a/lib/dynamic_debug.c
+++ b/lib/dynamic_debug.c
@@ -188,6 +188,13 @@ static int ddebug_change(const struct ddebug_query *query,
188 newflags = (dp->flags & mask) | flags; 188 newflags = (dp->flags & mask) | flags;
189 if (newflags == dp->flags) 189 if (newflags == dp->flags)
190 continue; 190 continue;
191#ifdef HAVE_JUMP_LABEL
192 if (dp->flags & _DPRINTK_FLAGS_PRINT) {
193 if (!(flags & _DPRINTK_FLAGS_PRINT))
194 static_branch_disable(&dp->key.dd_key_true);
195 } else if (flags & _DPRINTK_FLAGS_PRINT)
196 static_branch_enable(&dp->key.dd_key_true);
197#endif
191 dp->flags = newflags; 198 dp->flags = newflags;
192 vpr_info("changed %s:%d [%s]%s =%s\n", 199 vpr_info("changed %s:%d [%s]%s =%s\n",
193 trim_prefix(dp->filename), dp->lineno, 200 trim_prefix(dp->filename), dp->lineno,