Skip to content

Commit

Permalink
perf threads: Reduce table size from 256 to 8
Browse files Browse the repository at this point in the history
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 <irogers@google.com>
Acked-by: Namhyung Kim <namhyung@kernel.org>
Cc: Yang Jihong <yangjihong1@huawei.com>
Cc: Oliver Upton <oliver.upton@linux.dev>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Link: https://lore.kernel.org/r/20240301053646.1449657-8-irogers@google.com
  • Loading branch information
Ian Rogers authored and Namhyung Kim committed Mar 4, 2024
1 parent 412a2ff commit 7bfc84b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tools/perf/util/threads.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

struct thread;

#define THREADS__TABLE_BITS 8
#define THREADS__TABLE_BITS 3
#define THREADS__TABLE_SIZE (1 << THREADS__TABLE_BITS)

struct threads_table_entry {
Expand Down

0 comments on commit 7bfc84b

Please sign in to comment.