Netdev Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Shakeel Butt <shakeelb@google.com>
To: Roman Gushchin <guro@fb.com>
Cc: bpf@vger.kernel.org, netdev <netdev@vger.kernel.org>,
	Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Kernel Team <kernel-team@fb.com>,
	LKML <linux-kernel@vger.kernel.org>,
	Johannes Weiner <hannes@cmpxchg.org>,
	Linux MM <linux-mm@kvack.org>, Song Liu <songliubraving@fb.com>
Subject: Re: [PATCH bpf-next v4 04/30] bpf: refine memcg-based memory accounting for arraymap maps
Date: Wed, 26 Aug 2020 18:19:39 -0700	[thread overview]
Message-ID: <CALvZod79Z114rHPpq7nvCJ2rkLYiV8EEH-WEMXAPB9yyAH3WEQ@mail.gmail.com> (raw)
In-Reply-To: <20200821150134.2581465-5-guro@fb.com>

On Fri, Aug 21, 2020 at 8:11 AM Roman Gushchin <guro@fb.com> wrote:
>
> 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 8ff419b632a6..9597fecff8da 100644
> --- a/kernel/bpf/arraymap.c
> +++ b/kernel/bpf/arraymap.c
> @@ -28,12 +28,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;
> @@ -969,7 +969,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);
>

There are a couple other allocations in the file. Can you please
comment why those are fine without __GFP_ACCOUNT flag. One seems to be
iterator allocation which should be temporary and fine without
__GFP_ACCOUNT but what about the ones in prog_array_map_poke_track()
and bpf_event_entry_gen()?

  parent reply	other threads:[~2020-08-27  1:19 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-21 15:01 [PATCH bpf-next v4 00/30] bpf: switch to memcg-based memory accounting Roman Gushchin
2020-08-21 15:01 ` [PATCH bpf-next v4 01/30] mm: support nesting memalloc_use_memcg() Roman Gushchin
2020-08-21 16:29   ` Shakeel Butt
2020-08-21 15:01 ` [PATCH bpf-next v4 02/30] bpf: memcg-based memory accounting for bpf progs Roman Gushchin
2020-08-25 19:00   ` Shakeel Butt
2020-08-25 22:26     ` Roman Gushchin
2020-08-21 15:01 ` [PATCH bpf-next v4 03/30] bpf: memcg-based memory accounting for bpf maps Roman Gushchin
2020-08-25 23:27   ` Shakeel Butt
2020-08-26  2:38     ` Roman Gushchin
2020-08-26  8:57   ` [bpf] 3ebc0a7f46: BUG:KASAN:use-after-free_in_b kernel test robot
2020-08-21 15:01 ` [PATCH bpf-next v4 28/30] bpf: eliminate rlimit-based memory accounting infra for bpf maps Roman Gushchin
2020-08-21 18:23   ` Alexei Starovoitov
2020-08-21 23:15     ` Roman Gushchin
2020-08-21 22:20 ` [PATCH bpf-next v4 00/30] bpf: switch to memcg-based memory accounting Roman Gushchin
     [not found] ` <20200821150134.2581465-5-guro@fb.com>
2020-08-27  1:19   ` Shakeel Butt [this message]
     [not found] ` <20200821150134.2581465-6-guro@fb.com>
2020-08-27  1:24   ` [PATCH bpf-next v4 05/30] bpf: refine memcg-based memory accounting for cpumap maps Shakeel Butt
     [not found] ` <20200821150134.2581465-7-guro@fb.com>
2020-08-27  1:25   ` [PATCH bpf-next v4 06/30] bpf: memcg-based memory accounting for cgroup storage maps Shakeel Butt
     [not found] ` <20200821150134.2581465-8-guro@fb.com>
2020-08-27  1:38   ` [PATCH bpf-next v4 07/30] bpf: refine memcg-based memory accounting for devmap maps Shakeel Butt
     [not found] ` <20200821150134.2581465-9-guro@fb.com>
2020-08-28 16:44   ` [PATCH bpf-next v4 08/30] bpf: refine memcg-based memory accounting for hashtab maps Shakeel Butt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CALvZod79Z114rHPpq7nvCJ2rkLYiV8EEH-WEMXAPB9yyAH3WEQ@mail.gmail.com \
    --to=shakeelb@google.com \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=guro@fb.com \
    --cc=hannes@cmpxchg.org \
    --cc=kernel-team@fb.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=netdev@vger.kernel.org \
    --cc=songliubraving@fb.com \
    --subject='Re: [PATCH bpf-next v4 04/30] bpf: refine memcg-based memory accounting for arraymap maps' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).