lkml.org 
[lkml]   [2020]   [Nov]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH bpf-next v5 08/34] bpf: refine memcg-based memory accounting for arraymap maps
    Date
    Include percpu arrays and auxiliary data into the memcg-based memory
    accounting.

    Signed-off-by: Roman Gushchin <guro@fb.com>
    Acked-by: Song Liu <songliubraving@fb.com>
    ---
    kernel/bpf/arraymap.c | 6 +++---
    1 file changed, 3 insertions(+), 3 deletions(-)

    diff --git a/kernel/bpf/arraymap.c b/kernel/bpf/arraymap.c
    index c6c81eceb68f..92b650123c22 100644
    --- a/kernel/bpf/arraymap.c
    +++ b/kernel/bpf/arraymap.c
    @@ -30,12 +30,12 @@ static void bpf_array_free_percpu(struct bpf_array *array)

    static int bpf_array_alloc_percpu(struct bpf_array *array)
    {
    + const gfp_t gfp = GFP_USER | __GFP_NOWARN | __GFP_ACCOUNT;
    void __percpu *ptr;
    int i;

    for (i = 0; i < array->map.max_entries; i++) {
    - ptr = __alloc_percpu_gfp(array->elem_size, 8,
    - GFP_USER | __GFP_NOWARN);
    + ptr = __alloc_percpu_gfp(array->elem_size, 8, gfp);
    if (!ptr) {
    bpf_array_free_percpu(array);
    return -ENOMEM;
    @@ -1018,7 +1018,7 @@ static struct bpf_map *prog_array_map_alloc(union bpf_attr *attr)
    struct bpf_array_aux *aux;
    struct bpf_map *map;

    - aux = kzalloc(sizeof(*aux), GFP_KERNEL);
    + aux = kzalloc(sizeof(*aux), GFP_KERNEL_ACCOUNT);
    if (!aux)
    return ERR_PTR(-ENOMEM);

    --
    2.26.2
    \
     
     \ /
      Last update: 2020-11-12 23:32    [W:4.131 / U:0.140 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site