mptcp: pm: userspace: avoid scheduling in-kernel PM worker
Subsystems (2)
Matthieu Baerts (NGI0)
maintainerPATCH 1/1 mptcp: pm: userspace: avoid scheduling in-kernel PM worker
When the userspace PM is used, there is no need to schedule the PM worker for in-kernel specific tasks, e.g. creating new subflows, or sending more ADD_ADDR.
Now, these tasks will be done only if the in-kernel PM is being used.
---
Notes:
- I don't know if this should be seen as a fix. Maybe yes because it was not supposed to do that from the beginning, and it feels less risky not to schedule the worker when it is not needed. I'm open to suggestions here.
- I'm mainly sharing this patch now because Geliang is going to modify these helpers to separate PM specific code.
@Geliang: please rebase your series on top of this one (or include this patch if it is easier).
Cc: Geliang Tang <[email protected]>
--- net/mptcp/pm.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
net/mptcp/pm.c +8 -2
@@ -138,7 +138,7 @@ void mptcp_pm_fully_established(struct mptcp_sock *msk, const struct sock *ssk)* racing paths - accept() and check_fully_established() * be sure to serve this event only once. */ -if (READ_ONCE (pm->work_pending) && +if (mptcp_pm_is_kernel (msk) &&READ_ONCE (pm->work_pending) && !(msk->pm.status &BIT (MPTCP_PM_ALREADY_ESTABLISHED )))mptcp_pm_schedule_work (msk,MPTCP_PM_ESTABLISHED );
@@ -166,7 +166,7 @@ void mptcp_pm_subflow_established(struct mptcp_sock *msk)pr_debug ("msk=%p\n" , msk); -if (!READ_ONCE (pm->work_pending)) +if (!mptcp_pm_is_kernel (msk) || !READ_ONCE (pm->work_pending))return ;spin_lock_bh (&pm->lock);
@@ -251,6 +251,9 @@ void mptcp_pm_add_addr_echoed(struct mptcp_sock *msk,pr_debug ("msk=%p\n" , msk); +if (!mptcp_pm_is_kernel (msk) || !READ_ONCE (pm->work_pending)) +return ; +spin_lock_bh (&pm->lock);if (mptcp_lookup_anno_list_by_saddr (msk, addr) &&READ_ONCE (pm->work_pending))
@@ -278,6 +281,9 @@ void mptcp_pm_rm_addr_received(struct mptcp_sock *msk,for (i =0 ; i < rm_list->nr; i++)mptcp_event_addr_removed (msk, rm_list->ids[i]); +if (!mptcp_pm_is_kernel (msk)) +return ; +spin_lock_bh (&pm->lock);if (mptcp_pm_schedule_work (msk,MPTCP_PM_RM_ADDR_RECEIVED )) pm->rm_list_rx = *rm_list;
---
base-commit: 3716d837622ee1baf6fbe7e6a6a7a3df116e75fe
change-id: 20250224-mptcp-userspace-avoid-worker-93f367e39ca6
Best regards,
Signature · 1 line
Matthieu Baerts (NGI0) <[email protected]>
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/13505941194
Initiator: Patchew Applier
Commits: https://github.com/multipath-tcp/mptcp_net-next/commits/c3c9a58d9080
Patchwork: https://patchwork.kernel.org/project/mptcp/list/?series=937225
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)
Geliang Tang
reviewerHi Matt,
Quoted 37 lines · On Mon, 2025-02-24 at 20:01 +0100, Matthieu Baerts (NGI0) wrote:
When the userspace PM is used, there is no need to schedule the PM worker for in-kernel specific tasks, e.g. creating new subflows, or sending more
ADD_ADDR.Now, these tasks will be done only if the in-kernel PM is being used.
Signed-off-by Matthieu Baerts (NGI0) <[email protected]>---
Notes:
- I don't know if this should be seen as a fix. Maybe yes because it was not supposed to do that from the beginning, and it feels less risky not to schedule the worker when it is not needed. I'm open to
suggestions here.
- I'm mainly sharing this patch now because Geliang is going to modify
these helpers to separate PM specific code.
@Geliang: please rebase your series on top of this one (or include this patch if it is easier).
Cc: Geliang Tang <[email protected]>
---
net/mptcp/pm.c | 10 ++++++++--1 file changed, 8 insertions(+), 2 deletions(-)net/mptcp/pm.c +0
-0index
16cacce6c10fe86467aa7ef8e588f9f535b586fb..4eabb83328905676759768fb44c859f5682721e3100644net/mptcp/pm.c +1
-1@@ -138,7 +138,7 @@ void mptcp_pm_fully_established(struct mptcp_sock*msk, const struct sock *ssk) * racing paths - accept() and check_fully_established() * be sure to serve this event only once. */ - if (READ_ONCE(pm->work_pending) && + if (mptcp_pm_is_kernel(msk) && READ_ONCE(pm->work_pending)
Quoted 1 line
&&
I think there's no need to modify this. work_pending is set to 0 by userspace pm, for all cases where work_pending is 1, the path manager must be an in-kernel pm.
So there is no need to add mptcp_pm_is_kernel() check here. Just checking work_pending is sufficient.
Quoted 11 lines
!(msk->pm.status &
BIT(MPTCP_PM_ALREADY_ESTABLISHED)))mptcp_pm_schedule_work(msk, MPTCP_PM_ESTABLISHED);net/mptcp/pm.c +0
-0@@ -166,7 +166,7 @@ void mptcp_pm_subflow_established(struct mptcp_sock *msk)
pr_debug("msk=%p\n", msk);net/mptcp/pm.c +1
-1-if (!READ_ONCE (pm->work_pending)) + if (!mptcp_pm_is_kernel(msk) || !READ_ONCE(pm-Quoted 1 line
work_pending))
Quoted 1 line
return;
No need to modify this too, work_pending has been checked later in mptcp_pm_subflow_established:
if (READ_ONCE(pm->work_pending))
mptcp_pm_schedule_work(msk, MPTCP_PM_SUBFLOW_ESTABLISHED);net/mptcp/pm.c
Quoted 11 lines
spin_lock_bh(&pm->lock);net/mptcp/pm.c +0
-0@@ -251,6 +251,9 @@ void mptcp_pm_add_addr_echoed(struct mptcp_sock *msk,
pr_debug("msk=%p\n", msk);net/mptcp/pm.c +1
-0+ if (!mptcp_pm_is_kernel(msk) || !READ_ONCE(pm-Quoted 1 line
work_pending))net/mptcp/pm.c +2
-0+return ; +
Same here, work_pending has been checked later inmptcp_pm_add_addr_echoed:
if (mptcp_lookup_anno_list_by_saddr(msk, addr) && READ_ONCE(pm-
Quoted 1 line
work_pending))
mptcp_pm_schedule_work(msk, MPTCP_PM_SUBFLOW_ESTABLISHED);
net/mptcp/pm.c void mptcp_pm_rm_addr_received(struct mptcp_sock *msk, · line 285
Quoted 11 lines
spin_lock_bh(&pm->lock);
if (mptcp_lookup_anno_list_by_saddr(msk, addr)&&READ_ONCE(pm->work_pending))net/mptcp/pm.c +0
-0@@ -278,6 +281,9 @@ void mptcp_pm_rm_addr_received(struct mptcp_sock *msk, for (i = 0; i < rm_list->nr; i++) mptcp_event_addr_removed(msk, rm_list->ids[i]);net/mptcp/pm.c +2
-0+if (!mptcp_pm_is_kernel (msk)) +return ;
This mptcp_pm_is_kernel() is indeed needed.
WDYT?
Thanks,
-Geliang
Quoted 10 lines
+
spin_lock_bh(&pm->lock);
if (mptcp_pm_schedule_work(msk, MPTCP_PM_RM_ADDR_RECEIVED))pm->rm_list_rx=*rm_list;---
base-commit:3716d837622ee1baf6fbe7e6a6a7a3df116e75fe
change-id: 20250224-mptcp-userspace-avoid-worker-93f367e39ca6Best regards,
Matthieu Baerts
maintainerHi Geliang,
Thank you for your review!
Quoted 37 lines · Geliang Tang
Hi Matt,
Quoted 34 lines · On Mon, 2025-02-24 at 20:01 +0100, Matthieu Baerts (NGI0) wrote:
When the userspace PM is used, there is no need to schedule the PM worker for in-kernel specific tasks, e.g. creating new subflows, or sending more
ADD_ADDR.Now, these tasks will be done only if the in-kernel PM is being used.
Signed-off-by Matthieu Baerts (NGI0) <[email protected]>---
Notes:
- I don't know if this should be seen as a fix. Maybe yes because it was not supposed to do that from the beginning, and it feels less risky not to schedule the worker when it is not needed. I'm open to
suggestions here.
- I'm mainly sharing this patch now because Geliang is going to modify
these helpers to separate PM specific code.
@Geliang: please rebase your series on top of this one (or include this patch if it is easier).
Cc: Geliang Tang <[email protected]>
---
net/mptcp/pm.c | 10 ++++++++--1 file changed, 8 insertions(+), 2 deletions(-)net/mptcp/pm.c +0
-0index
16cacce6c10fe86467aa7ef8e588f9f535b586fb..4eabb83328905676759768fb44c859f5682721e3100644net/mptcp/pm.c +0
-0@@ -138,7 +138,7 @@ void mptcp_pm_fully_established(struct mptcp_sock *msk, const struct sock *ssk) * racing paths - accept() and check_fully_established() * be sure to serve this event only once.
Quoted 8 lines
Quoted 4 lines
net/mptcp/pm.c +1
-1*/ - if (READ_ONCE(pm->work_pending) && + if (mptcp_pm_is_kernel(msk) && READ_ONCE(pm->work_pending)&&
I think there's no need to modify this.
work_pendingis set to 0 by userspace pm, for all cases wherework_pendingis 1, the path manager must be an in-kernel pm.
Good point, I missed that!
'pm->work_pending' doesn't look like a good name for what it does. Hopefully, this will be clearer when pm->ops will be used, which will clearly separate what is done by the different PMs.
Also, is it possible we never set 'pm->work_pending' back to 'true' once it has been set to 'false'? Does it mean when we reach the limits, and something happens (e.g. a removed subflow, limits are changed, etc.), the worker is no longer used to establish new subflows or react when an ADD_ADDR is received?
Quoted 2 lines
So there is no need to add
mptcp_pm_is_kernel()check here. Just checkingwork_pendingis sufficient.
Indeed.
Quoted 10 lines
Quoted 10 lines
!(msk->pm.status &
BIT(MPTCP_PM_ALREADY_ESTABLISHED)))mptcp_pm_schedule_work(msk, MPTCP_PM_ESTABLISHED);net/mptcp/pm.c +0
-0@@ -166,7 +166,7 @@ void mptcp_pm_subflow_established(struct mptcp_sock *msk)
pr_debug("msk=%p\n", msk);net/mptcp/pm.c +1
-1-if (!READ_ONCE (pm->work_pending)) + if (!mptcp_pm_is_kernel(msk) || !READ_ONCE(pm-
Quoted 8 lines
Quoted 2 lines
Quoted 1 line
work_pending))return;
No need to modify this too,
work_pendinghas been checked later inmptcp_pm_subflow_established:if (READ_ONCE(pm->work_pending)) mptcp_pm_schedule_work(msk, MPTCP_PM_SUBFLOW_ESTABLISHED);
Indeed.
Quoted 15 lines
net/mptcp/pm.c
Quoted 11 lines
spin_lock_bh(&pm->lock);net/mptcp/pm.c +0
-0@@ -251,6 +251,9 @@ void mptcp_pm_add_addr_echoed(struct mptcp_sock *msk,
pr_debug("msk=%p\n", msk);net/mptcp/pm.c +1
-0+ if (!mptcp_pm_is_kernel(msk) || !READ_ONCE(pm-Quoted 1 line
work_pending))net/mptcp/pm.c +2
-0+return ; +Same here,
work_pendinghas been checked later inmptcp_pm_add_addr_echoed:
Quoted 3 lines
if (
mptcp_lookup_anno_list_by_saddr(msk, addr)&& READ_ONCE(pm-Quoted 1 line
work_pending))mptcp_pm_schedule_work(msk, MPTCP_PM_SUBFLOW_ESTABLISHED);
Indeed.
Quoted 5 lines
Quoted 5 lines
spin_lock_bh(&pm->lock);
if (mptcp_lookup_anno_list_by_saddr(msk, addr)&&READ_ONCE(pm->work_pending))net/mptcp/pm.c +0
-0@@ -278,6 +281,9 @@ void mptcp_pm_rm_addr_received(struct mptcp_sock
Quoted 8 lines
net/mptcp/pm.c void mptcp_pm_rm_addr_received(struct mptcp_sock *msk, · line 285
Quoted 6 lines
net/mptcp/pm.c +0
-0*msk, for (i = 0; i < rm_list->nr; i++) mptcp_event_addr_removed(msk, rm_list->ids[i]);net/mptcp/pm.c +2
-0+if (!mptcp_pm_is_kernel (msk)) +return ;This
mptcp_pm_is_kernel()is indeed needed.
Yes it is. And 'pm->work_pending' cannot be used, because it will be set to false when the limits are reached, but a RM_ADDR will potentially decrement counters.
I will send a v2 with only this change.
Cheers,
Matt
Signature · 1 line
Sponsored by the NGI0 Core fund.
Matthieu Baerts
maintainerHi Geliang,
Quoted 57 lines · Matthieu Baerts
Hi Geliang,
Thank you for your review!
Quoted 37 lines · Geliang Tang
Hi Matt,
Quoted 34 lines · On Mon, 2025-02-24 at 20:01 +0100, Matthieu Baerts (NGI0) wrote:
When the userspace PM is used, there is no need to schedule the PM worker for in-kernel specific tasks, e.g. creating new subflows, or sending more
ADD_ADDR.Now, these tasks will be done only if the in-kernel PM is being used.
Signed-off-by Matthieu Baerts (NGI0) <[email protected]>---
Notes:
- I don't know if this should be seen as a fix. Maybe yes because it was not supposed to do that from the beginning, and it feels less risky not to schedule the worker when it is not needed. I'm open to
suggestions here.
- I'm mainly sharing this patch now because Geliang is going to modify
these helpers to separate PM specific code.
@Geliang: please rebase your series on top of this one (or include this patch if it is easier).
Cc: Geliang Tang <[email protected]>
---
net/mptcp/pm.c | 10 ++++++++--1 file changed, 8 insertions(+), 2 deletions(-)net/mptcp/pm.c +0
-0index
16cacce6c10fe86467aa7ef8e588f9f535b586fb..4eabb83328905676759768fb44c859f5682721e3100644net/mptcp/pm.c +0
-0@@ -138,7 +138,7 @@ void mptcp_pm_fully_established(struct mptcp_sock *msk, const struct sock *ssk) * racing paths - accept() and check_fully_established() * be sure to serve this event only once.Quoted 8 lines
Quoted 4 lines
net/mptcp/pm.c +1
-1*/ - if (READ_ONCE(pm->work_pending) && + if (mptcp_pm_is_kernel(msk) && READ_ONCE(pm->work_pending)&&
I think there's no need to modify this.
work_pendingis set to 0 by userspace pm, for all cases wherework_pendingis 1, the path manager must be an in-kernel pm.Good point, I missed that!
'
pm->work_pending' doesn't look like a good name for what it does. Hopefully, this will be clearer whenpm->opswill be used, which will clearly separate what is done by the different PMs.
Quoted 5 lines
Also, is it possible we never set '
pm->work_pending' back to 'true' once it has been set to 'false'? Does it mean when we reach the limits, and something happens (e.g. a removed subflow, limits are changed, etc.), the worker is no longer used to establish new subflows or react when anADD_ADDRis received?
I didn't check, but it feels like we should add something like that:
Quoted 14 lines
net/mptcp/pm_netlink.c +2
-0@@ -248,6 +248,8 @@ bool mptcp_pm_nl_check_work_pending(struct mptcp_sock *msk)WRITE_ONCE (msk->pm.work_pending, false);return false; } + +WRITE_ONCE (msk->pm.work_pending, true);return true; }
net/mptcp/pm_netlink.c static void mptcp_pm_nl_rm_addr_or_subflow(struct mptcp_sock *msk, · line 921
Quoted 9 lines
net/mptcp/pm_netlink.c +3
-0@@ -911,6 +913,9 @@ static void mptcp_pm_nl_rm_addr_or_subflow(struct mptcp_sock *msk,WRITE_ONCE (msk->pm.accept_addr, true); } } + +if (mptcp_pm_is_kernel (msk)) +mptcp_pm_nl_check_work_pending (msk); }static void mptcp_pm_nl_rm_addr_received (struct mptcp_sock *msk)
So to re-enable msk->pm.work_pending when limits have been reached, and it is no longer the case. WDYT?
We would need a new subtest to confirm this patch is needed, and to avoid regressions later.
(...)
Quoted 10 lines
Quoted 9 lines
net/mptcp/pm.c void mptcp_pm_rm_addr_received(struct mptcp_sock *msk, · line 285
Quoted 7 lines
net/mptcp/pm.c +0
-0@@ -278,6 +281,9 @@ void mptcp_pm_rm_addr_received(struct mptcp_sock *msk, for (i = 0; i < rm_list->nr; i++) mptcp_event_addr_removed(msk, rm_list->ids[i]);net/mptcp/pm.c +2
-0+if (!mptcp_pm_is_kernel (msk)) +return ;This
mptcp_pm_is_kernel()is indeed needed.
Quoted 3 lines
Yes it is. And '
pm->work_pending' cannot be used, because it will be set to false when the limits are reached, but aRM_ADDRwill potentially decrement counters.
In fact, it is not needed: from what I see, the corresponding subflows are removed on the kernel side, the userspace daemon doesn't need to send a request to remove them. See the modification from 4d25247d3ae4 ("mptcp: bypass in-kernel PM restrictions for non-kernel PMs") in mptcp_pm_nl_rm_addr_or_subflow().
Quoted 1 line
I will send a v2 with only this change.
I will send a v2 with only an early exit in mptcp_pm_add_addr_echoed() if there is no need to schedule the worker.
Cheers,
Matt
Signature · 1 line
Sponsored by the NGI0 Core fund.
Geliang Tang
reviewerHi Matt,
Quoted 85 lines · Matthieu Baerts
Hi Geliang,
Quoted 72 lines · Matthieu Baerts
Hi Geliang,
Thank you for your review!
Quoted 51 lines · Geliang Tang
Hi Matt,
Quoted 48 lines · On Mon, 2025-02-24 at 20:01 +0100, Matthieu Baerts (NGI0) wrote:
When the userspace PM is used, there is no need to schedule the PM
worker for in-kernel specific tasks, e.g. creating new subflows, or
sending moreADD_ADDR.Now, these tasks will be done only if the in-kernel PM is being used.
Signed-off-by Matthieu Baerts (NGI0) <[email protected]>---
Notes:
- I don't know if this should be seen as a fix. Maybe yes because it
was not supposed to do that from the beginning, and it feels less
risky not to schedule the worker when it is not needed. I'm open
to
suggestions here.
- I'm mainly sharing this patch now because Geliang is going to
modify
these helpers to separate PM specific code. @Geliang: please rebase your series on top of this one (or include
this patch if it is easier).
Cc: Geliang Tang <[email protected]>
---
net/mptcp/pm.c | 10 ++++++++--1 file changed, 8 insertions(+), 2 deletions(-)net/mptcp/pm.c +0
-0index
16cacce6c10fe86467aa7ef8e588f9f535b586fb..4eabb83328905676759768fb44c859f5682721e3100644net/mptcp/pm.c +0
-0@@ -138,7 +138,7 @@ void mptcp_pm_fully_established(struct
mptcp_sock
*msk, const struct sock *ssk)
* racing paths -accept()andcheck_fully_established()
* be sure to serve this event only once.
*/net/mptcp/pm.c +1
-1- if (READ_ONCE(pm->work_pending) && + if (mptcp_pm_is_kernel(msk) && READ_ONCE(pm-Quoted 8 lines
Quoted 2 lines
Quoted 1 line
work_pending)&&
I think there's no need to modify this.
work_pendingis set to 0 by
userspace pm, for all cases wherework_pendingis 1, the path manager
must be an in-kernel pm.Good point, I missed that!
'
pm->work_pending' doesn't look like a good name for what it does. Hopefully, this will be clearer whenpm->opswill be used, which will
clearly separate what is done by the different PMs.Quoted 9 lines
Also, is it possible we never set '
pm->work_pending' back to 'true' once
it has been set to 'false'? Does it mean when we reach the limits, and
something happens (e.g. a removed subflow, limits are changed, etc.),
the worker is no longer used to establish new subflows or react when anADD_ADDRis received?
Quoted 1 line
I didn't check, but it feels like we should add something like that:
Yes, it is. We only set 'work_pending' to 'false' in mptcp_pm_nl_check_work_pending() but never set it back.
I'll try to fix this later. Please add an issue for it on github.
Quoted 33 lines
Quoted 25 lines
net/mptcp/pm_netlink.c +2
-0@@ -248,6 +248,8 @@ bool mptcp_pm_nl_check_work_pending(struct mptcp_sock *msk) WRITE_ONCE(msk->pm.work_pending, false); return false; } + + WRITE_ONCE(msk->pm.work_pending, true); return true; }net/mptcp/pm_netlink.c +3
-0@@ -911,6 +913,9 @@ static void mptcp_pm_nl_rm_addr_or_subflow(struct mptcp_sock *msk, WRITE_ONCE(msk->pm.accept_addr, true); } } + + if (mptcp_pm_is_kernel(msk)) + mptcp_pm_nl_check_work_pending(msk); }Quoted 2 lines
static voidmptcp_pm_nl_rm_addr_received(struct mptcp_sock *msk)So to re-enable
msk->pm.work_pendingwhen limits have been reached, and
it is no longer the case. WDYT?
Quoted 2 lines
We would need a new subtest to confirm this patch is needed, and to avoid regressions later.
And add a selftest for this too.
Quoted 28 lines
(...)
Quoted 12 lines
Quoted 11 lines
net/mptcp/pm.c void mptcp_pm_rm_addr_received(struct mptcp_sock *msk, · line 285
Quoted 9 lines
net/mptcp/pm.c +0
-0@@ -278,6 +281,9 @@ void mptcp_pm_rm_addr_received(struct
mptcp_sock
*msk,
for (i = 0; i <rm_list->nr; i++) mptcp_event_addr_removed(msk, rm_list-Quoted 1 line
ids[i]);
net/mptcp/pm.c +2
-0+if (!mptcp_pm_is_kernel (msk)) +return ;This
mptcp_pm_is_kernel()is indeed needed.Quoted 5 lines
Yes it is. And '
pm->work_pending' cannot be used, because it will be set
to false when the limits are reached, but aRM_ADDRwill potentially
decrement counters.In fact, it is not needed: from what I see, the corresponding subflows
are removed on the kernel side, the userspace daemon doesn't need to send a request to remove them. See the modification from4d25247d3ae4("mptcp: bypass in-kernel PM restrictions for non-kernel PMs") inmptcp_pm_nl_rm_addr_or_subflow().
Quoted 4 lines
Quoted 1 line
I will send a v2 with only this change.
I will send a v2 with only an early exit in
mptcp_pm_add_addr_echoed()
if there is no need to schedule the worker.
Sure. I agree.
Thanks,
-Geliang
Quoted 3 lines
Cheers,
Matt
Matthieu Baerts
maintainerHi Geliang,
Quoted 88 lines · Geliang Tang
Hi Matt,
Quoted 85 lines · Matthieu Baerts
Hi Geliang,
Quoted 81 lines · Matthieu Baerts
Hi Geliang,
Thank you for your review!
Quoted 51 lines · Geliang Tang
Hi Matt,
Quoted 48 lines · On Mon, 2025-02-24 at 20:01 +0100, Matthieu Baerts (NGI0) wrote:
When the userspace PM is used, there is no need to schedule the PM
worker for in-kernel specific tasks, e.g. creating new subflows, or
sending moreADD_ADDR.Now, these tasks will be done only if the in-kernel PM is being used.
Signed-off-by Matthieu Baerts (NGI0) <[email protected]>---
Notes:
- I don't know if this should be seen as a fix. Maybe yes because it
was not supposed to do that from the beginning, and it feels less
risky not to schedule the worker when it is not needed. I'm open
to
suggestions here.
- I'm mainly sharing this patch now because Geliang is going to
modify
these helpers to separate PM specific code. @Geliang: please rebase your series on top of this one (or include
this patch if it is easier).
Cc: Geliang Tang <[email protected]>
---
net/mptcp/pm.c | 10 ++++++++--1 file changed, 8 insertions(+), 2 deletions(-)net/mptcp/pm.c +0
-0index
16cacce6c10fe86467aa7ef8e588f9f535b586fb..4eabb83328905676759768fb44c859f5682721e3100644net/mptcp/pm.c +0
-0@@ -138,7 +138,7 @@ void mptcp_pm_fully_established(struct
mptcp_sock
*msk, const struct sock *ssk)
* racing paths -accept()andcheck_fully_established()
* be sure to serve this event only once.
*/net/mptcp/pm.c +1
-1- if (READ_ONCE(pm->work_pending) && + if (mptcp_pm_is_kernel(msk) && READ_ONCE(pm-Quoted 8 lines
Quoted 2 lines
Quoted 1 line
work_pending)&&
I think there's no need to modify this.
work_pendingis set to 0 by
userspace pm, for all cases wherework_pendingis 1, the path manager
must be an in-kernel pm.Good point, I missed that!
'
pm->work_pending' doesn't look like a good name for what it does. Hopefully, this will be clearer whenpm->opswill be used, which will
clearly separate what is done by the different PMs.Also, is it possible we never set '
pm->work_pending' back to 'true' once
it has been set to 'false'? Does it mean when we reach the limits, and
something happens (e.g. a removed subflow, limits are changed, etc.),
the worker is no longer used to establish new subflows or react when anADD_ADDRis received?
Quoted 4 lines
Quoted 1 line
I didn't check, but it feels like we should add something like that:
Yes, it is. We only set '
work_pending' to 'false' inmptcp_pm_nl_check_work_pending()but never set it back.
I looked a bit at that, but I didn't find anything wrong, even if it feels wrong not to put it back to 'true'.
Quoted 1 line
I'll try to fix this later. Please add an issue for it on github.
I can, but we will need to proof that there is an interest to set it back to "true".
Cheers,
Matt
Signature · 1 line
Sponsored by the NGI0 Core fund.