mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] perf: fixing variable initialisation
@ 2015-07-27 22:41 Mathieu Poirier
  2015-07-28  5:48 ` Alexander Shishkin
  0 siblings, 1 reply; 2+ messages in thread
From: Mathieu Poirier @ 2015-07-27 22:41 UTC (permalink / raw)
  To: a.p.zijlstra, mingo, acme, alexander.shishkin
  Cc: linux-kernel, mathieu.poirier

Variable 'max_order' needs to be initialised to log2 of the
number of pages invariant of the no scather-gather PMU option.
Otherwise 'rb_alloc_aux_page' gets an order that is equal to
'0', which prevents the private page information to be set
properly.

Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
---
 kernel/events/ring_buffer.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/kernel/events/ring_buffer.c b/kernel/events/ring_buffer.c
index 96472824a752..bd3da7bebe9e 100644
--- a/kernel/events/ring_buffer.c
+++ b/kernel/events/ring_buffer.c
@@ -449,18 +449,18 @@ int rb_alloc_aux(struct ring_buffer *rb, struct perf_event *event,
 {
 	bool overwrite = !(flags & RING_BUFFER_WRITABLE);
 	int node = (event->cpu == -1) ? -1 : cpu_to_node(event->cpu);
-	int ret = -ENOMEM, max_order = 0;
+	int ret = -ENOMEM, max_order;
 
 	if (!has_aux(event))
 		return -ENOTSUPP;
 
-	if (event->pmu->capabilities & PERF_PMU_CAP_AUX_NO_SG) {
-		/*
-		 * We need to start with the max_order that fits in nr_pages,
-		 * not the other way around, hence ilog2() and not get_order.
-		 */
-		max_order = ilog2(nr_pages);
+	/*
+	 * We need to start with the max_order that fits in nr_pages,
+	 * not the other way around, hence ilog2() and not get_order.
+	 */
+	max_order = ilog2(nr_pages);
 
+	if (event->pmu->capabilities & PERF_PMU_CAP_AUX_NO_SG) {
 		/*
 		 * PMU requests more than one contiguous chunks of memory
 		 * for SW double buffering
-- 
1.9.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-07-28  5:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-27 22:41 [PATCH] perf: fixing variable initialisation Mathieu Poirier
2015-07-28  5:48 ` Alexander Shishkin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®