Skip to content

Commit 7bfc84b

Browse files
captain5050namhyung
authored andcommitted
perf threads: Reduce table size from 256 to 8
The threads data structure is an array of hashmaps, previously rbtrees. The two levels allows for a fixed outer array where access is guarded by rw_semaphores. Commit 91e467b ("perf machine: Use hashtable for machine threads") sized the outer table at 256 entries to avoid future scalability problems, however, this means the threads struct is sized at 30,720 bytes. As the hashmaps allow O(1) access for the common find/insert/remove operations, lower the number of entries to 8. This reduces the size overhead to 960 bytes. Signed-off-by: Ian Rogers <[email protected]> Acked-by: Namhyung Kim <[email protected]> Cc: Yang Jihong <[email protected]> Cc: Oliver Upton <[email protected]> Signed-off-by: Namhyung Kim <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 412a2ff commit 7bfc84b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

tools/perf/util/threads.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
struct thread;
99

10-
#define THREADS__TABLE_BITS 8
10+
#define THREADS__TABLE_BITS 3
1111
#define THREADS__TABLE_SIZE (1 << THREADS__TABLE_BITS)
1212

1313
struct threads_table_entry {

0 commit comments

Comments
 (0)