Skip to contentSkip to conversation

Scheduler refactor commits: code questions

DISCUSSION Mat Martineau 2 participants 2 messages Aug 15, 2023 Networking MPTCP

lore
Share & tools
lore

Mat Martineau

author maintainer
#0 lore raw

Hi Geliang -

I was looking at the scheduler refactor commits for upstreaming to netdev:

b3eda17b9f4e mptcp: refactor push_pending logic 8a826e0f4298 mptcp: drop last_snd and MPTCP_RESET_SCHEDULER 2f1da15cd21e mptcp: add struct mptcp_sched_ops ff4770e3fee6 mptcp: add a new sysctl scheduler 71187ddaa425 mptcp: add sched in mptcp_sock 78c8f8a71068 mptcp: add scheduled in mptcp_subflow_context 077f054fad53 mptcp: add scheduler wrappers ac4613e3e9db mptcp: use get_send wrapper 4c58a0581cff mptcp: use get_retrans wrapper 5570526ef063 mptcp: register default scheduler

and I have a couple of questions before sending these patches.

1. Do you remember why "mptcp: add struct mptcp_sched_ops" has two function pointers (data_init and get_subflow)? They take the same parameters, and are always called together. What do you think about eliminating the data_init pointer and combining all of the data_init() and get_subflow() implementations for all the schedulers? It gets rid of an indirect function call for the default scheduler, and eliminates the overhead of a BPF call for BPF schedulers.

2. After "mptcp: register default scheduler", the faster direct call code paths ("if (!msk->sched) ...") in mptcp_sched_get_send() and mptcp_sched_get_retrans() are no longer used for the default scheduler. If that condition also checked for the default scheduler, it could directly call mptcp_sched_default_get_subflow() to make a direct function call and eliminate some duplicate code:

	data.reinject = false;
	if (msk->sched == mptcp_sched_default || !msk->sched)
		return mptcp_sched_default_get_subflow(msk, &data);
	else
		return msk->sched->get_subflow(msk, &data);

Thanks,

Mat

#1 lore raw
Quoted 17 lines · Mat Martineau

Hi Geliang -

I was looking at the scheduler refactor commits for upstreaming to netdev:

b3eda17b9f4e mptcp: refactor push_pending logic 8a826e0f4298 mptcp: drop last_snd and MPTCP_RESET_SCHEDULER 2f1da15cd21e mptcp: add struct mptcp_sched_ops ff4770e3fee6 mptcp: add a new sysctl scheduler 71187ddaa425 mptcp: add sched in mptcp_sock 78c8f8a71068 mptcp: add scheduled in mptcp_subflow_context 077f054fad53 mptcp: add scheduler wrappers ac4613e3e9db mptcp: use get_send wrapper 4c58a0581cff mptcp: use get_retrans wrapper 5570526ef063 mptcp: register default scheduler

Quoted 5 lines

and I have a couple of questions before sending these patches.

1. Do you remember why "mptcp: add struct mptcp_sched_ops" has two function pointers (data_init and get_subflow)? They take the same parameters, and are

We initially used the only get_subflow interface, but later added the data_init one, resulting in two pointers because they were not added at the same time.

Quoted 5 lines

always called together. What do you think about eliminating the data_init pointer and combining all of the data_init() and get_subflow() implementations for all the schedulers? It gets rid of an indirect function call for the default scheduler, and eliminates the overhead of a BPF call for BPF schedulers.

We can drop data_init pointer, I fully agree with it.

Quoted 9 lines

2. After "mptcp: register default scheduler", the faster direct call code paths ("if (!msk->sched) ...") in mptcp_sched_get_send() and mptcp_sched_get_retrans() are no longer used for the default scheduler. If that condition also checked for the default scheduler, it could directly call mptcp_sched_default_get_subflow() to make a direct function call and eliminate some duplicate code:

Quoted 5 lines
	data.reinject = false;
	if (msk->sched == mptcp_sched_default || !msk->sched)
		return mptcp_sched_default_get_subflow(msk, &data);
	else
		return msk->sched->get_subflow(msk, &data);

I sent some squash-to patches to ML to fix all these issues this morning.

Thanks,
-Geliang

Quoted 5 lines

Thanks,

Mat