XDP-Newbies Archive mirror
 help / color / mirror / Atom feed
From: Zvi Effron <zeffron@riotgames.com>
To: Xdp <xdp-newbies@vger.kernel.org>
Subject: Pass a map to a global BPF function
Date: Mon, 13 Sep 2021 10:43:41 -0700	[thread overview]
Message-ID: <CAC1LvL0670CWq183g54w3HGsByjcBaBL2rrTP1PyTbbYfm76iw@mail.gmail.com> (raw)

Hi all,

We have some map-of-arrays that we use for tracking labeled metrics in
our XDP code. The inner map tracks the metrics for a given label,
which is the key in the outer map.

Our XDP code calls several global BPF functions (freplaced, so can't
be inlined). Currently, each global function has to make a lookup to
get the inner map to record its metrics. Now that non-context pointers
can be passed to global BPF functions, is it possible to pass maps to
these global functions?

That would allow the primary function to do the lookup once, and the
helpers would be able to skip their lookup saving considerable time.
Using this map-of-maps approach for labeled metrics has produced a
noticeable performance degradation that profiling indicates is because
of the extra lookups, which is why we're interested in reducing the
number of lookups.

Thanks!
--Zvi

             reply	other threads:[~2021-09-13 17:43 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-13 17:43 Zvi Effron [this message]
2021-09-21 20:04 ` Pass a map to a global BPF function Alexei Starovoitov

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=CAC1LvL0670CWq183g54w3HGsByjcBaBL2rrTP1PyTbbYfm76iw@mail.gmail.com \
    --to=zeffron@riotgames.com \
    --cc=xdp-newbies@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 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 read-only IMAP folder(s) and NNTP newsgroup(s).