perf/ring-buffer: Clarify the use of page::private for high-order AUX allocations
authorAlexander Shishkin <alexander.shishkin@linux.intel.com>
Tue, 28 Jul 2015 06:00:04 +0000 (09:00 +0300)
committerIngo Molnar <mingo@kernel.org>
Wed, 12 Aug 2015 09:43:20 +0000 (11:43 +0200)
A question [1] was raised about the use of page::private in AUX buffer
allocations, so let's add a clarification about its intended use.

The private field and flag are used by perf's rb_alloc_aux() path to
tell the pmu driver the size of each high-order allocation, so that the
driver can program those appropriately into its hardware. This only
matters for PMUs that don't support hardware scatter tables. Otherwise,
every page in the buffer is just a page.

This patch adds a comment about the private field to the AUX buffer
allocation path.

  [1] http://marc.info/?l=linux-kernel&m=143803696607968

Reported-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Arnaldo Carvalho de Melo <acme@infradead.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/1438063204-665-1-git-send-email-alexander.shishkin@linux.intel.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
kernel/events/ring_buffer.c

index c8aa3f75bc4db8ad7a2242aae6406bfd6f86f8c5..182bc30899d5b095d6e317327065eb7f8409795d 100644 (file)
@@ -437,7 +437,10 @@ static struct page *rb_alloc_aux_page(int node, int order)
 
        if (page && order) {
                /*
-                * Communicate the allocation size to the driver
+                * Communicate the allocation size to the driver:
+                * if we managed to secure a high-order allocation,
+                * set its first page's private to this order;
+                * !PagePrivate(page) means it's just a normal page.
                 */
                split_page(page, order);
                SetPagePrivate(page);