net: Add incoming CPU mask to sockets
Subsystems (13)
v2 cover net: Add incoming CPU mask to sockets
Added matching of CPU to a socket CPU mask. This is useful for TCP listeners and unconnected UDP. This works with SO_REUSPORT to steer packets to listener sockets based on CPU affinity. These patches allow steering packets to listeners based on numa locality. This is only useful for passive connections.
v2:
- Add cache alignment for fields used in socket lookup in sock_common
- Added UDP test results
Tested: 200 TCP_RR with --r 512,512 streams ran against an echo server with that sets both SO_REUSEPORT and SO_INCOMING_CPU_MASK. In the test case used taskset to pin an instance to a set of CPUs corresponding to a numa node and set SO_INCOMING_CPU_MASK to the same set of CPUS.
CPU utilization is reported from the echo server side.
IPv4
No INCOMING_CPU_MASK
83.48% CPU utilization
1627173 tps
106/185/382 50/90/99% latencies
With INCOMING_CPU_MASK
77.61% CPU utilization
1669853 tps
103/181/378 50/90/99% latencies
IPv6
No INCOMING_CPU_MASK
84.82% CPU utilization
1551730 tps
111/195/392 50/90/99% latencies
With INCOMING_CPU_MASK
79.25% CPU utilization
1571911 tps
110/191/381 50/90/99% latenciesTested: 200 UDP_RR with --r 512,512 streams ran against an echo server with that sets both SO_REUSEPORT and SO_INCOMING_CPU_MASK. In the test case used taskset to pin an instance to a set of CPUs corresponding to a numa node and set SO_INCOMING_CPU_MASK to the same set of CPUS.
IPv4
No INCOMING_CPU_MASK
54.76% CPU utilization
1603752.3 tps
95/217/753 50/90/99% latencies
With INCOMING_CPU_MASK
53.25% CPU utilization
1717618 tps
117/221/502 50/90/99% latencies
IPv6
No INCOMING_CPU_MASK
61.62% CPU utilization
1276757 tps
125/279/629 50/90/99% latencies
With INCOMING_CPU_MASK
66.63% CPU utilization
1314527 tps
149/318/564 50/90/99% latencies*** BLURB HERE ***
Tom Herbert (3):
net: Add cache alignment in sock_common for socket lookup fields
kernel: Make compat bitmap functions externally visible
net: Add incoming CPU mask to sockets
arch/alpha/include/uapi/asm/socket.h | 2 + arch/avr32/include/uapi/asm/socket.h | 2 + arch/cris/include/uapi/asm/socket.h | 2 + arch/frv/include/uapi/asm/socket.h | 2 + arch/ia64/include/uapi/asm/socket.h | 2 + arch/m32r/include/uapi/asm/socket.h | 2 + arch/mips/include/uapi/asm/socket.h | 2 + arch/mn10300/include/uapi/asm/socket.h | 2 + arch/parisc/include/uapi/asm/socket.h | 2 + arch/powerpc/include/uapi/asm/socket.h | 2 + arch/s390/include/uapi/asm/socket.h | 2 + arch/sparc/include/uapi/asm/socket.h | 2 + arch/xtensa/include/uapi/asm/socket.h | 2 + include/linux/compat.h | 2 + include/net/sock.h | 39 ++++++++++++++++- include/uapi/asm-generic/socket.h | 2 + kernel/compat.c | 7 ++- net/compat.c | 56 ++++++++++++++++++++++++ net/core/sock.c | 80 ++++++++++++++++++++++++++++++++++ net/ipv4/inet_hashtables.c | 3 ++ net/ipv4/udp.c | 6 +++ net/ipv6/inet6_hashtables.c | 3 ++ net/ipv6/udp.c | 3 ++ 23 files changed, 224 insertions(+), 3 deletions(-)
Signature · 1 line
1.8.1
PATCH v2 1/3 net: Add cache alignment in sock_common for socket lookup fields
Use ____cacheline_aligned_in_smp to keep the fields used on socket lookup in their own cachelines. These are read only fields and will be often accessed on accross CPUs (would be very common with SO_REUSEPORT for instance).
--- include/net/sock.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
include/net/sock.h +7 -1
@@ -211,7 +211,13 @@ struct sock_common {struct hlist_node skc_node;struct hlist_nulls_node skc_nulls_node; }; -int skc_tx_queue_mapping; + +/* Cachelines above this point are read mostly and are used in socket +* lookup. +*/ +int skc_tx_queue_mapping +____cacheline_aligned_in_smp ; +atomic_t skc_refcnt;/* private: */ int skc_dontcopy_end[0 ];
Signature · 1 line
1.8.1
Re: [PATCH v2 net-next 1/3] net: Add cache alignment in sock_common for socket lookup fields
Quoted 19 lines · Tom Herbert
Use
____cacheline_aligned_in_smpto keep the fields used on socket lookup in their own cachelines. These are read only fields and will be often accessed on accross CPUs (would be very common withSO_REUSEPORTfor instance).Signed-off-by Tom Herbert <[email protected]>--- include/net/sock.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)include/net/sock.h +0
-1@@ -211,7 +211,13 @@ struct sock_common {struct hlist_node skc_node;struct hlist_nulls_node skc_nulls_node; }; -int skc_tx_queue_mapping;
include/net/sock.h struct sock_common { · line 223
Quoted 10 lines
include/net/sock.h +7
-0+ +/* Cachelines above this point are read mostly and are used in socket +* lookup. +*/ +int skc_tx_queue_mapping +____cacheline_aligned_in_smp ; +atomic_t skc_refcnt;/* private: */ int skc_dontcopy_end[0 ];
No, we do not want to increase the size of sock_common with such a hammer.
I am pretty sure you never tested this patch, since you placed the attribute at the wrong place anyway.
Re: [PATCH v2 net-next 1/3] net: Add cache alignment in sock_common for socket lookup fields
Quoted 2 lines · Eric Dumazet
No, we do not want to increase the size of
sock_commonwith such a hammer.
Current sizeof(struct sock_common) is 0x78 bytes.
So moving 2 read_mostly pointers into this structure would be enough to make 2 first cache lines read mostly.
One candidate would be sk_rx_dst, as it is used in early demux.
Re: [PATCH v2 net-next 1/3] net: Add cache alignment in sock_common for socket lookup fields
Quoted 10 lines · Eric Dumazet
Quoted 2 lines · Eric Dumazet
No, we do not want to increase the size of
sock_commonwith such a hammer.Current
sizeof(struct sock_common)is0x78bytes.So moving 2
read_mostlypointers into this structure would be enough to make 2 first cache lines read mostly.
Right, the problem is refcnt out of those cachelines.
Quoted 3 lines
One candidate would be
sk_rx_dst, as it is used in early demux.
PATCH v2 2/3 kernel: Make compat bitmap functions externally visible
In reply to Tom HerbertExport compat_get_bitmap and compat_put_bitmap. Make compat_get_user_cpu_mask not static, add prototype in compat.h, and export it.
--- include/linux/compat.h | 2 ++ kernel/compat.c | 7 +++++-- 2 files changed, 7 insertions(+), 2 deletions(-)
include/linux/compat.h +2 -0
@@ -380,6 +380,8 @@ long compat_get_bitmap(unsigned long *mask, const compat_ulong_t __user *umask, unsigned long bitmap_size);long compat_put_bitmap (compat_ulong_t __user *umask,unsigned long *mask,unsigned long bitmap_size); +int compat_get_user_cpu_mask (compat_ulong_t __user *user_mask_ptr, +unsigned len,struct cpumask *new_mask);int copy_siginfo_from_user32 (siginfo_t *to,struct compat_siginfo __user *from);int copy_siginfo_to_user32 (struct compat_siginfo __user *to,const siginfo_t *from); int get_compat_sigevent(struct sigevent *event,
kernel/compat.c +5 -2
@@ -599,8 +599,8 @@ COMPAT_SYSCALL_DEFINE5(waitid,return copy_siginfo_to_user32 (uinfo, &info); } -static int compat_get_user_cpu_mask (compat_ulong_t __user *user_mask_ptr, -unsigned len,struct cpumask *new_mask) +int compat_get_user_cpu_mask (compat_ulong_t __user *user_mask_ptr, +unsigned len,struct cpumask *new_mask) {unsigned long *k;
@@ -612,6 +612,7 @@ static int compat_get_user_cpu_mask(compat_ulong_t __user *user_mask_ptr, k =cpumask_bits (new_mask);return compat_get_bitmap (k, user_mask_ptr, len *8 ); } +EXPORT_SYMBOL_GPL (compat_get_user_cpu_mask); COMPAT_SYSCALL_DEFINE3(sched_setaffinity, compat_pid_t, pid, unsigned int, len,
@@ -927,6 +928,7 @@ long compat_get_bitmap(unsigned long *mask, const compat_ulong_t __user *umask,return 0 ; } +EXPORT_SYMBOL_GPL (compat_get_bitmap);long compat_put_bitmap (compat_ulong_t __user *umask,unsigned long *mask,unsigned long bitmap_size)
@@ -967,6 +969,7 @@ long compat_put_bitmap(compat_ulong_t __user *umask, unsigned long *mask,return 0 ; } +EXPORT_SYMBOL_GPL (compat_put_bitmap);void sigset_from_compat (sigset_t *set,const compat_sigset_t *compat)
Signature · 1 line
1.8.1
PATCH v2 3/3 net: Add incoming CPU mask to sockets
In reply to Tom HerbertAdded matching of CPU to a socket CPU mask. This is useful for TCP listeners and unconnected UDP. This works with SO_REUSEPORT to steer packets to listener sockets based on CPU affinity.
In this patch:
- Add SO_INCOMING_CPU_MASK
- Add a CPU mask pointer to struct sock
- Get/setsockopt to get/set a the mask on a socket
- Compat functions for the sockopts
- Add sk_match_incoming_cpu_mask to check is running CPU is in a mask for a socket
- Call sk_match_incoming_cpu_mask from inet compute_score and UDP functions for IPv4 and IPv6
--- arch/alpha/include/uapi/asm/socket.h | 2 + arch/avr32/include/uapi/asm/socket.h | 2 + arch/cris/include/uapi/asm/socket.h | 2 + arch/frv/include/uapi/asm/socket.h | 2 + arch/ia64/include/uapi/asm/socket.h | 2 + arch/m32r/include/uapi/asm/socket.h | 2 + arch/mips/include/uapi/asm/socket.h | 2 + arch/mn10300/include/uapi/asm/socket.h | 2 + arch/parisc/include/uapi/asm/socket.h | 2 + arch/powerpc/include/uapi/asm/socket.h | 2 + arch/s390/include/uapi/asm/socket.h | 2 + arch/sparc/include/uapi/asm/socket.h | 2 + arch/xtensa/include/uapi/asm/socket.h | 2 + include/net/sock.h | 31 +++++++++++++ include/uapi/asm-generic/socket.h | 2 + net/compat.c | 56 ++++++++++++++++++++++++ net/core/sock.c | 80 ++++++++++++++++++++++++++++++++++ net/ipv4/inet_hashtables.c | 3 ++ net/ipv4/udp.c | 6 +++ net/ipv6/inet6_hashtables.c | 3 ++ net/ipv6/udp.c | 3 ++ 21 files changed, 210 insertions(+)
arch/alpha/include/uapi/asm/socket.h +2 -0
@@ -92,4 +92,6 @@#define SO_ATTACH_BPF 50#define SO_DETACH_BPF SO_DETACH_FILTER +#define SO_INCOMING_CPU_MASK 51 +#endif /* _UAPI_ASM_SOCKET_H */
arch/avr32/include/uapi/asm/socket.h +2 -0
@@ -85,4 +85,6 @@#define SO_ATTACH_BPF 50#define SO_DETACH_BPF SO_DETACH_FILTER +#define SO_INCOMING_CPU_MASK 51 +#endif /* _UAPI__ASM_AVR32_SOCKET_H */
arch/cris/include/uapi/asm/socket.h +2 -0
@@ -87,6 +87,8 @@#define SO_ATTACH_BPF 50#define SO_DETACH_BPF SO_DETACH_FILTER +#define SO_INCOMING_CPU_MASK 51 +#endif /* _ASM_SOCKET_H */
arch/frv/include/uapi/asm/socket.h +2 -0
@@ -85,5 +85,7 @@#define SO_ATTACH_BPF 50#define SO_DETACH_BPF SO_DETACH_FILTER +#define SO_INCOMING_CPU_MASK 51 +#endif /* _ASM_SOCKET_H */
arch/ia64/include/uapi/asm/socket.h +2 -0
@@ -94,4 +94,6 @@#define SO_ATTACH_BPF 50#define SO_DETACH_BPF SO_DETACH_FILTER +#define SO_INCOMING_CPU_MASK 51 +#endif /* _ASM_IA64_SOCKET_H */
arch/m32r/include/uapi/asm/socket.h +2 -0
@@ -85,4 +85,6 @@#define SO_ATTACH_BPF 50#define SO_DETACH_BPF SO_DETACH_FILTER +#define SO_INCOMING_CPU_MASK 51 +#endif /* _ASM_M32R_SOCKET_H */
arch/mips/include/uapi/asm/socket.h +2 -0
@@ -103,4 +103,6 @@#define SO_ATTACH_BPF 50#define SO_DETACH_BPF SO_DETACH_FILTER +#define SO_INCOMING_CPU_MASK 51 +#endif /* _UAPI_ASM_SOCKET_H */
arch/mn10300/include/uapi/asm/socket.h +2 -0
@@ -85,4 +85,6 @@#define SO_ATTACH_BPF 50#define SO_DETACH_BPF SO_DETACH_FILTER +#define SO_INCOMING_CPU_MASK 51 +#endif /* _ASM_SOCKET_H */
arch/parisc/include/uapi/asm/socket.h +2 -0
@@ -84,4 +84,6 @@#define SO_ATTACH_BPF 0x402B#define SO_DETACH_BPF SO_DETACH_FILTER +#define SO_INCOMING_CPU_MASK 0x402C +#endif /* _UAPI_ASM_SOCKET_H */
arch/powerpc/include/uapi/asm/socket.h +2 -0
@@ -92,4 +92,6 @@#define SO_ATTACH_BPF 50#define SO_DETACH_BPF SO_DETACH_FILTER +#define SO_INCOMING_CPU_MASK 51 +#endif /* _ASM_POWERPC_SOCKET_H */
arch/s390/include/uapi/asm/socket.h +2 -0
@@ -91,4 +91,6 @@#define SO_ATTACH_BPF 50#define SO_DETACH_BPF SO_DETACH_FILTER +#define SO_INCOMING_CPU_MASK 51 +#endif /* _ASM_SOCKET_H */
arch/sparc/include/uapi/asm/socket.h +2 -0
@@ -81,6 +81,8 @@#define SO_ATTACH_BPF 0x0034#define SO_DETACH_BPF SO_DETACH_FILTER +#define SO_INCOMING_CPU_MASK 0x0035 +/* Security levels - as per NRL IPv6 - don't actually do anything */ #define SO_SECURITY_AUTHENTICATION 0x5001#define SO_SECURITY_ENCRYPTION_TRANSPORT 0x5002
arch/xtensa/include/uapi/asm/socket.h +2 -0
@@ -96,4 +96,6 @@#define SO_ATTACH_BPF 50#define SO_DETACH_BPF SO_DETACH_FILTER +#define SO_INCOMING_CPU_MASK 51 +#endif /* _XTENSA_SOCKET_H */
include/net/sock.h +31 -0
@@ -123,6 +123,11 @@ typedef struct {#endif } socket_lock_t; +struct rcu_cpumask { +struct rcu_head rcu; +unsigned long cpumask[0 ]; +}; +struct sock ;struct proto ;struct net ;
@@ -150,6 +155,7 @@ typedef __u64 __bitwise __addrpair;* @skc_node: main hash linkage for various protocol lookup tables * @skc_nulls_node: main hash linkage for TCP/UDP/UDP-Lite protocol * @skc_tx_queue_mapping: tx queue number for this connection +* @skc_incoming_cpu_mask: CPU mask for listeners * @skc_refcnt: reference count * * This is the minimal network layer representation of sockets, the header
@@ -212,9 +218,12 @@ struct sock_common {struct hlist_nulls_node skc_nulls_node; }; +struct rcu_cpumask __rcu *skc_incoming_cpu_mask; +/* Cachelines above this point are read mostly and are used in socket * lookup. */ +int skc_tx_queue_mapping____cacheline_aligned_in_smp ;
@@ -314,6 +323,7 @@ struct sock {#define sk_node __sk_common.skc_node#define sk_nulls_node __sk_common.skc_nulls_node#define sk_refcnt __sk_common.skc_refcnt +#define sk_incoming_cpu_mask __sk_common.skc_incoming_cpu_mask#define sk_tx_queue_mapping __sk_common.skc_tx_queue_mapping#define sk_dontcopy_begin __sk_common.skc_dontcopy_begin
@@ -2220,6 +2230,27 @@ static inline bool sk_fullsock(const struct sock *sk)return (1 << sk->sk_state) & ~(TCPF_TIME_WAIT |TCPF_NEW_SYN_RECV ); } +static inline bool sk_match_incoming_cpu_mask (const struct sock *sk) +{ +struct rcu_cpumask *mask; +bool ret = false; + +if (!sk->sk_incoming_cpu_mask) +return ret; + +rcu_read_lock (); + + mask =rcu_dereference (sk->sk_incoming_cpu_mask); +if (likely (mask) && +cpumask_test_cpu (raw_smp_processor_id (), +to_cpumask (mask->cpumask))) + ret = true; + +rcu_read_unlock (); + +return ret; +} +void sock_enable_timestamp (struct sock *sk,int flag);int sock_get_timestamp (struct sock *,struct timeval __user *);int sock_get_timestampns (struct sock *,struct timespec __user *);
include/uapi/asm-generic/socket.h +2 -0
@@ -87,4 +87,6 @@#define SO_ATTACH_BPF 50#define SO_DETACH_BPF SO_DETACH_FILTER +#define SO_INCOMING_CPU_MASK 51 +#endif /* __ASM_GENERIC_SOCKET_H */
net/compat.c +56 -0
79 lines not on this page · raw message
net/core/sock.c +80 -0
116 lines not on this page · raw message
net/ipv4/inet_hashtables.c +3 -0
@@ -184,6 +184,9 @@ static inline int compute_score(struct sock *sk, struct net *net,return -1 ; score +=4 ; } + +if (sk_match_incoming_cpu_mask (sk)) + score +=4 ; }return score; }
net/ipv4/udp.c +6 -0
@@ -375,6 +375,9 @@ static inline int compute_score(struct sock *sk, struct net *net, score +=4 ; } +if (sk_match_incoming_cpu_mask (sk)) + score +=4 ; +return score; }
@@ -418,6 +421,9 @@ static inline int compute_score2(struct sock *sk, struct net *net, score +=4 ; } +if (sk_match_incoming_cpu_mask (sk)) + score +=4 ; +return score; }
net/ipv6/inet6_hashtables.c +3 -0
@@ -114,6 +114,9 @@ static inline int compute_score(struct sock *sk, struct net *net,return -1 ; score++; } + +if (sk_match_incoming_cpu_mask (sk)) + score +=4 ; }return score; }
net/ipv6/udp.c +3 -0
@@ -182,6 +182,9 @@ static inline int compute_score(struct sock *sk, struct net *net, score++; } +if (sk_match_incoming_cpu_mask (sk)) + score++; +return score; }
Signature · 1 line
1.8.1
Quoted 9 lines · Tom Herbert
Added matching of CPU to a socket CPU mask. This is useful for TCP listeners and unconnected UDP. This works with
SO_REUSPORTto steer packets to listener sockets based on CPU affinity. These patches allow steering packets to listeners based on numa locality. This is only useful for passive connections.v2:
- Add cache alignment for fields used in socket lookup insock_common
- Added UDP test results
What about the feedback I gave earlier Tom ???
This cannot work for TCP in its current state.
Quoted 7 lines · Eric Dumazet
Quoted 6 lines · Tom Herbert
Added matching of CPU to a socket CPU mask. This is useful for TCP listeners and unconnected UDP. This works with
SO_REUSPORTto steer packets to listener sockets based on CPU affinity. These patches allow steering packets to listeners based on numa locality. This is only useful for passive connections.
Quoted 8 lines
Quoted 3 lines
v2:
- Add cache alignment for fields used in socket lookup insock_common
- Added UDP test resultsWhat about the feedback I gave earlier Tom ???
This cannot work for TCP in its current state.
It does work and it fixes cache server locality issues we are seeing. Right now half of our connections are persistently crossing numa nodes on receive-- this is having big negative impact. Yes, there may be edge conditions where SYN goes to a different CPU than the rest of the flow (probably need RFS or flow director for that problem), and that sounds like something nice to fix, but this patch is not dependent on that. Besides, did you foresee an API change would be required?
Quoted 1 line
Quoted 16 lines · Tom Herbert
Quoted 7 lines · Eric Dumazet
Quoted 6 lines · Tom Herbert
Added matching of CPU to a socket CPU mask. This is useful for TCP listeners and unconnected UDP. This works with
SO_REUSPORTto steer packets to listener sockets based on CPU affinity. These patches allow steering packets to listeners based on numa locality. This is only useful for passive connections.Quoted 8 lines
Quoted 3 lines
v2:
- Add cache alignment for fields used in socket lookup insock_common
- Added UDP test resultsWhat about the feedback I gave earlier Tom ???
This cannot work for TCP in its current state.
Quoted 7 lines
It does work and it fixes cache server locality issues we are seeing. Right now half of our connections are persistently crossing numa nodes on receive-- this is having big negative impact. Yes, there may be edge conditions where SYN goes to a different CPU than the rest of the flow (probably need RFS or flow director for that problem), and that sounds like something nice to fix, but this patch is not dependent on that. Besides, did you foresee an API change would be required?
With current stack, there is no guarantee SYN and ACK packets are handled by same cpu.
These are no edge conditions, but real ones, even with RFS.
Not everyone tweaks /proc/irq/*/smp_affinity
Default is still allowing cpus being almost random (affinity=fffffff)
That was partly for these reasons that SO_REUSEPORT (for TCP) could not use cpu number, but a flow hash to select the target socket.
Quoted 25 lines · Eric Dumazet
Quoted 16 lines · Tom Herbert
Quoted 7 lines · Eric Dumazet
Quoted 6 lines · Tom Herbert
Added matching of CPU to a socket CPU mask. This is useful for TCP listeners and unconnected UDP. This works with
SO_REUSPORTto steer packets to listener sockets based on CPU affinity. These patches allow steering packets to listeners based on numa locality. This is only useful for passive connections.Quoted 8 lines
Quoted 3 lines
v2:
- Add cache alignment for fields used in socket lookup insock_common
- Added UDP test resultsWhat about the feedback I gave earlier Tom ???
This cannot work for TCP in its current state.
Quoted 7 lines
It does work and it fixes cache server locality issues we are seeing. Right now half of our connections are persistently crossing numa nodes on receive-- this is having big negative impact. Yes, there may be edge conditions where SYN goes to a different CPU than the rest of the flow (probably need RFS or flow director for that problem), and that sounds like something nice to fix, but this patch is not dependent on that. Besides, did you foresee an API change would be required?
Quoted 9 lines
With current stack, there is no guarantee SYN and ACK packets are handled by same cpu.
These are no edge conditions, but real ones, even with RFS.
Not everyone tweaks
/proc/irq/*/smp_affinityDefault is still allowing cpus being almost random (affinity=fffffff)
In that case there's no guarantee that any two packets in a flow will hit the same CPU so there's no way to establish affinity to the interrupt anyway. RFS would work okay to get affinity of the soft processing, but there would be no point in trying to do any affinity with incoming cpu so this feature wouldn't help.
The general problem is that the flow hash and/or RX CPU for a flow are not guaranteed to be persistent for a connection. UDP doesn't have a problem with this since every RX UDP packet can be independently steered to a good socket in SO_REUSEPORT. For TCP we only get to make this decision once for the whole lifetime of the flow, which means that eventually that may turn out to made "wrong". These patches don't try to fix that problem, for that I believe we're going to need to do something a little more radical :-)
Quoted 5 lines
That was partly for these reasons that
SO_REUSEPORT(for TCP) could not use cpu number, but a flow hash to select the target socket.
Quoted 5 lines · Tom Herbert
In that case there's no guarantee that any two packets in a flow will hit the same CPU so there's no way to establish affinity to the interrupt anyway. RFS would work okay to get affinity of the soft processing, but there would be no point in trying to do any affinity with incoming cpu so this feature wouldn't help.
This is why I think this patch can hurt users.
RPS/RFS/smp_affinity/SO_REUSEPORT/cpuhotplug are only hints, that would never break TCP session establishment, even with hash collisions and sockets being added/deleted to SO_REUSEPORT pools.
It works in _all_ situations. Even the crazy/stupid setups.
Your patch is breaking this rule, without any clear documentation on how to make sure everything is properly setup.
I am not sure my tcp listener stuff will be finished for 4.2, because I had to spend lot of time to more urgent stuff lately, like reviewing patches ;)
I would prefer your patch is added for 4.3, not before.