Thread (20 messages) 20 messages, 3 authors, 2017-08-08

Re: [PATCH 2/2] perf record: wrong size in perf_record_mmap for last kernel module

From: Thomas-Mich Richter <hidden>
Date: 2017-08-03 09:41:10

On 08/02/2017 08:50 PM, Arnaldo Carvalho de Melo wrote:
Em Mon, Jul 24, 2017 at 03:20:07PM -0300, Arnaldo Carvalho de Melo escreveu:
quoted
Em Mon, Jul 24, 2017 at 04:35:14PM +0200, Thomas Richter escreveu:
quoted
+++ b/tools/perf/util/machine.c
@@ -20,6 +20,7 @@
+#include <sys/user.h>
no need for this header, see below.
quoted
quoted
-static int machine__create_module(void *arg, const char *name, u64 start)
+static int machine__create_module(void *arg, const char *name, u64 start, u64 size)
 {
@@ -1148,6 +1149,7 @@ static int machine__create_module(void *arg, const char *name, u64 start)
 	map = machine__findnew_module_map(machine, start, name);
 	if (map == NULL)
 		return -1;
+	map->end = roundup(start + size, PAGE_SIZE);
We have the page_size variable, that gets its value at:

tools/perf/perf.c:	page_size = sysconf(_SC_PAGE_SIZE);

always available, determined at run time.

Also, what is the reason for the roundup?
Ok I missed that page_size and will use it.
The idea for the roundup to page size is the assumption that the kernel
allocates full pages for memory to load modules. The size filed in the /proc/modules
output refers to the module size in bytes.

If this is wrong we can omit the roundup.

-- 
Thomas Richter, Dept 3303, IBM LTC Boeblingen Germany
--
Vorsitzende des Aufsichtsrats: Martina Koederitz 
Geschäftsführung: Dirk Wittkopp
Sitz der Gesellschaft: Böblingen / Registergericht: Amtsgericht Stuttgart, HRB 243294
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help