bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Anton Protopopov <aspsk@isovalent.com>
To: bpf@vger.kernel.org
Cc: Anton Protopopov <aspsk@isovalent.com>,
	Joe Stringer <joe@isovalent.com>,
	John Fastabend <john.fastabend@gmail.com>
Subject: [PATCH bpf-next 0/2] add mechanism to report map pressure
Date: Wed, 31 May 2023 11:05:09 +0000	[thread overview]
Message-ID: <20230531110511.64612-1-aspsk@isovalent.com> (raw)

This series adds a mechanism to report "map pressure" (read as "the current
number of elements" for most maps) to userspace.

The primary reason for adding this functionality in our case (Cilium) is to get
signals about how full some heavy-used maps are and what the actual dynamic
profile of map capacity is. In the case of RCU maps this is impossible to get
this information anyhow else. See also [1].

The first patch in the series adds the api and implements the ops for all maps
in hashtab.c + for the lpm_trie.c (the maps which are of most interest for us).
See the commit description for additional details.

The second commit adds a new map selftest map_tests/map_pressure.c.

  [1] https://lpc.events/event/16/contributions/1368/

Anton Protopopov (2):
  bpf: add new map ops ->map_pressure
  selftests/bpf: test map pressure

 include/linux/bpf.h                           |   1 +
 include/uapi/linux/bpf.h                      |   2 +-
 kernel/bpf/hashtab.c                          | 118 ++++---
 kernel/bpf/lpm_trie.c                         |   8 +
 kernel/bpf/syscall.c                          |  15 +
 tools/include/uapi/linux/bpf.h                |   2 +-
 .../selftests/bpf/map_tests/map_pressure.c    | 307 ++++++++++++++++++
 7 files changed, 406 insertions(+), 47 deletions(-)
 create mode 100644 tools/testing/selftests/bpf/map_tests/map_pressure.c

-- 
2.34.1


             reply	other threads:[~2023-05-31 11:04 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-31 11:05 Anton Protopopov [this message]
2023-05-31 11:05 ` [PATCH bpf-next 1/2] bpf: add new map ops ->map_pressure Anton Protopopov
2023-05-31 18:24   ` Alexei Starovoitov
2023-06-01  7:31     ` Anton Protopopov
2023-06-01 16:39       ` Alexei Starovoitov
2023-06-01 18:18         ` Anton Protopopov
2023-06-01 18:24           ` Alexei Starovoitov
2023-06-02  0:40             ` Alexei Starovoitov
2023-06-02 14:21               ` Anton Protopopov
2023-06-02 16:23                 ` Alexei Starovoitov
2023-06-06  7:49                   ` Anton Protopopov
2023-06-24  0:00                   ` John Fastabend
2023-06-26 16:29                     ` Anton Protopopov
2023-06-28 13:17             ` Anton Protopopov
2023-06-01  0:44   ` kernel test robot
2023-06-01  7:50     ` Anton Protopopov
2023-06-13  8:23       ` Yujie Liu
2023-06-13  8:30         ` Anton Protopopov
2023-05-31 11:05 ` [PATCH bpf-next 2/2] selftests/bpf: test map pressure Anton Protopopov

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=20230531110511.64612-1-aspsk@isovalent.com \
    --to=aspsk@isovalent.com \
    --cc=bpf@vger.kernel.org \
    --cc=joe@isovalent.com \
    --cc=john.fastabend@gmail.com \
    /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 NNTP newsgroup(s).