Commit 95ed690e authored by Florian Westphal's avatar Florian Westphal Committed by Jakub Kicinski

mptcp: split mptcp_clean_una function

mptcp_clean_una() will wake writers in case memory could be reclaimed.
When called from mptcp_sendmsg the wakeup code isn't needed.

Move the wakeup to a new helper and then use that from the mptcp worker.
Signed-off-by: default avatarFlorian Westphal <fw@strlen.de>
Signed-off-by: default avatarMat Martineau <mathew.j.martineau@linux.intel.com>
Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 5a369ca6
...@@ -853,19 +853,25 @@ static void mptcp_clean_una(struct sock *sk) ...@@ -853,19 +853,25 @@ static void mptcp_clean_una(struct sock *sk)
} }
out: out:
if (cleaned) { if (cleaned)
sk_mem_reclaim_partial(sk); sk_mem_reclaim_partial(sk);
}
/* Only wake up writers if a subflow is ready */ static void mptcp_clean_una_wakeup(struct sock *sk)
if (mptcp_is_writeable(msk)) { {
set_bit(MPTCP_SEND_SPACE, &mptcp_sk(sk)->flags); struct mptcp_sock *msk = mptcp_sk(sk);
smp_mb__after_atomic();
/* set SEND_SPACE before sk_stream_write_space clears mptcp_clean_una(sk);
* NOSPACE
*/ /* Only wake up writers if a subflow is ready */
sk_stream_write_space(sk); if (mptcp_is_writeable(msk)) {
} set_bit(MPTCP_SEND_SPACE, &msk->flags);
smp_mb__after_atomic();
/* set SEND_SPACE before sk_stream_write_space clears
* NOSPACE
*/
sk_stream_write_space(sk);
} }
} }
...@@ -1769,7 +1775,7 @@ static void mptcp_worker(struct work_struct *work) ...@@ -1769,7 +1775,7 @@ static void mptcp_worker(struct work_struct *work)
long timeo = 0; long timeo = 0;
lock_sock(sk); lock_sock(sk);
mptcp_clean_una(sk); mptcp_clean_una_wakeup(sk);
mptcp_check_data_fin_ack(sk); mptcp_check_data_fin_ack(sk);
__mptcp_flush_join_list(msk); __mptcp_flush_join_list(msk);
if (test_and_clear_bit(MPTCP_WORK_CLOSE_SUBFLOW, &msk->flags)) if (test_and_clear_bit(MPTCP_WORK_CLOSE_SUBFLOW, &msk->flags))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment