Skip to content

Commit 0da2e9c

Browse files
committed
perf python: Initialize 'page_size' variable
The commit 0c1fe6b: 'perf tools: Have the page size value available for all tools' Broke the python binding because the global variable 'page_size' is initialized on the main() routine, that is not called when using just the python binding, causing evlist.mmap() to fail because it expects that variable to be initialized to the system's page size. Fix it by initializing it on the binding init routine. Reported-by: David Ahern <[email protected]> Cc: David Ahern <[email protected]> Cc: Frederic Weisbecker <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Mike Galbraith <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Paul Mackerras <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Stephane Eranian <[email protected]> Link: http://lkml.kernel.org/n/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
1 parent 0089fa9 commit 0da2e9c

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

tools/perf/util/python.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1015,6 +1015,8 @@ PyMODINIT_FUNC initperf(void)
10151015
pyrf_cpu_map__setup_types() < 0)
10161016
return;
10171017

1018+
page_size = sysconf(_SC_PAGE_SIZE);
1019+
10181020
Py_INCREF(&pyrf_evlist__type);
10191021
PyModule_AddObject(module, "evlist", (PyObject*)&pyrf_evlist__type);
10201022

0 commit comments

Comments
 (0)