From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric Dumazet Subject: Re: [PATCH net-next] net: preserve sock reference when scrubbing the skb. Date: Mon, 25 Jun 2018 23:41:05 -0700 Message-ID: <48e15faf-f935-0166-e1db-18f7286e7264@gmail.com> References: <20180625155610.30802-1-fbl@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Cc: Linux Kernel Network Developers , Eric Dumazet , Paolo Abeni , David Miller , Florian Westphal , NetFilter To: Cong Wang , Flavio Leitner Return-path: Received: from mail-pf0-f195.google.com ([209.85.192.195]:35139 "EHLO mail-pf0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751181AbeFZGlH (ORCPT ); Tue, 26 Jun 2018 02:41:07 -0400 In-Reply-To: Content-Language: en-US Sender: netdev-owner@vger.kernel.org List-ID: On 06/25/2018 09:15 PM, Cong Wang wrote: > On Mon, Jun 25, 2018 at 8:59 AM Flavio Leitner wrote: >> >> The sock reference is lost when scrubbing the packet and that breaks >> TSQ (TCP Small Queues) and XPS (Transmit Packet Steering) causing >> performance impacts of about 50% in a single TCP stream when crossing >> network namespaces. >> >> XPS breaks because the queue mapping stored in the socket is not >> available, so another random queue might be selected when the stack >> needs to transmit something like a TCP ACK, or TCP Retransmissions. >> That causes packet re-ordering and/or performance issues. >> >> TSQ breaks because it orphans the packet while it is still in the >> host, so packets are queued contributing to the buffer bloat problem. > > Why should TSQ in one stack care about buffer bloat in another stack? > > Actually, I think the current behavior is correct, once the packet leaves > its current stack (or netns), it should relief the backpressure on TCP > socket in this stack, whether it will be queued in another stack is beyond > its concern. This breaks the isolation between networking stacks. > We discussed about this during netconf Cong, nobody was against this planned removal. When a packet is attached to a socket, we should keep the association as much as possible. Only when a new association needs to be done, skb_orphan() needs to be called. Doing this skb_orphan() too soon breaks back pressure in general, this is bad, since a socket can evades SO_SNDBUF limits. I am not sure why the patch is so complex, I would have simply removed the skb_orphan().