History

bpf: Eliminate rlimit-based memory accounting for lpm_trie maps

Do not use rlimit-based memory accounting for lpm_trie maps. It has been replaced with the memcg-based memory accounting.

Roman Gushchin committed 5 years ago

Commit cbddcb51 parent 755e5d51 file · +0 −13Browse files

Showing the changes to kernel (1 of 1 file). Show all

Unified · Split

kernel/bpf/lpm_trie.c+0−13
@@ -540,8 +540,6 @@ out: · 539 unmodified lines
540static struct bpf_map *trie_alloc(union bpf_attr *attr)540static struct bpf_map *trie_alloc(union bpf_attr *attr)
541{541{
542 struct lpm_trie *trie;542 struct lpm_trie *trie;
543 u64 cost = sizeof(*trie), cost_per_node;
544 int ret;
545 543
546 if (!bpf_capable())544 if (!bpf_capable())
547 return ERR_PTR(-EPERM);545 return ERR_PTR(-EPERM);
@@ -567,20 +565,9 @@ static struct bpf_map *trie_alloc(union bpf_attr *attr) · 19 unmodified lines
567 offsetof(struct bpf_lpm_trie_key, data);565 offsetof(struct bpf_lpm_trie_key, data);
568 trie->max_prefixlen = trie->data_size * 8;566 trie->max_prefixlen = trie->data_size * 8;
569 567
570 cost_per_node = sizeof(struct lpm_trie_node) +
571 attr->value_size + trie->data_size;
572 cost += (u64) attr->max_entries * cost_per_node;
573
574 ret = bpf_map_charge_init(&trie->map.memory, cost);
575 if (ret)
576 goto out_err;
577
578 spin_lock_init(&trie->lock);568 spin_lock_init(&trie->lock);
579 569
580 return &trie->map;570 return &trie->map;
581out_err:
582 kfree(trie);
583 return ERR_PTR(ret);
584}571}
585 572
586static void trie_free(struct bpf_map *map)573static void trie_free(struct bpf_map *map)

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t