MPTCP Linux Development
 help / color / mirror / Atom feed
From: Mat Martineau <mathew.j.martineau@linux.intel.com>
To: Paolo Abeni <pabeni@redhat.com>
Cc: mptcp@lists.linux.dev
Subject: Re: [PATCH net-next v3 2/3] mptcp: drop SK_RECLAIM_* macros
Date: Mon, 20 Jun 2022 13:38:46 -0700 (PDT)	[thread overview]
Message-ID: <839d9fca-c1e-f557-8d7-12dede91916c@linux.intel.com> (raw)
In-Reply-To: <b7884c6176c0dc56361a5cc365215333b5b81ec2.1655741931.git.pabeni@redhat.com>

On Mon, 20 Jun 2022, Paolo Abeni wrote:

> After commit 4890b686f408 ("net: keep sk->sk_forward_alloc as small as
> possible"), the MPTCP protocol is the last SK_RECLAIM_CHUNK and
> SK_RECLAIM_THRESHOLD users.
>
> Update the MPTCP reclaim schema to match the core/TCP one and drop the
> mentioned macros. This additionally clean the MPTCP code a bit.
>

Please also add one more patch to the series that deletes SK_RECLAIM_* 
from include/net/sock.h

- Mat

> Signed-off-by: Paolo Abeni <pabeni@redhat.com>
> ---
> net/mptcp/protocol.c | 35 ++---------------------------------
> 1 file changed, 2 insertions(+), 33 deletions(-)
>
> diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
> index 0d4b2c010da0..b31bac33f87a 100644
> --- a/net/mptcp/protocol.c
> +++ b/net/mptcp/protocol.c
> @@ -181,8 +181,8 @@ static void mptcp_rmem_uncharge(struct sock *sk, int size)
> 	reclaimable = msk->rmem_fwd_alloc - sk_unused_reserved_mem(sk);
>
> 	/* see sk_mem_uncharge() for the rationale behind the following schema */
> -	if (unlikely(reclaimable >= SK_RECLAIM_THRESHOLD))
> -		__mptcp_rmem_reclaim(sk, SK_RECLAIM_CHUNK);
> +	if (unlikely(reclaimable >= PAGE_SIZE))
> +		__mptcp_rmem_reclaim(sk, reclaimable);
> }
>
> static void mptcp_rfree(struct sk_buff *skb)
> @@ -961,25 +961,6 @@ static bool mptcp_frag_can_collapse_to(const struct mptcp_sock *msk,
> 		df->data_seq + df->data_len == msk->write_seq;
> }
>
> -static void __mptcp_mem_reclaim_partial(struct sock *sk)
> -{
> -	int reclaimable = mptcp_sk(sk)->rmem_fwd_alloc - sk_unused_reserved_mem(sk);
> -
> -	lockdep_assert_held_once(&sk->sk_lock.slock);
> -
> -	if (reclaimable > (int)PAGE_SIZE)
> -		__mptcp_rmem_reclaim(sk, reclaimable - 1);
> -
> -	sk_mem_reclaim(sk);
> -}
> -
> -static void mptcp_mem_reclaim_partial(struct sock *sk)
> -{
> -	mptcp_data_lock(sk);
> -	__mptcp_mem_reclaim_partial(sk);
> -	mptcp_data_unlock(sk);
> -}
> -
> static void dfrag_uncharge(struct sock *sk, int len)
> {
> 	sk_mem_uncharge(sk, len);
> @@ -999,7 +980,6 @@ static void __mptcp_clean_una(struct sock *sk)
> {
> 	struct mptcp_sock *msk = mptcp_sk(sk);
> 	struct mptcp_data_frag *dtmp, *dfrag;
> -	bool cleaned = false;
> 	u64 snd_una;
>
> 	/* on fallback we just need to ignore snd_una, as this is really
> @@ -1022,7 +1002,6 @@ static void __mptcp_clean_una(struct sock *sk)
> 		}
>
> 		dfrag_clear(sk, dfrag);
> -		cleaned = true;
> 	}
>
> 	dfrag = mptcp_rtx_head(sk);
> @@ -1044,7 +1023,6 @@ static void __mptcp_clean_una(struct sock *sk)
> 		dfrag->already_sent -= delta;
>
> 		dfrag_uncharge(sk, delta);
> -		cleaned = true;
> 	}
>
> 	/* all retransmitted data acked, recovery completed */
> @@ -1052,9 +1030,6 @@ static void __mptcp_clean_una(struct sock *sk)
> 		msk->recovery = false;
>
> out:
> -	if (cleaned && tcp_under_memory_pressure(sk))
> -		__mptcp_mem_reclaim_partial(sk);
> -
> 	if (snd_una == READ_ONCE(msk->snd_nxt) &&
> 	    snd_una == READ_ONCE(msk->write_seq)) {
> 		if (mptcp_timer_pending(sk) && !mptcp_data_fin_enabled(msk))
> @@ -1206,12 +1181,6 @@ static struct sk_buff *mptcp_alloc_tx_skb(struct sock *sk, struct sock *ssk, boo
> {
> 	gfp_t gfp = data_lock_held ? GFP_ATOMIC : sk->sk_allocation;
>
> -	if (unlikely(tcp_under_memory_pressure(sk))) {
> -		if (data_lock_held)
> -			__mptcp_mem_reclaim_partial(sk);
> -		else
> -			mptcp_mem_reclaim_partial(sk);
> -	}
> 	return __mptcp_alloc_tx_skb(sk, ssk, gfp);
> }
>
> -- 
> 2.35.3
>
>
>

--
Mat Martineau
Intel

  reply	other threads:[~2022-06-20 20:38 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-20 16:19 [PATCH net-next v3 1/3] mptcp: never fetch fwd memory from the subflow Paolo Abeni
2022-06-20 16:19 ` [PATCH net-next v3 2/3] mptcp: drop SK_RECLAIM_* macros Paolo Abeni
2022-06-20 20:38   ` Mat Martineau [this message]
2022-06-20 16:19 ` [PATCH net-next v3 3/3] mptcp: refine memory scheduling Paolo Abeni
2022-06-20 20:32   ` Mat Martineau
2022-06-20 16:46 ` [PATCH net-next v3 1/3] mptcp: never fetch fwd memory from the subflow Paolo Abeni

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=839d9fca-c1e-f557-8d7-12dede91916c@linux.intel.com \
    --to=mathew.j.martineau@linux.intel.com \
    --cc=mptcp@lists.linux.dev \
    --cc=pabeni@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox