One approach to indirect call optimization
by Mat Martineau
I noticed this patch on netdev to avoid an indirect call to md5_lookup,
which was accepted. It is mitigating the cost of an existing indirect call
rather than adding a new one, but shows how the maintainers are looking at
the problem.
--
Mat Martineau
Intel OTC
---------- Forwarded message ----------
Date: Mon, 23 Apr 2018 14:46:25
From: Eric Dumazet <edumazet(a)google.com>
To: David S . Miller <davem(a)davemloft.net>
Cc: netdev <netdev(a)vger.kernel.org>, Eric Dumazet <edumazet(a)google.com>,
Eric Dumazet <eric.dumazet(a)gmail.com>
Subject: [PATCH net-next] tcp: md5: only call tp->af_specific->md5_lookup() for
md5 sockets
RETPOLINE made calls to tp->af_specific->md5_lookup() quite expensive,
given they have no result.
We can omit the calls for sockets that have no md5 keys.
Signed-off-by: Eric Dumazet <edumazet(a)google.com>
---
net/ipv4/tcp_output.c | 26 ++++++++++++++------------
1 file changed, 14 insertions(+), 12 deletions(-)
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
index 383cac0ff0ec059ca7dbc1a6304cc7f8183e008d..95feffb6d53f8a9eadfb15a2fffeec498d6e993a 100644
--- a/net/ipv4/tcp_output.c
+++ b/net/ipv4/tcp_output.c
@@ -585,14 +585,15 @@ static unsigned int tcp_syn_options(struct sock *sk, struct sk_buff *skb,
unsigned int remaining = MAX_TCP_OPTION_SPACE;
struct tcp_fastopen_request *fastopen = tp->fastopen_req;
+ *md5 = NULL;
#ifdef CONFIG_TCP_MD5SIG
- *md5 = tp->af_specific->md5_lookup(sk, sk);
- if (*md5) {
- opts->options |= OPTION_MD5;
- remaining -= TCPOLEN_MD5SIG_ALIGNED;
+ if (unlikely(rcu_access_pointer(tp->md5sig_info))) {
+ *md5 = tp->af_specific->md5_lookup(sk, sk);
+ if (*md5) {
+ opts->options |= OPTION_MD5;
+ remaining -= TCPOLEN_MD5SIG_ALIGNED;
+ }
}
-#else
- *md5 = NULL;
#endif
/* We always get an MSS option. The option bytes which will be seen in
@@ -720,14 +721,15 @@ static unsigned int tcp_established_options(struct sock *sk, struct sk_buff *skb
opts->options = 0;
+ *md5 = NULL;
#ifdef CONFIG_TCP_MD5SIG
- *md5 = tp->af_specific->md5_lookup(sk, sk);
- if (unlikely(*md5)) {
- opts->options |= OPTION_MD5;
- size += TCPOLEN_MD5SIG_ALIGNED;
+ if (unlikely(rcu_access_pointer(tp->md5sig_info))) {
+ *md5 = tp->af_specific->md5_lookup(sk, sk);
+ if (*md5) {
+ opts->options |= OPTION_MD5;
+ size += TCPOLEN_MD5SIG_ALIGNED;
+ }
}
-#else
- *md5 = NULL;
#endif
if (likely(tp->rx_opt.tstamp_ok)) {
--
2.17.0.484.g0c8726318c-goog
2 years, 4 months
Using do_tcp_sendpages() for MPTCP (?)
by Christoph Paasch
Hello,
I am trying to rework our handling of the skb-building in tcp_sendmsg
(avoiding custom function-pointers for select_size,...) to reduce our impact
on regular TCP.
So, I started looking into what it takes to use do_tcp_sendpages when
pushing from the MPTCP-level to the subflow-level.
A problem is that do_tcp_sendpages() only works on subflows that have
SG-support (see the check in tcp_sendpage_locked()).
So, that would be kind of problematic, no?
I'm also not 100% sure how that is handled for the in-kernel TLS :-/
Thanks,
Christoph
2 years, 6 months
[Weekly meetings] MoM - 26th of September 2018
by Matthieu Baerts
Hello,
We just had our 23th meeting with Mat, Peter and Ossama (Intel OTC),
Christoph (Apple) and myself (Tessares).
Thanks again for this new good meeting!
Here are the minutes of the meeting:
current MPTCP:
- v0.94.1 has been released by Christoph
- v0.93.2 will be released "soon" by Matthieu
- Matth: figure out where to upload the new binaries
- To build RPM/DEB: https://github.com/multipath-tcp/mptcp-scripts
Test suite/environment:
- Matth is proposing to add MPTCP support in the official Packetdrill
- But he is looking for collaborations not to do that alone :)
- Matth will contact Packetdrill maintainer to see if they would
accept this while MPTCP is not upstream
Mat:
- implemented Eric's suggestion for skb private data
- we need 3 pointers for the destructor, constructor, mem
- looks well integrated and not too costly (copy of pointers)
- if 3 pointers are too much, would be easy to adapt during the review
Christoph:
- continue working on "cleaning" mptcp_net-next (removing features
and optimisations)
Ossama:
- the daemon looks good now!
- also need to look at legal issues of upstreaming stuff
Peter:
- continue working on the patch-set. Cleaning months of work.
Matth:
- finished testing the v4.9
- will release the v0.93.2.
- Going to finish the test of the v4.14 and mptcp_trunk in //
- after that, will be able to find bugs and update Netlink PM patch
Next meeting:
- We propose to have it back on Thursday this time, the 4th of
October. Usual time: 9am PDT - 16:00 UTC (9am PDT, 6pm CEST)
- Still open to everyone!
- https://annuel2.framapad.org/p/mptcp_upstreaming_20181004
Feel free to comment on these points and propose new ones for the next
meeting!
Talk to you next week,
Matthieu
--
Matthieu Baerts | R&D Engineer
matthieu.baerts(a)tessares.net
Tessares SA | Hybrid Access Solutions
www.tessares.net
1 Avenue Jean Monnet, 1348 Louvain-la-Neuve, Belgium
2 years, 6 months
[Weekly meetings] MoM - 20th of September 2018
by Matthieu Baerts
Hello,
We just had our 22th meeting with Mat and Peter (Intel OTC), Christoph
(Apple) and myself (Tessares).
Thanks again for this new good meeting!
Here are the minutes of the meeting:
mptcp_net-next: lockless sf patch-set proposed:
- there were some confusions in the comments (see next point to
resolve this issue)
- but going to be merged and need to be tested
- now we are aligned with mptcp_trunk
big changes on mptcp-dev:
- if also for mptcp_net-next: should we involve upstream ML for the
discussions?
- the decision is to at least put Mat in CC.
More cleanup in mptcp-net-next:
- removing features/optimisations → Christoph is looking at that:
the goal is to remove features to simplify the code, patch will follow.
- but these features/optimisations will continue to be maintained in
mptcp_trunk.
- Note in recent kernels: GSO + SG are now enabled by default
- rethinking scatter-gather support.
- @Christoph / @Mat: may you re-share your point of views about
that here please?
- it could be nice to have a nice split between MPTCP and TCP for
the send part (it then means we don't need the re-injection for the
first version, some static values, etc.)
New test suite/environment for mptcp_net-next:
- Matth is working on testing mptcp_trunk, can be nice to have
mptcp_net-next but if we remove features, that will become difficult to test
- same for Christoph's test suite
- there is packetdrill but support for MPTCP in Open-Source is not
very nice (would be amazing to have people working on that)
- we don't see any (open-source) test suites for the kernel with
MPTCP support. Feel free to share if you have new ideas!
- maybe "re-using" the old testing suite for MPTCP: KVM hosts and
doing some tests in bash
- Matth: looking at alternatives for next time
How is Google Meet:
- Works good, quality is good, no disconnection
- last alternative is Jitsy (webrtc + phone) but seems not needed
- We will then continue to use Meet
- Please ask me (Matt) to share the Google calendar invitation with you.
Next steps:
- same as last week.
Next meeting:
- We propose to have it on Wednesday this time, the 26th of
September. Usual time: 9am PDT - 16:00 UTC (9am PDT, 6pm CEST)
- Still open to everyone!
- https://annuel2.framapad.org/p/mptcp_upstreaming_20180926
Feel free to comment on these points and propose new ones for the next
meeting!
Talk to you next week,
Matthieu
--
Matthieu Baerts | R&D Engineer
matthieu.baerts(a)tessares.net
Tessares SA | Hybrid Access Solutions
www.tessares.net
1 Avenue Jean Monnet, 1348 Louvain-la-Neuve, Belgium
2 years, 6 months
[PATCH 00/20] Forward-ports of lockless subflow establishment
by Christoph Paasch
As the fixes have now landed in mptcp_trunk, here are the forward-ports
of the lockless subflow establishment.
Tested it a bit and it seems to work fine.
Christoph Paasch (20):
mptcp: Cleanup
mptcp: Improved debugging
mptcp: Use correct tcp_queue when calling mptcp_fragment
mptcp: Use mptcp_can_new_subflow where possible
mptcp: Render mptcp_sub_inherit_sockopts lockless
mptcp: Make mptcp_set_new_pathindex lockless
mptcp: Remove cnt_subflows
mptcp: Remove cnt_established
mptcp: Rename tw_lock to mpcb_list_lock
mptcp: Make subflow-list an RCU-list
mptcp: Don't take meta-lock when receiving third ACK
mptcp: Make mptcp_do_join_short and mptcp_lookup_join lockless
mptcp: Reset tsorted_anchor after call to tcp_fragment
mptcp: Pick correct sk when iterating in mptcp_set_rto
mptcp: Build-Fix
mptcp: Reset sk_it to NULL as we keep on iterating
mptcp: Close remaining subflows when falling back in
mptcp_verif_dss_csum
mptcp: Restart subflow-selection when we force a re-evaluation
mptcp: Don't free skb when tcp_transmit_skb without cloning
mptcp: Use spin_lock_bh where appropriate for mpcb_list_lock
include/net/mptcp.h | 132 ++++++++++++++-----------------
net/ipv4/af_inet.c | 9 ++-
net/ipv4/ip_sockglue.c | 7 +-
net/ipv4/tcp.c | 31 +++++---
net/ipv4/tcp_ipv4.c | 41 +---------
net/ipv4/tcp_minisocks.c | 9 ++-
net/ipv6/tcp_ipv6.c | 41 +---------
net/mptcp/mptcp_ctrl.c | 184 ++++++++++++++++++++++++++++---------------
net/mptcp/mptcp_fullmesh.c | 30 ++++---
net/mptcp/mptcp_input.c | 154 +++++++++++++-----------------------
net/mptcp/mptcp_ipv4.c | 34 +++-----
net/mptcp/mptcp_ipv6.c | 15 ++--
net/mptcp/mptcp_ndiffports.c | 2 +-
net/mptcp/mptcp_output.c | 65 ++++++++++-----
net/mptcp/mptcp_sched.c | 43 +++++-----
15 files changed, 388 insertions(+), 409 deletions(-)
--
2.16.2
2 years, 6 months
Re: [MPTCP] [PATCH 0/6] Batch of fixes
by Matthieu Baerts
Hi Christoph,
On 14/09/2018 02:25, Christoph Paasch wrote:
> All should go into mptcp_trunk, besides "mptcp: Restart
> subflow-selection when we force a re-evaluation" which is a candidate
> for being back-ported.
Thank you for all these patches and your reply!
I just applied all of them in mptcp_trunk. I am going to check next week
to backport the 4th patch!
Note for mptcp_net-next: I can also check to cherry-pick this patch and
the 5th one in mptcp_net-next but not the others as they all depend on
the lockless sf patch-set :)
Have a good day,
Matt
> Christoph Paasch (6):
> mptcp: Build-Fix
> mptcp: Reset sk_it to NULL as we keep on iterating
> mptcp: Close remaining subflows when falling back in
> mptcp_verif_dss_csum
> mptcp: Restart subflow-selection when we force a re-evaluation
> mptcp: Don't free skb when tcp_transmit_skb without cloning
> mptcp: Use spin_lock_bh where appropriate for mpcb_list_lock
>
> include/net/mptcp.h | 5 +++++
> net/mptcp/mptcp_ctrl.c | 10 ++++------
> net/mptcp/mptcp_input.c | 4 ++++
> net/mptcp/mptcp_output.c | 4 +---
> net/mptcp/mptcp_sched.c | 11 +++++++++--
> 5 files changed, 23 insertions(+), 11 deletions(-)
>
--
Matthieu Baerts | R&D Engineer
matthieu.baerts(a)tessares.net
Tessares SA | Hybrid Access Solutions
www.tessares.net
1 Avenue Jean Monnet, 1348 Louvain-la-Neuve, Belgium
2 years, 7 months
[Weekly meetings] MoM - 13th of September 2018
by Matthieu Baerts
Hello,
We just had our 21th meeting with Mat and Peter (Intel OTC), Christoph
and Vishnu (Apple) and myself (Tessares).
Thanks again for this new good meeting!
Here are the minutes of the meeting:
cherry-pick from mptcp_trunk → mptcp_net-next:
- Christoph did the last ones
- who is in charge of this?
- low patch traffic
- no one in charge, the first that propose it
- Mat has a small environment to at least compile and run small tests
- Fine for the moment not to have regression tests
Patches from Mat and Peter:
- RFCv3 is coming
- bug fixes first, no urgence
Christoph:
- bug fixes are coming
- MPTCP support added in
https://github.com/apache/trafficserver/pull/4203/files
Vishnu:
- continuing the learning bit
Matth:
- still progressing on the testing environment
How is webex:
- having to use the phone reduce the quality of the call
- no (good) desktop client for Linux
- but most importantly, except the video cutting out, nobody had to
re-connect
- Proposition to use Google Meet: Matthieu will send an invitation
- (if not, webex is fine ; there is also jitsi but also using WebRTC
like Talky, might be an issue: https://meet.jit.si/MPTCPUpstreaming )
Next steps:
- same as last week.
Next meeting:
- We propose to have it on Thursday again, the 20th of September.
Usual time: 9am PDT - 16:00 UTC (9am PDT, 6pm CEST)
- Still open to everyone!
- https://annuel2.framapad.org/p/mptcp_upstreaming_20180920
Feel free to comment on these points and propose new ones for the next
meeting!
Talk to you next week,
Matthieu
--
Matthieu Baerts | R&D Engineer
matthieu.baerts(a)tessares.net
Tessares SA | Hybrid Access Solutions
www.tessares.net
1 Avenue Jean Monnet, 1348 Louvain-la-Neuve, Belgium
2 years, 7 months
[PATCH 0/2] Forward-ports from mptcp_trunk
by Christoph Paasch
Christoph Paasch (1):
mptcp: Iterate over subflow-list while holding the lock in
tcp_splice_read
Patrick Havelange (1):
mptcp: avoid removing useful skbs from the reinject queue.
net/ipv4/tcp.c | 15 ++++++++-------
net/mptcp/mptcp_output.c | 3 +++
2 files changed, 11 insertions(+), 7 deletions(-)
--
2.16.2
2 years, 7 months