Patches contributed by Eötvös Lorand University
commit f24ade3a3332811a512ed3b6c6aa69486719b1d8
Author: Ingo Molnar <mingo@elte.hu>
Date: Tue Mar 10 19:02:30 2009 +0100
x86, sched_clock(): mark variables read-mostly
Impact: micro-optimization
There's a number of variables in the sched_clock() path that are
in .data/.bss - but not marked __read_mostly. This creates the
danger of accidental false cacheline sharing with some other,
write-often variable.
So mark them __read_mostly.
Signed-off-by: Ingo Molnar <mingo@elte.hu>
diff --git a/arch/x86/kernel/tsc.c b/arch/x86/kernel/tsc.c
index 599e58168631..9c8b71531ca8 100644
--- a/arch/x86/kernel/tsc.c
+++ b/arch/x86/kernel/tsc.c
@@ -17,20 +17,21 @@
#include <asm/delay.h>
#include <asm/hypervisor.h>
-unsigned int cpu_khz; /* TSC clocks / usec, not used here */
+unsigned int __read_mostly cpu_khz; /* TSC clocks / usec, not used here */
EXPORT_SYMBOL(cpu_khz);
-unsigned int tsc_khz;
+
+unsigned int __read_mostly tsc_khz;
EXPORT_SYMBOL(tsc_khz);
/*
* TSC can be unstable due to cpufreq or due to unsynced TSCs
*/
-static int tsc_unstable;
+static int __read_mostly tsc_unstable;
/* native_sched_clock() is called before tsc_init(), so
we must start with the TSC soft disabled to prevent
erroneous rdtsc usage on !cpu_has_tsc processors */
-static int tsc_disabled = -1;
+static int __read_mostly tsc_disabled = -1;
static int tsc_clocksource_reliable;
/*
commit 2395037e5dd6841a6fa23afbb31e79d92e549cd1
Merge: bbcd3063597a 39e874f8afbd
Author: Ingo Molnar <mingo@elte.hu>
Date: Tue Mar 10 17:17:32 2009 +0100
Merge branch 'core/printk' into tracing/ftrace
commit 8c54436ae9f59146b3d02820a3ebbf71e61f2aee
Merge: 5ed0cec0ac5f 7a203f3b089b
Author: Ingo Molnar <mingo@elte.hu>
Date: Tue Mar 10 16:34:43 2009 +0100
Merge branches 'sched/cleanups' and 'linus' into sched/core
commit 8293dd6f86e759068ce918aa10ca9c5d6d711cd0
Merge: 631595fbf4ae 467c88fee51e
Author: Ingo Molnar <mingo@elte.hu>
Date: Tue Mar 10 10:16:17 2009 +0100
Merge branch 'x86/core' into tracing/ftrace
Semantic merge:
kernel/trace/trace_functions_graph.c
Signed-off-by: Ingo Molnar <mingo@elte.hu>
diff --cc kernel/trace/trace_functions_graph.c
index 453ebd3b636e,930c08e5b38e..35257be6a9d6
--- a/kernel/trace/trace_functions_graph.c
+++ b/kernel/trace/trace_functions_graph.c
@@@ -807,44 -642,18 +807,44 @@@ static void print_graph_headers(struct
/* 2nd line */
seq_printf(s, "# ");
+ if (tracer_flags.val & TRACE_GRAPH_PRINT_ABS_TIME)
+ seq_printf(s, " | ");
if (tracer_flags.val & TRACE_GRAPH_PRINT_CPU)
- seq_printf(s, "| ");
+ seq_printf(s, "| ");
if (tracer_flags.val & TRACE_GRAPH_PRINT_PROC)
- seq_printf(s, "| | ");
- if (tracer_flags.val & TRACE_GRAPH_PRINT_OVERHEAD) {
- seq_printf(s, "| ");
- seq_printf(s, "| | | | |\n");
- } else
- seq_printf(s, " | | | | |\n");
+ seq_printf(s, " | | ");
+ if (tracer_flags.val & TRACE_GRAPH_PRINT_DURATION)
+ seq_printf(s, " | | ");
+ seq_printf(s, " | | | |\n");
}
+
+static void graph_trace_open(struct trace_iterator *iter)
+{
+ /* pid on the last trace processed */
+ pid_t *last_pid = alloc_percpu(pid_t);
+ int cpu;
+
+ if (!last_pid)
+ pr_warning("function graph tracer: not enough memory\n");
+ else
+ for_each_possible_cpu(cpu) {
+ pid_t *pid = per_cpu_ptr(last_pid, cpu);
+ *pid = -1;
+ }
+
+ iter->private = last_pid;
+}
+
+static void graph_trace_close(struct trace_iterator *iter)
+{
- percpu_free(iter->private);
++ free_percpu(iter->private);
+}
+
static struct tracer graph_trace __read_mostly = {
.name = "function_graph",
+ .open = graph_trace_open,
+ .close = graph_trace_close,
+ .wait_pipe = poll_wait_pipe,
.init = graph_trace_init,
.reset = graph_trace_reset,
.print_line = print_graph_function,
commit 9a1043d19c4edc4ff1d80081a39809a506a62e4d
Merge: 12e87e36e014 157587d7ac55
Author: Ingo Molnar <mingo@elte.hu>
Date: Tue Mar 10 09:57:16 2009 +0100
Merge branch 'tip/tracing/ftrace' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-2.6-trace into tracing/ftrace
commit 12e87e36e0141c08dbc8b2177c93c75fb18ad7e5
Merge: 42b40b3d55f5 c3ffc7a40b7e 7bffc23e56e9 7a203f3b089b
Author: Ingo Molnar <mingo@elte.hu>
Date: Tue Mar 10 09:56:25 2009 +0100
Merge branches 'tracing/doc', 'tracing/ftrace', 'tracing/printk' and 'linus' into tracing/core
diff --cc include/asm-generic/vmlinux.lds.h
index 89997dfdf3d0,89997dfdf3d0,d656b4624024,c61fab1dd2f8..0e0f39be6c8b
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@@@@ -97,8 -97,8 -97,9 -81,7 +97,9 @@@@@
*(__tracepoints) \
VMLINUX_SYMBOL(__stop___tracepoints) = .; \
LIKELY_PROFILE() \
- BRANCH_PROFILE()
+ BRANCH_PROFILE() \
++ + TRACE_PRINTKS() \
+ FTRACE_EVENTS()
#define RO_DATA(align) \
. = ALIGN((align)); \
commit 467c88fee51e2ae862e9485245687da0730e29aa
Merge: 1f442d70c84a 7ab152470e84 8827247ffcc9 d1a8e7792047 0feca851c1b3 d0fc63f7bd07 7a203f3b089b 3a450de1365d
Author: Ingo Molnar <mingo@elte.hu>
Date: Tue Mar 10 09:26:38 2009 +0100
Merge branches 'x86/apic', 'x86/asm', 'x86/fixmap', 'x86/memtest', 'x86/mm', 'x86/urgent', 'linus' and 'core/percpu' into x86/core
diff --cc arch/x86/mm/ioremap.c
index 62773abdf088,62773abdf088,96786ef2c9a9,62773abdf088,62def5795730,f45d5e29a72e,f45d5e29a72e,433f7bd4648a..aca924a30ee6
--- a/arch/x86/mm/ioremap.c
+++ b/arch/x86/mm/ioremap.c
@@@@@@@@@ -85,8 -85,8 -85,8 -85,8 -85,10 -89,8 -89,8 -89,8 +85,10 @@@@@@@@@ bool __virt_addr_valid(unsigned long x
{
if (x < PAGE_OFFSET)
return false;
--- if (system_state != SYSTEM_BOOTING && is_vmalloc_addr((void *) x))
+++ if (__vmalloc_start_set && is_vmalloc_addr((void *) x))
+++ return false;
++++ +++ if (x >= FIXADDR_START)
++++ return false;
return pfn_valid((x - PAGE_OFFSET) >> PAGE_SHIFT);
}
EXPORT_SYMBOL(__virt_addr_valid);
commit 7bffc23e56e92c14b787bf4d95249a32085bfed5
Author: Ingo Molnar <mingo@elte.hu>
Date: Mon Mar 9 10:11:36 2009 +0100
tracing: optimize trace_printk()
Impact: micro-optimization
trace_printk() does this unconditionally:
trace_printk_fmt = fmt;
Where trace_printk_fmt is an entry into a global array. This is
very SMP-unfriendly.
So only write it once per bootup.
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Peter Zijlstra <peterz@infradead.org>
LKML-Reference: <1236356510-8381-5-git-send-email-fweisbec@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index 4e726b9a71ec..7742798c9208 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -454,7 +454,10 @@ do { \
do { \
static const char *trace_printk_fmt \
__attribute__((section("__trace_printk_fmt"))); \
- trace_printk_fmt = fmt; \
+ \
+ if (!trace_printk_fmt) \
+ trace_printk_fmt = fmt; \
+ \
__trace_printk_check_format(fmt, ##args); \
__trace_printk(_THIS_IP_, trace_printk_fmt, ##args); \
} while (0)
@@ -467,7 +470,10 @@ __trace_printk(unsigned long ip, const char *fmt, ...)
do { \
static const char *trace_printk_fmt \
__attribute__((section("__trace_printk_fmt"))); \
- trace_printk_fmt = fmt; \
+ \
+ if (!trace_printk_fmt) \
+ trace_printk_fmt = fmt; \
+ \
__ftrace_vprintk(_THIS_IP_, trace_printk_fmt, vargs); \
} while (0)
commit 8a20d84d09ab5d121f989cd99e4fc5f4b49f98ba
Author: Ingo Molnar <mingo@elte.hu>
Date: Mon Mar 9 10:09:06 2009 +0100
tracing: trace_printk() fix, move format array to data section
Impact: fix kernel crash when using trace_printk()
trace_printk_fmt section is defined into the readonly section.
But we do:
trace_printk_fmt = fmt;
to fill in that table of format strings - which is not read-only.
Under CONFIG_DEBUG_RODATA=y this crashes ...
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Peter Zijlstra <peterz@infradead.org>
LKML-Reference: <1236356510-8381-5-git-send-email-fweisbec@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index 48ade3168b13..d656b4624024 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -98,6 +98,7 @@
VMLINUX_SYMBOL(__stop___tracepoints) = .; \
LIKELY_PROFILE() \
BRANCH_PROFILE() \
+ TRACE_PRINTKS() \
FTRACE_EVENTS()
#define RO_DATA(align) \
@@ -108,7 +109,6 @@
*(__vermagic) /* Kernel version magic */ \
*(__markers_strings) /* Markers: strings */ \
*(__tracepoints_strings)/* Tracepoints: strings */ \
- TRACE_PRINTKS() \
} \
\
.rodata1 : AT(ADDR(.rodata1) - LOAD_OFFSET) { \
commit dba58e39ced7af63f2748d12bbb2b4ac83c72391
Merge: 9de36825b321 78ff7fae0455
Author: Ingo Molnar <mingo@elte.hu>
Date: Sun Mar 8 16:48:51 2009 +0100
Merge branches 'tracing/doc', 'tracing/ftrace', 'tracing/printk' and 'tracing/textedit' into tracing/core