diff options
author | Roman Gushchin <guro@fb.com> | 2019-05-30 03:03:57 +0200 |
---|---|---|
committer | Alexei Starovoitov <ast@kernel.org> | 2019-06-01 01:52:56 +0200 |
commit | 3539b96e041c06e4317082816d90ec09160aeb11 (patch) | |
tree | 7e2ccf8b5526d8f13e8c5996b3b7ef76869a3012 /kernel/bpf/hashtab.c | |
parent | bpf: add memlock precharge for socket local storage (diff) | |
download | linux-3539b96e041c06e4317082816d90ec09160aeb11.tar.xz linux-3539b96e041c06e4317082816d90ec09160aeb11.zip |
bpf: group memory related fields in struct bpf_map_memory
Group "user" and "pages" fields of bpf_map into the bpf_map_memory
structure. Later it can be extended with "memcg" and other related
information.
The main reason for a such change (beside cosmetics) is to pass
bpf_map_memory structure to charging functions before the actual
allocation of bpf_map.
Signed-off-by: Roman Gushchin <guro@fb.com>
Acked-by: Song Liu <songliubraving@fb.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'kernel/bpf/hashtab.c')
-rw-r--r-- | kernel/bpf/hashtab.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/kernel/bpf/hashtab.c b/kernel/bpf/hashtab.c index 0f2708fde5f7..15bf228d2e98 100644 --- a/kernel/bpf/hashtab.c +++ b/kernel/bpf/hashtab.c @@ -364,10 +364,10 @@ static struct bpf_map *htab_map_alloc(union bpf_attr *attr) /* make sure page count doesn't overflow */ goto free_htab; - htab->map.pages = round_up(cost, PAGE_SIZE) >> PAGE_SHIFT; + htab->map.memory.pages = round_up(cost, PAGE_SIZE) >> PAGE_SHIFT; /* if map size is larger than memlock limit, reject it early */ - err = bpf_map_precharge_memlock(htab->map.pages); + err = bpf_map_precharge_memlock(htab->map.memory.pages); if (err) goto free_htab; |