BPF List
 help / color / mirror / Atom feed
From: Kui-Feng Lee <sinquersw@gmail.com>
To: thinker.li@gmail.com, bpf@vger.kernel.org, ast@kernel.org,
	martin.lau@linux.dev, song@kernel.org, kernel-team@meta.com,
	andrii@kernel.org
Cc: kuifeng@meta.com
Subject: Re: [PATCH bpf-next v2 0/3] Allow struct_ops maps with a large number of programs
Date: Wed, 21 Feb 2024 15:02:19 -0800	[thread overview]
Message-ID: <4f02f4f5-7a28-4779-a9f9-6e16a99240e9@gmail.com> (raw)
In-Reply-To: <20240221225911.757861-1-thinker.li@gmail.com>



On 2/21/24 14:59, thinker.li@gmail.com wrote:
> From: Kui-Feng Lee <thinker.li@gmail.com>
> 
> The BPF struct_ops previously only allowed for one page to be used for
> the trampolines of all links in a map. However, we have recently run
> out of space due to the large number of BPF program links. By
> allocating additional pages when we exhaust an existing page, we can
> accommodate more links in a single map.
> 
> The variable st_map->image has been changed to st_map->image_pages,
> and its type has been changed to an array of pointers to buffers of
> PAGE_SIZE. The array is dynamically resized and additional pages are
> allocated when all existing pages are exhausted.

Sorry for not updating this part about resizing. The array is not
resized anymore. But, additional pages are allocated.

> 
> The test case loads a struct_ops maps having 40 programs. Their
> trampolines takes about 6.6k+ bytes over 1.5 pages on x86.
> 
> Kui-Feng Lee (3):
>    bpf, net: validate struct_ops when updating value.
>    bpf: struct_ops supports more than one page for trampolines.
>    selftests/bpf: Test struct_ops maps with a large number of program
>      links.
> 
>   kernel/bpf/bpf_struct_ops.c                   | 123 ++++++++++++------
>   net/ipv4/tcp_cong.c                           |   6 +-
>   .../selftests/bpf/bpf_testmod/bpf_testmod.h   |  44 +++++++
>   .../prog_tests/test_struct_ops_multi_pages.c  |  31 +++++
>   .../bpf/progs/struct_ops_multi_pages.c        | 102 +++++++++++++++
>   5 files changed, 263 insertions(+), 43 deletions(-)
>   create mode 100644 tools/testing/selftests/bpf/prog_tests/test_struct_ops_multi_pages.c
>   create mode 100644 tools/testing/selftests/bpf/progs/struct_ops_multi_pages.c
> 

      parent reply	other threads:[~2024-02-21 23:02 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-21 22:59 [PATCH bpf-next v2 0/3] Allow struct_ops maps with a large number of programs thinker.li
2024-02-21 22:59 ` [PATCH bpf-next v2 1/3] bpf, net: validate struct_ops when updating value thinker.li
2024-02-21 22:59 ` [PATCH bpf-next v2 2/3] bpf: struct_ops supports more than one page for trampolines thinker.li
2024-02-23  0:33   ` Martin KaFai Lau
2024-02-23  1:35     ` Kui-Feng Lee
2024-02-23  2:16       ` Martin KaFai Lau
2024-02-23  3:01         ` Kui-Feng Lee
2024-02-23  5:25           ` Martin KaFai Lau
2024-02-23 17:36             ` Kui-Feng Lee
2024-02-23 18:29               ` Kui-Feng Lee
2024-02-23 18:42                 ` Martin KaFai Lau
2024-02-23 19:05                   ` Kui-Feng Lee
2024-02-23 19:15                     ` Martin KaFai Lau
2024-02-23 22:06                       ` Kui-Feng Lee
2024-02-24  3:20                         ` Martin KaFai Lau
2024-02-23 18:32               ` Martin KaFai Lau
2024-02-21 22:59 ` [PATCH bpf-next v2 3/3] selftests/bpf: Test struct_ops maps with a large number of program links thinker.li
2024-02-21 23:02 ` Kui-Feng Lee [this message]

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=4f02f4f5-7a28-4779-a9f9-6e16a99240e9@gmail.com \
    --to=sinquersw@gmail.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=kernel-team@meta.com \
    --cc=kuifeng@meta.com \
    --cc=martin.lau@linux.dev \
    --cc=song@kernel.org \
    --cc=thinker.li@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