mptcp: sched: reduce size for unused data
Subsystems (2)
Matthieu Baerts (NGI0)
maintainercover mptcp: sched: reduce size for unused data
I was going to send "mptcp: sched: split get_subflow interface into two" commit, when I saw again that the "data" structure was no longer used.
Because it will be removed later, when "use bpf_iter in bpf schedulers" series will be applied, a first step is to save 64B from the stack for each scheduling operation.
The first patch can be placed after "mptcp: sched: split get_subflow interface into two", and the second one before or squashed into "mptcp:
add sched_data helpers": this commit can be dropped when "use bpf_iter in bpf schedulers" series will be applied, no need to keep it for future use. Same for the struct mptcp_sched_data.
---
Matthieu Baerts (NGI0) (2):
mptcp: sched: reduce size for unused data
Squash to "mptcp: add sched_data helpers"
---
base-commit: 98f1e7131283309b4684ce977f28c9703d16b516
change-id: 20250221-mptcp-sched-data-ptr-8740fecdbbae
Best regards,
Signature · 1 line
Matthieu Baerts (NGI0) <[email protected]>
Matthieu Baerts (NGI0)
maintainerPATCH 1/2 mptcp: sched: reduce size for unused data
Thanks for the previous commit ("mptcp: sched: split get_subflow interface into two"), the mptcp_sched_data structure is now currently unused.
This structure has been added to allow future extensions that are not ready yet. At the end, this structure will not even be used at all when mptcp_subflow bpf_iter will be supported [1].
Here is a first step to save 64 bytes on the stack for each scheduling operation. The structure is not removed yet not to break the WIP work on these extensions, but will be done when [1] will be ready and applied.
--- net/mptcp/sched.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)
net/mptcp/sched.c +9 -9
@@ -177,7 +177,7 @@ static void mptcp_sched_data_set_contexts(const struct mptcp_sock *msk,int mptcp_sched_get_send (struct mptcp_sock *msk) {struct mptcp_subflow_context *subflow; -struct mptcp_sched_data data; +struct mptcp_sched_data *data =NULL ;msk_owned_by_me (msk);
@@ -198,15 +198,15 @@ int mptcp_sched_get_send(struct mptcp_sock *msk) }if (msk->sched == &mptcp_sched_default || !msk->sched) -return mptcp_sched_default_get_send (msk, &data); -mptcp_sched_data_set_contexts (msk, &data); -return msk->sched->get_send (msk, &data); +return mptcp_sched_default_get_send (msk, data); +mptcp_sched_data_set_contexts (msk, data); +return msk->sched->get_send (msk, data); }int mptcp_sched_get_retrans (struct mptcp_sock *msk) {struct mptcp_subflow_context *subflow; -struct mptcp_sched_data data; +struct mptcp_sched_data *data =NULL ;msk_owned_by_me (msk);
@@ -220,10 +220,10 @@ int mptcp_sched_get_retrans(struct mptcp_sock *msk) }if (msk->sched == &mptcp_sched_default || !msk->sched) -return mptcp_sched_default_get_retrans (msk, &data); +return mptcp_sched_default_get_retrans (msk, data); -mptcp_sched_data_set_contexts (msk, &data); +mptcp_sched_data_set_contexts (msk, data);if (msk->sched->get_retrans) -return msk->sched->get_retrans (msk, &data); -return msk->sched->get_send (msk, &data); +return msk->sched->get_retrans (msk, data); +return msk->sched->get_send (msk, data); }
Signature · 1 line
2.47.1
Matthieu Baerts (NGI0)
maintainerPATCH 2/2 Squash to "mptcp: add sched_data helpers"
In reply to Matthieu Baerts (NGI0)"mptcp: add sched_data helpers" can be removed when "use bpf_iter in bpf schedulers" series will be applied.
Same for the mptcp_sched_data structure.
--- net/mptcp/sched.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)
net/mptcp/sched.c +9 -9
@@ -177,7 +177,7 @@ static void mptcp_sched_data_set_contexts(const struct mptcp_sock *msk,int mptcp_sched_get_send (struct mptcp_sock *msk) {struct mptcp_subflow_context *subflow; -struct mptcp_sched_data *data =NULL ; +struct mptcp_sched_data data;msk_owned_by_me (msk);
@@ -198,15 +198,15 @@ int mptcp_sched_get_send(struct mptcp_sock *msk) }if (msk->sched == &mptcp_sched_default || !msk->sched) -return mptcp_sched_default_get_send (msk, data); -mptcp_sched_data_set_contexts (msk, data); -return msk->sched->get_send (msk, data); +return mptcp_sched_default_get_send (msk, &data); +mptcp_sched_data_set_contexts (msk, &data); +return msk->sched->get_send (msk, &data); }int mptcp_sched_get_retrans (struct mptcp_sock *msk) {struct mptcp_subflow_context *subflow; -struct mptcp_sched_data *data =NULL ; +struct mptcp_sched_data data;msk_owned_by_me (msk);
@@ -220,10 +220,10 @@ int mptcp_sched_get_retrans(struct mptcp_sock *msk) }if (msk->sched == &mptcp_sched_default || !msk->sched) -return mptcp_sched_default_get_retrans (msk, data); +return mptcp_sched_default_get_retrans (msk, &data); -mptcp_sched_data_set_contexts (msk, data); +mptcp_sched_data_set_contexts (msk, &data);if (msk->sched->get_retrans) -return msk->sched->get_retrans (msk, data); -return msk->sched->get_send (msk, data); +return msk->sched->get_retrans (msk, &data); +return msk->sched->get_send (msk, &data); }
Signature · 1 line
2.47.1
Matthieu Baerts
maintainerHello,
Quoted 6 lines · On 21/02/2025 16:08, Matthieu Baerts (NGI0) wrote:
I was going to send "mptcp: sched: split
get_subflowinterface into two" commit, when I saw again that the "data" structure was no longer used.Because it will be removed later, when "use
bpf_iterin bpf schedulers" series will be applied, a first step is to save 64B from the stack for each scheduling operation.
I suggest applying this now, not to block the other patch: this small modification is trivial, and undo only in our tree.
Cheers,
Matt
Signature · 1 line
Sponsored by the NGI0 Core fund.
Matthieu Baerts
maintainerQuoted 6 lines · Matthieu Baerts
Hello,
Quoted 3 lines · On 21/02/2025 16:08, Matthieu Baerts (NGI0) wrote:
I was going to send "mptcp: sched: split
get_subflowinterface into two" commit, when I saw again that the "data" structure was no longer used.
Quoted 6 lines
Quoted 3 lines
Because it will be removed later, when "use
bpf_iterin bpf schedulers" series will be applied, a first step is to save 64B from the stack for each scheduling operation.I suggest applying this now, not to block the other patch: this small modification is trivial, and undo only in our tree.
Just did:
New patches for t/upstream:
- 70c366a0a40e: mptcp: sched: reduce size for unused data
- 46de2641147f: conflict in t/mptcp-add-sched_data-helpers-2
- f3c111c797d2: "squashed" patch 2/2 in "mptcp: add sched_data helpers"
- Results: 9afc9d6ddf8b..b5dbbb68e432 (export)
Tests are now in progress:
Cheers,
Matt
Signature · 1 line
Sponsored by the NGI0 Core fund.
Hi Matthieu,
Thank you for your modifications, that's great!
Our CI did some validations and here is its report:
- KVM Validation: normal: Success! ✅
- KVM Validation: debug: Success! ✅
- KVM Validation: btf-normal (only bpftest_all): Success! ✅
- KVM Validation: btf-debug (only bpftest_all): Success! ✅
- Task: https://github.com/multipath-tcp/mptcp_net-next/actions/runs/13459912721
Initiator: Patchew Applier
Commits: https://github.com/multipath-tcp/mptcp_net-next/commits/4f91f5c000d9
Patchwork: https://patchwork.kernel.org/project/mptcp/list/?series=936464
If there are some issues, you can reproduce them using the same environment as the one used by the CI thanks to a docker image, e.g.:
$ cd [kernel source code]
$ docker run -v "${PWD}:${PWD}:rw" -w "${PWD}" --privileged --rm -it \
--pull always mptcp/mptcp-upstream-virtme-docker:latest \
auto-normalFor more details:
https://github.com/multipath-tcp/mptcp-upstream-virtme-docker
Please note that despite all the efforts that have been already done to have a stable tests suite when executed on a public CI like here, it is possible some reported issues are not due to your modifications. Still, do not hesitate to help us improve that ;-)
Cheers,
MPTCP GH Action bot
Bot operated by Matthieu Baerts (NGI0 Core)