History

bpf: Eliminate rlimit-based memory accounting for cpumap maps

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

Roman Gushchin committed 5 years ago

Commit 711caba1 parent f0437331 file · +1 −15Browse files

Unified · Split

kernel/bpf/cpumap.c+1−15
@@ -84,8 +84,6 @@ static struct bpf_map *cpu_map_alloc(union bpf_attr *attr) · 83 unmodified lines
84 u32 value_size = attr->value_size;84 u32 value_size = attr->value_size;
85 struct bpf_cpu_map *cmap;85 struct bpf_cpu_map *cmap;
86 int err = -ENOMEM;86 int err = -ENOMEM;
87 u64 cost;
88 int ret;
89 87
90 if (!bpf_capable())88 if (!bpf_capable())
91 return ERR_PTR(-EPERM);89 return ERR_PTR(-EPERM);
@@ -109,26 +107,14 @@ static struct bpf_map *cpu_map_alloc(union bpf_attr *attr) · 17 unmodified lines
109 goto free_cmap;107 goto free_cmap;
110 }108 }
111 109
112 /* make sure page count doesn't overflow */
113 cost = (u64) cmap->map.max_entries * sizeof(struct bpf_cpu_map_entry *);
114
115 /* Notice returns -EPERM on if map size is larger than memlock limit */
116 ret = bpf_map_charge_init(&cmap->map.memory, cost);
117 if (ret) {
118 err = ret;
119 goto free_cmap;
120 }
121
122 /* Alloc array for possible remote "destination" CPUs */110 /* Alloc array for possible remote "destination" CPUs */
123 cmap->cpu_map = bpf_map_area_alloc(cmap->map.max_entries *111 cmap->cpu_map = bpf_map_area_alloc(cmap->map.max_entries *
124 sizeof(struct bpf_cpu_map_entry *),112 sizeof(struct bpf_cpu_map_entry *),
125 cmap->map.numa_node);113 cmap->map.numa_node);
126 if (!cmap->cpu_map)114 if (!cmap->cpu_map)
127 goto free_charge;115 goto free_cmap;
128 116
129 return &cmap->map;117 return &cmap->map;
130free_charge:
131 bpf_map_charge_finish(&cmap->map.memory);
132free_cmap:118free_cmap:
133 kfree(cmap);119 kfree(cmap);
134 return ERR_PTR(err);120 return ERR_PTR(err);

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