From 559fa6e76b271b98ff641fa2a968aa2439e43c28 Mon Sep 17 00:00:00 2001 From: Jesper Juhl Date: Sat, 30 Oct 2010 21:56:26 +0200 Subject: profile: Use vzalloc() rather than vmalloc() & memset() There's no reason to memset() manually when we have vzalloc(). Signed-off-by: Jesper Juhl Cc: Arjan van de Ven Cc: William Irwin LKML-Reference: Signed-off-by: Ingo Molnar --- kernel/profile.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/kernel/profile.c b/kernel/profile.c index 66f841b..14c9f87 100644 --- a/kernel/profile.c +++ b/kernel/profile.c @@ -126,11 +126,9 @@ int __ref profile_init(void) if (prof_buffer) return 0; - prof_buffer = vmalloc(buffer_bytes); - if (prof_buffer) { - memset(prof_buffer, 0, buffer_bytes); + prof_buffer = vzalloc(buffer_bytes); + if (prof_buffer) return 0; - } free_cpumask_var(prof_cpu_mask); return -ENOMEM; -- cgit v1.1 From 0f61f3e4db71946292ef8d6d6df74b8fcf001646 Mon Sep 17 00:00:00 2001 From: Frederic Weisbecker Date: Tue, 24 May 2011 03:31:26 +0200 Subject: perf tools: Fix sample type size calculation in 32 bits archs The shift used here to count the number of bits set in the mask doesn't work above the low part for archs that are not 64 bits. Fix the constant used for the shift. This fixes a 32-bit perf top failure reported by Eric Dumazet: Can't parse sample, err = -14 Can't parse sample, err = -14 ... Reported-and-tested-by: Eric Dumazet Signed-off-by: Frederic Weisbecker Cc: Linus Torvalds Cc: Steven Rostedt Cc: Eric Dumazet Cc: Peter Zijlstra Cc: Arnaldo Carvalho de Melo Cc: Stephane Eranian --- tools/perf/util/event.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/perf/util/event.c b/tools/perf/util/event.c index 252b72a..6635fcd 100644 --- a/tools/perf/util/event.c +++ b/tools/perf/util/event.c @@ -42,7 +42,7 @@ int perf_sample_size(u64 sample_type) int i; for (i = 0; i < 64; i++) { - if (mask & (1UL << i)) + if (mask & (1ULL << i)) size++; } -- cgit v1.1