netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH bpf-next/net 0/6] bpf: Allow opt-out from sk->sk_prot->memory_allocated.
@ 2025-10-07  0:07 Kuniyuki Iwashima
  2025-10-07  0:07 ` [PATCH bpf-next/net 1/6] tcp: Save lock_sock() for memcg in inet_csk_accept() Kuniyuki Iwashima
                   ` (7 more replies)
  0 siblings, 8 replies; 19+ messages in thread
From: Kuniyuki Iwashima @ 2025-10-07  0:07 UTC (permalink / raw)
  To: Alexei Starovoitov, Andrii Nakryiko, Daniel Borkmann,
	Martin KaFai Lau
  Cc: John Fastabend, Stanislav Fomichev, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Neal Cardwell, Willem de Bruijn,
	Mina Almasry, Roman Gushchin, Kuniyuki Iwashima,
	Kuniyuki Iwashima, bpf, netdev

This series allows opting out of the global per-protocol memory
accounting if socket is configured as such by sysctl or BPF prog.

This series is v11 of the series below [0], but I start as a new series
because the changes now fall in net and bpf subsystems only.

I discussed with Roman Gushchin offlist, and he suggested not mixing
two independent subsystems and it would be cleaner not to depend on
memcg.

So, sk->sk_memcg and memcg code are no longer touched, and instead we
use another hole near sk->sk_prot to store a flag for the net feature.

Overview of the series:

  patch 1 is misc cleanup
  patch 2 allows opt-out from sk->sk_prot->memory_allocated
  patch 3 introduces net.core.bypass_prot_mem
  patch 4 & 5 supports flagging sk->sk_bypass_prot_mem via bpf_setsockopt()
  patch 6 is selftest


[0]: https://lore.kernel.org/bpf/20250920000751.2091731-1-kuniyu@google.com/


Note: de7342228b73 is needed to build selftest on bpf-next/net.


Kuniyuki Iwashima (6):
  tcp: Save lock_sock() for memcg in inet_csk_accept().
  net: Allow opt-out from global protocol memory accounting.
  net: Introduce net.core.bypass_prot_mem sysctl.
  bpf: Support bpf_setsockopt() for BPF_CGROUP_INET_SOCK_CREATE.
  bpf: Introduce SK_BPF_BYPASS_PROT_MEM.
  selftest: bpf: Add test for sk->sk_bypass_prot_mem.

 Documentation/admin-guide/sysctl/net.rst      |   8 +
 include/net/netns/core.h                      |   1 +
 include/net/proto_memory.h                    |   3 +
 include/net/sock.h                            |   3 +
 include/net/tcp.h                             |   3 +
 include/uapi/linux/bpf.h                      |   2 +
 net/core/filter.c                             |  79 +++++
 net/core/sock.c                               |  37 ++-
 net/core/sysctl_net_core.c                    |   9 +
 net/ipv4/af_inet.c                            |  22 ++
 net/ipv4/inet_connection_sock.c               |  25 --
 net/ipv4/tcp.c                                |   3 +-
 net/ipv4/tcp_output.c                         |   7 +-
 net/mptcp/protocol.c                          |   7 +-
 net/tls/tls_device.c                          |   3 +-
 tools/include/uapi/linux/bpf.h                |   1 +
 .../bpf/prog_tests/sk_bypass_prot_mem.c       | 282 ++++++++++++++++++
 .../selftests/bpf/progs/sk_bypass_prot_mem.c  | 104 +++++++
 18 files changed, 561 insertions(+), 38 deletions(-)
 create mode 100644 tools/testing/selftests/bpf/prog_tests/sk_bypass_prot_mem.c
 create mode 100644 tools/testing/selftests/bpf/progs/sk_bypass_prot_mem.c

-- 
2.51.0.710.ga91ca5db03-goog


^ permalink raw reply	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2025-10-14 23:24 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-07  0:07 [PATCH bpf-next/net 0/6] bpf: Allow opt-out from sk->sk_prot->memory_allocated Kuniyuki Iwashima
2025-10-07  0:07 ` [PATCH bpf-next/net 1/6] tcp: Save lock_sock() for memcg in inet_csk_accept() Kuniyuki Iwashima
2025-10-10 14:19   ` Eric Dumazet
2025-10-07  0:07 ` [PATCH bpf-next/net 2/6] net: Allow opt-out from global protocol memory accounting Kuniyuki Iwashima
2025-10-09 23:11   ` Shakeel Butt
2025-10-10 14:23   ` Eric Dumazet
2025-10-14 23:12   ` Martin KaFai Lau
2025-10-14 23:24     ` Kuniyuki Iwashima
2025-10-07  0:07 ` [PATCH bpf-next/net 3/6] net: Introduce net.core.bypass_prot_mem sysctl Kuniyuki Iwashima
2025-10-09 23:13   ` Shakeel Butt
2025-10-10 14:24     ` Eric Dumazet
2025-10-07  0:07 ` [PATCH bpf-next/net 4/6] bpf: Support bpf_setsockopt() for BPF_CGROUP_INET_SOCK_CREATE Kuniyuki Iwashima
2025-10-07  0:07 ` [PATCH bpf-next/net 5/6] bpf: Introduce SK_BPF_BYPASS_PROT_MEM Kuniyuki Iwashima
2025-10-07  0:07 ` [PATCH bpf-next/net 6/6] selftest: bpf: Add test for sk->sk_bypass_prot_mem Kuniyuki Iwashima
2025-10-14 23:09   ` Martin KaFai Lau
2025-10-14 23:23     ` Kuniyuki Iwashima
2025-10-07  1:10 ` [PATCH bpf-next/net 0/6] bpf: Allow opt-out from sk->sk_prot->memory_allocated Roman Gushchin
2025-10-09 18:28 ` Martin KaFai Lau
2025-10-10  0:21   ` Shakeel Butt

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).