All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Verbeiren <david.verbeiren@tessares.net>
To: Andrii Nakryiko <andrii.nakryiko@gmail.com>
Cc: bpf <bpf@vger.kernel.org>, Networking <netdev@vger.kernel.org>,
	Matthieu Baerts <matthieu.baerts@tessares.net>
Subject: Re: [PATCH bpf] bpf: zero-fill re-used per-cpu map element
Date: Tue, 27 Oct 2020 15:48:28 +0100	[thread overview]
Message-ID: <CAHzPrnF0yZY8rk6_qMS55_=gLCKwHq1s7LaRtSqGy823gtwLMA@mail.gmail.com> (raw)
In-Reply-To: <CAEf4BzZaJaYw0tB0R+q3qoQX7=qy3T9jvzf5q=TH++t66wNd-w@mail.gmail.com>

On Mon, Oct 26, 2020 at 11:48 PM Andrii Nakryiko
<andrii.nakryiko@gmail.com> wrote:
>
> On Fri, Oct 23, 2020 at 8:48 AM David Verbeiren
> <david.verbeiren@tessares.net> wrote:
> > [...]
> > +                       if (!onallcpus)
> > +                               for_each_possible_cpu(cpu)
> > +                                       memset((void *)per_cpu_ptr(pptr, cpu),
> > +                                              0, size);
>
> Technically, you don't have to memset() for the current CPU, right?
> Don't know if extra check is cheaper than avoiding one memset() call,
> though.

I thought about that as well but, because it depends on the 'size',
I decided to keep it simple. However, taking into account your other
comments, I think there is a possibility to combine it all nicely in a
separate function.

> But regardless, this 6 level nesting looks pretty bad, maybe move the
> for_each_possible_cpu() loop into a helper function?
>
> Also, does the per-CPU LRU hashmap need the same treatment?
I think it does. Good catch!

Thanks for your feedback. v2 is coming.

  reply	other threads:[~2020-10-27 14:52 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-23 12:37 [PATCH bpf] bpf: zero-fill re-used per-cpu map element David Verbeiren
2020-10-26 22:47 ` Andrii Nakryiko
2020-10-27 14:48   ` David Verbeiren [this message]
2020-10-27 22:13 ` [PATCH bpf v2] " David Verbeiren
2020-10-27 22:55   ` Andrii Nakryiko
2020-10-29 14:44     ` David Verbeiren
2020-10-29 22:40       ` Andrii Nakryiko
2020-11-03 15:47   ` [PATCH bpf v3] " David Verbeiren
2020-11-03 18:19     ` Andrii Nakryiko
2020-11-04 11:23     ` [PATCH bpf v4] " David Verbeiren
2020-11-04 20:45       ` Andrii Nakryiko
2020-11-06  4:10       ` patchwork-bot+netdevbpf

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='CAHzPrnF0yZY8rk6_qMS55_=gLCKwHq1s7LaRtSqGy823gtwLMA@mail.gmail.com' \
    --to=david.verbeiren@tessares.net \
    --cc=andrii.nakryiko@gmail.com \
    --cc=bpf@vger.kernel.org \
    --cc=matthieu.baerts@tessares.net \
    --cc=netdev@vger.kernel.org \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.