Skip to content

Commit

Permalink
Revert "bpf: add memlock precharge check for cgroup_local_storage"
Browse files Browse the repository at this point in the history
ANBZ: torvalds#845

This reverts commit a4fdc7a.

Signed-off-by: Qiao Ma <mqaio@linux.alibaba.com>
Acked-by: Tony Lu <tonylu@linux.alibaba.com>
  • Loading branch information
maqiao-mq authored and shiloong committed Apr 18, 2022
1 parent ba04910 commit f807751
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions kernel/bpf/local_storage.c
Original file line number Diff line number Diff line change
Expand Up @@ -192,8 +192,6 @@ static struct bpf_map *cgroup_storage_map_alloc(union bpf_attr *attr)
{
int numa_node = bpf_map_attr_numa_node(attr);
struct bpf_cgroup_storage_map *map;
u32 pages;
int ret;

if (attr->key_size != sizeof(struct bpf_cgroup_storage_key))
return ERR_PTR(-EINVAL);
Expand All @@ -212,18 +210,13 @@ static struct bpf_map *cgroup_storage_map_alloc(union bpf_attr *attr)
/* max_entries is not used and enforced to be 0 */
return ERR_PTR(-EINVAL);

pages = round_up(sizeof(struct bpf_cgroup_storage_map), PAGE_SIZE) >>
PAGE_SHIFT;
ret = bpf_map_precharge_memlock(pages);
if (ret < 0)
return ERR_PTR(ret);

map = kmalloc_node(sizeof(struct bpf_cgroup_storage_map),
__GFP_ZERO | GFP_USER, numa_node);
if (!map)
return ERR_PTR(-ENOMEM);

map->map.pages = pages;
map->map.pages = round_up(sizeof(struct bpf_cgroup_storage_map),
PAGE_SIZE) >> PAGE_SHIFT;

/* copy mandatory map attributes */
bpf_map_init_from_attr(&map->map, attr);
Expand Down

0 comments on commit f807751

Please sign in to comment.