Skip to content

Commit

Permalink
mptcp: pm: userspace: avoid scheduling in-kernel PM worker
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
matttbe authored and intel-lab-lkp committed Feb 24, 2025
1 parent 3716d83 commit 8e667f6
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions net/mptcp/pm.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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))
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 8e667f6

Please sign in to comment.