diff --git a/net/core/stream.c b/net/core/stream.c index 25efb3eefc8c1..b16dfa568a2d5 100644 --- a/net/core/stream.c +++ b/net/core/stream.c @@ -117,34 +117,25 @@ EXPORT_SYMBOL(sk_stream_wait_close); */ int sk_stream_wait_memory(struct sock *sk, long *timeo_p) { - int ret, err = 0, i = 0; + int ret, err = 0; long vm_wait = 0; long current_timeo = *timeo_p; DEFINE_WAIT_FUNC(wait, woken_wake_function); - if (sk_stream_memory_free(sk)) { + if (sk_stream_memory_free(sk)) current_timeo = vm_wait = get_random_u32_below(HZ / 5) + 2; - } else - pr_info("%s\n", __func__); add_wait_queue(sk_sleep(sk), &wait); while (1) { - pr_info("%s i=%d timeo_p=%ld current_timeo=%ld vm_wait=%ld \n", __func__, i++, *timeo_p, current_timeo, vm_wait); sk_set_bit(SOCKWQ_ASYNC_NOSPACE, sk); - if (sk->sk_err || (sk->sk_shutdown & SEND_SHUTDOWN)) { - pr_info("%s goto do_error 1\n", __func__); + if (sk->sk_err || (sk->sk_shutdown & SEND_SHUTDOWN)) goto do_error; - } - if (!*timeo_p) { - pr_info("%s goto do_eagain 1 current_timeo=%ld\n", __func__, current_timeo); + if (!*timeo_p) goto do_eagain; - } - if (signal_pending(current)) { - pr_info("%s goto do_interrupted 1\n", __func__); + if (signal_pending(current)) goto do_interrupted; - } sk_clear_bit(SOCKWQ_ASYNC_NOSPACE, sk); if (sk_stream_memory_free(sk) && !vm_wait) break; @@ -156,20 +147,15 @@ int sk_stream_wait_memory(struct sock *sk, long *timeo_p) (sk_stream_memory_free(sk) && !vm_wait), &wait); sk->sk_write_pending--; - if (ret < 0) { - pr_info("%s goto do_error 2\n", __func__); + if (ret < 0) goto do_error; - } if (vm_wait) { vm_wait -= current_timeo; current_timeo = *timeo_p; if (current_timeo != MAX_SCHEDULE_TIMEOUT && - (current_timeo -= vm_wait) < 0) { - pr_info("%s set current_timeo = 0\n", __func__); + (current_timeo -= vm_wait) < 0) current_timeo = 0; - } - pr_info("%s set vm_wait = 0\n", __func__); vm_wait = 0; } *timeo_p = current_timeo; diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c index f7fe19d5af201..0588e658f4ab5 100644 --- a/net/mptcp/protocol.c +++ b/net/mptcp/protocol.c @@ -1420,9 +1420,6 @@ struct sock *mptcp_subflow_get_send(struct mptcp_sock *msk) if (!mptcp_subflow_active(subflow)) continue; - //if (tcp_rtx_and_write_queues_empty(ssk)) - // continue; - tout = max(tout, mptcp_timeout_from_subflow(subflow)); nr_active += !subflow->backup; pace = subflow->avg_pacing_rate; @@ -1458,10 +1455,8 @@ struct sock *mptcp_subflow_get_send(struct mptcp_sock *msk) * to check that subflow has a non empty cwin. */ ssk = send_info[SSK_MODE_ACTIVE].ssk; - if (!ssk || !sk_stream_memory_free(ssk)) { - pr_info("%s return NULL", __func__); + if (!ssk || !sk_stream_memory_free(ssk)) return NULL; - } burst = min_t(int, MPTCP_SEND_BURST_SIZE, mptcp_wnd_end(msk) - msk->snd_nxt); wmem = READ_ONCE(ssk->sk_wmem_queued); @@ -1550,7 +1545,6 @@ static int __subflow_push_pending(struct sock *sk, struct sock *ssk, !sk_stream_memory_free(ssk) || !mptcp_subflow_active(mptcp_subflow_ctx(ssk))) { err = copied; - //pr_info("%s goto out", __func__); goto out; } mptcp_set_timeout(sk); @@ -1662,10 +1656,8 @@ static void __mptcp_subflow_push_pending(struct sock *sk, struct sock *ssk, bool if (READ_ONCE(subflow->scheduled)) { mptcp_subflow_set_scheduled(subflow, false); ret = __subflow_push_pending(sk, ssk, &info); - if (ret <= 0) { - pr_info("%s not keep_pushing ret=%d", __func__, ret); + if (ret <= 0) keep_pushing = false; - } copied += ret; } @@ -1791,8 +1783,6 @@ static u32 mptcp_send_limit(const struct sock *sk) return limit - not_sent; } -static void __mptcp_retrans(struct sock *sk); - static int mptcp_sendmsg(struct sock *sk, struct msghdr *msg, size_t len) { struct mptcp_sock *msk = mptcp_sk(sk); @@ -1814,28 +1804,21 @@ static int mptcp_sendmsg(struct sock *sk, struct msghdr *msg, size_t len) copied += copied_syn; if (ret == -EINPROGRESS && copied_syn > 0) goto out; - else if (ret) { - pr_info("%s goto do_error 1\n", __func__); + else if (ret) goto do_error; - } } -//again: timeo = sock_sndtimeo(sk, msg->msg_flags & MSG_DONTWAIT); if ((1 << sk->sk_state) & ~(TCPF_ESTABLISHED | TCPF_CLOSE_WAIT)) { ret = sk_stream_wait_connect(sk, &timeo); - if (ret) { - pr_info("%s goto do_error 2\n", __func__); + if (ret) goto do_error; - } } ret = -EPIPE; - if (unlikely(sk->sk_err || (sk->sk_shutdown & SEND_SHUTDOWN))) { - pr_info("%s goto do_error 3\n", __func__); + if (unlikely(sk->sk_err || (sk->sk_shutdown & SEND_SHUTDOWN))) goto do_error; - } pfrag = sk_page_frag(sk); @@ -1848,10 +1831,8 @@ static int mptcp_sendmsg(struct sock *sk, struct msghdr *msg, size_t len) /* ensure fitting the notsent_lowat() constraint */ copy_limit = mptcp_send_limit(sk); - if (!copy_limit) { - //pr_info("%s goto wait_for_memory 1\n", __func__); + if (!copy_limit) goto wait_for_memory; - } /* reuse tail pfrag, if possible, or carve a new one from the * page allocator @@ -1859,10 +1840,8 @@ static int mptcp_sendmsg(struct sock *sk, struct msghdr *msg, size_t len) dfrag = mptcp_pending_tail(sk); dfrag_collapsed = mptcp_frag_can_collapse_to(msk, pfrag, dfrag); if (!dfrag_collapsed) { - if (!mptcp_page_frag_refill(sk, pfrag)) { - pr_info("%s goto wait_for_memory 2\n", __func__); + if (!mptcp_page_frag_refill(sk, pfrag)) goto wait_for_memory; - } dfrag = mptcp_carve_data_frag(msk, pfrag, pfrag->offset); frag_truesize = dfrag->overhead; @@ -1878,17 +1857,13 @@ static int mptcp_sendmsg(struct sock *sk, struct msghdr *msg, size_t len) psize = min_t(size_t, psize, copy_limit); total_ts = psize + frag_truesize; - if (!sk_wmem_schedule(sk, total_ts)) { - pr_info("%s goto wait_for_memory 3\n", __func__); + if (!sk_wmem_schedule(sk, total_ts)) goto wait_for_memory; - } ret = do_copy_data_nocache(sk, psize, &msg->msg_iter, page_address(dfrag->page) + offset); - if (ret) { - pr_info("%s goto do_error 4\n", __func__); + if (ret) goto do_error; - } /* data successfully copied into the write queue */ sk_forward_alloc_add(sk, -total_ts); @@ -1917,28 +1892,9 @@ static int mptcp_sendmsg(struct sock *sk, struct msghdr *msg, size_t len) wait_for_memory: set_bit(SOCK_NOSPACE, &sk->sk_socket->flags); __mptcp_push_pending(sk, msg->msg_flags); -//again: - pr_info("%s in wait_for_memory timeo=%ld\n", __func__, timeo); ret = sk_stream_wait_memory(sk, &timeo); - if (ret) { - pr_info("%s goto do_error 5 err=%d timeo=%ld tcp_rtx_and_write_queues_empty=%d\n", __func__, ret, timeo, tcp_rtx_and_write_queues_empty(sk)); - /* make sure we wake any epoll edge trigger waiter */ - if (unlikely(tcp_rtx_and_write_queues_empty(sk) && ret == -EAGAIN)) { - //sk->sk_write_space(sk); - //tcp_chrono_stop(sk, TCP_CHRONO_SNDBUF_LIMITED); - //continue; - //goto again; - //goto wait_for_memory; - //__mptcp_retrans(sk); - //__mptcp_retransmit_pending_data(sk); - //sk_stream_memory_free(sk); - //clear_bit(SOCK_NOSPACE, &sk->sk_socket->flags); - //timeo = sock_sndtimeo(sk, msg->msg_flags & MSG_DONTWAIT); - //return 0; - ; - } + if (ret) goto do_error; - } } if (copied) @@ -1946,21 +1902,13 @@ static int mptcp_sendmsg(struct sock *sk, struct msghdr *msg, size_t len) out: release_sock(sk); - if (copied == -EAGAIN) - pr_info("%s EAGAIN\n", __func__); return copied; do_error: - pr_info("%s do_error copied=%ld\n", __func__, copied); if (copied) goto out; copied = sk_stream_error(sk, msg->msg_flags, ret); - /* make sure we wake any epoll edge trigger waiter */ - //if (unlikely(tcp_rtx_and_write_queues_empty(sk) && copied == -EAGAIN)) { - // sk->sk_write_space(sk); - // tcp_chrono_stop(sk, TCP_CHRONO_SNDBUF_LIMITED); - //} goto out; } @@ -2223,8 +2171,6 @@ static int mptcp_recvmsg(struct sock *sk, struct msghdr *msg, size_t len, } timeo = sock_rcvtimeo(sk, flags & MSG_DONTWAIT); - //if (!timeo) - // pr_info("%s timeo=0\n", __func__); len = min_t(size_t, len, INT_MAX); target = sock_rcvlowat(sk, flags & MSG_WAITALL, len); @@ -2284,7 +2230,6 @@ static int mptcp_recvmsg(struct sock *sk, struct msghdr *msg, size_t len, } if (!timeo) { - pr_info("%s EAGAIN\n", __func__); copied = -EAGAIN; break; } @@ -2318,8 +2263,6 @@ static int mptcp_recvmsg(struct sock *sk, struct msghdr *msg, size_t len, mptcp_rcv_space_adjust(msk, copied); release_sock(sk); - if (copied == -EAGAIN) - pr_info("%s EAGAIN\n", __func__); return copied; }