Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tcp_bpf: update the rmem scheduling for #4763

Open
wants to merge 2 commits into
base: bpf_base
Choose a base branch
from

Conversation

kernel-patches-daemon-bpf-rc[bot]
Copy link

Pull request for series with
subject: tcp_bpf: update the rmem scheduling for
version: 2
url: https://patchwork.kernel.org/project/netdevbpf/list/?series=916174

@kernel-patches-daemon-bpf-rc
Copy link
Author

Upstream branch: fac04ef
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=916174
version: 2

@kernel-patches-daemon-bpf-rc
Copy link
Author

Upstream branch: 11d5245
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=916174
version: 2

@kernel-patches-daemon-bpf-rc
Copy link
Author

Upstream branch: 978c448
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=916174
version: 2

@kernel-patches-daemon-bpf-rc
Copy link
Author

Upstream branch: cf8b876
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=916174
version: 2

@kernel-patches-daemon-bpf-rc
Copy link
Author

Upstream branch: c4441ca
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=916174
version: 2

@kernel-patches-daemon-bpf-rc
Copy link
Author

Upstream branch: 7d0d673
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=916174
version: 2

Cong Wang and others added 2 commits December 10, 2024 13:22
When bpf_tcp_ingress() is called, the skmsg is being redirected to the
ingress of the destination socket. Therefore, we should charge its
receive socket buffer, instead of sending socket buffer.

Because sk_rmem_schedule() tests pfmemalloc of skb, we need to
introduce a wrapper and call it for skmsg.

Fixes: 604326b ("bpf, sockmap: convert to generic sk_msg interface")
Signed-off-by: Cong Wang <[email protected]>
When we do sk_psock_verdict_apply->sk_psock_skb_ingress, an sk_msg will
be created out of the skb, and the rmem accounting of the sk_msg will be
handled by the skb.

For skmsgs in __SK_REDIRECT case of tcp_bpf_send_verdict, when redirecting
to the ingress of a socket, although we sk_rmem_schedule and add sk_msg to
the ingress_msg of sk_redir, we do not update sk_rmem_alloc. As a result,
except for the global memory limit, the rmem of sk_redir is nearly
unlimited. Thus, add sk_rmem_alloc related logic to limit the recv buffer.

Since the function sk_msg_recvmsg and __sk_psock_purge_ingress_msg are
used in these two paths. We use "msg->skb" to test whether the sk_msg is
skb backed up. If it's not, we shall do the memory accounting explicitly.

Fixes: 604326b ("bpf, sockmap: convert to generic sk_msg interface")
Signed-off-by: Zijian Zhang <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

0 participants