lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAPhsuW70Tzw=V7+N9Y=rzKSyihtiHHv03B_=Murr+GyepUTtpA@mail.gmail.com>
Date:   Mon, 27 Jul 2020 16:58:23 -0700
From:   Song Liu <song@...nel.org>
To:     Roman Gushchin <guro@...com>
Cc:     bpf <bpf@...r.kernel.org>, Networking <netdev@...r.kernel.org>,
        Alexei Starovoitov <ast@...nel.org>,
        Daniel Borkmann <daniel@...earbox.net>,
        Kernel Team <kernel-team@...com>,
        open list <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH bpf-next v2 11/35] bpf: refine memcg-based memory
 accounting for sockmap and sockhash maps

On Mon, Jul 27, 2020 at 12:27 PM Roman Gushchin <guro@...com> wrote:
>
> Include internal metadata into the memcg-based memory accounting.
> Also include the memory allocated on updating an element.
>
> Signed-off-by: Roman Gushchin <guro@...com>

Acked-by: Song Liu <songliubraving@...com>

> ---
>  net/core/sock_map.c | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/net/core/sock_map.c b/net/core/sock_map.c
> index 119f52a99dc1..bc797adca44c 100644
> --- a/net/core/sock_map.c
> +++ b/net/core/sock_map.c
> @@ -38,7 +38,7 @@ static struct bpf_map *sock_map_alloc(union bpf_attr *attr)
>             attr->map_flags & ~SOCK_CREATE_FLAG_MASK)
>                 return ERR_PTR(-EINVAL);
>
> -       stab = kzalloc(sizeof(*stab), GFP_USER);
> +       stab = kzalloc(sizeof(*stab), GFP_USER | __GFP_ACCOUNT);
>         if (!stab)
>                 return ERR_PTR(-ENOMEM);
>
> @@ -829,7 +829,8 @@ static struct bpf_shtab_elem *sock_hash_alloc_elem(struct bpf_shtab *htab,
>                 }
>         }
>
> -       new = kmalloc_node(htab->elem_size, GFP_ATOMIC | __GFP_NOWARN,
> +       new = kmalloc_node(htab->elem_size,
> +                          GFP_ATOMIC | __GFP_NOWARN | __GFP_ACCOUNT,
>                            htab->map.numa_node);
>         if (!new) {
>                 atomic_dec(&htab->count);
> @@ -1011,7 +1012,7 @@ static struct bpf_map *sock_hash_alloc(union bpf_attr *attr)
>         if (attr->key_size > MAX_BPF_STACK)
>                 return ERR_PTR(-E2BIG);
>
> -       htab = kzalloc(sizeof(*htab), GFP_USER);
> +       htab = kzalloc(sizeof(*htab), GFP_USER | __GFP_ACCOUNT);
>         if (!htab)
>                 return ERR_PTR(-ENOMEM);
>
> --
> 2.26.2
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ