Skip to content

Commit ff7bd70

Browse files
committed
core: Allow sizing the loader hash table
For now this will only apply to the dwarf loader, for experimenting as time passes and kernels grow bigger or with more symbols. Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
1 parent 3068ff3 commit ff7bd70

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

dwarf_loader.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3042,6 +3042,21 @@ static int dwarf__load_file(struct cus *cus, struct conf_load *conf,
30423042
{
30433043
int fd, err;
30443044

3045+
if (conf->max_hashtable_bits != 0) {
3046+
if (conf->max_hashtable_bits > 31)
3047+
return -E2BIG;
3048+
3049+
max_hashtags__bits = conf->max_hashtable_bits;
3050+
}
3051+
3052+
if (conf->hashtable_bits != 0) {
3053+
if (conf->hashtable_bits > max_hashtags__bits)
3054+
return -E2BIG;
3055+
3056+
hashtags__bits = conf->hashtable_bits;
3057+
} else if (hashtags__bits > max_hashtags__bits)
3058+
return -EINVAL;
3059+
30453060
elf_version(EV_CURRENT);
30463061

30473062
fd = open(filename, O_RDONLY);

dwarves.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ struct conf_load {
5656
bool ignore_alignment_attr;
5757
bool ignore_inline_expansions;
5858
bool ignore_labels;
59+
uint8_t hashtable_bits;
60+
uint8_t max_hashtable_bits;
5961
uint16_t kabi_prefix_len;
6062
const char *kabi_prefix;
6163
struct btf *base_btf;

0 commit comments

Comments
 (0)