History

bpf: Eliminate rlimit-based memory accounting for stackmap maps

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

Roman Gushchin committed 5 years ago

Commit 37086811 parent 0d2c4f91 file · +3 −13Browse files

Unified · Split

kernel/bpf/stackmap.c+3−13
@@ -90,7 +90,6 @@ static struct bpf_map *stack_map_alloc(union bpf_attr *attr) · 89 unmodified lines
9090 {
9191 u32 value_size = attr->value_size;
9292 struct bpf_stack_map *smap;
93− struct bpf_map_memory mem;
9493 u64 cost, n_buckets;
9594 int err;
9695
@@ -119,15 +118,9 @@ static struct bpf_map *stack_map_alloc(union bpf_attr *attr) · 22 unmodified lines
119118
120119 cost = n_buckets * sizeof(struct stack_map_bucket *) + sizeof(*smap);
121120 cost += n_buckets * (value_size + sizeof(struct stack_map_bucket));
122− err = bpf_map_charge_init(&mem, cost);
123− if (err)
124− return ERR_PTR(err);
125−
126121 smap = bpf_map_area_alloc(cost, bpf_map_attr_numa_node(attr));
127− if (!smap) {
128− bpf_map_charge_finish(&mem);
122+ if (!smap)
129123 return ERR_PTR(-ENOMEM);
130− }
131124
132125 bpf_map_init_from_attr(&smap->map, attr);
133126 smap->map.value_size = value_size;
@@ -135,20 +128,17 @@ static struct bpf_map *stack_map_alloc(union bpf_attr *attr) · 1 unmodified line
135128
136129 err = get_callchain_buffers(sysctl_perf_event_max_stack);
137130 if (err)
138− goto free_charge;
131+ goto free_smap;
139132
140133 err = prealloc_elems_and_freelist(smap);
141134 if (err)
142135 goto put_buffers;
143136
144− bpf_map_charge_move(&smap->map.memory, &mem);
145−
146137 return &smap->map;
147138
148139 put_buffers:
149140 put_callchain_buffers();
150−free_charge:
151− bpf_map_charge_finish(&mem);
141+free_smap:
152142 bpf_map_area_free(smap);
153143 return ERR_PTR(err);
154144 }

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