Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp5452010imm; Tue, 16 Oct 2018 10:25:37 -0700 (PDT) X-Google-Smtp-Source: ACcGV62zQlkGSY4LWv/fRCbaeC1rcnMjE7cT+mbF3hMo2ynsnyqS+SEj7Wp0wsa5YvsohenH5WWi X-Received: by 2002:a63:5ec5:: with SMTP id s188-v6mr21033313pgb.126.1539710737511; Tue, 16 Oct 2018 10:25:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539710737; cv=none; d=google.com; s=arc-20160816; b=toiJzdE2dNw4O+f7i+eiH3hGfY1cHDUXd0leuhxdYOn2kf1nOdPbmmYYAtabyT4Bqw PfOxB4T5xTbocf6EKoVoGVgPNKn1eIQ3g07YqsG+CFApD2INjQXLISilUx9gZzw4ZMXz CWpEhHcehn+NWbY8MFK5NfftUxRFuT43prUceI5eMAS2mmlFv9vXVcZ/OPjo/KTpYPvr VKEvJivMO6iZ6Bqi+UDjZhtJD0rcFF6XEwVREyTbY86LmN0TnhPCF4FwcgATnscTfywn 1/r6Pvx9nMRhZGfegqypYxJVESmrLNm0fuqyjQSRsD9gH46DDQJQiLEGUFHASk7PCL7a PmpA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=W0bbhwuZsPnHIrQbny1Y3WHx7GlEy+UZwDqARxcvjhM=; b=p/1r6jsBNKV97ScspvEcQk9iFjYP7vFXHMBnpN7cUPJGSjU0YvbDyUlZE0NzrIYdk4 W+slE6otSOT/eOyjpZMde2jQx3gJFaZMruveUNt+1vKxZV67InuW+J0b465Ci6XS7wHI hNHK2tzp0avENi7aaX2K0qXs7rx8i43hpJ+usAb8CdzvjGd4a3PtS7rdfBdMXUBpljFZ 0qbNTqP5UKYE0OqgfZ7FEBaVW9ATC9F6XY9maXp88xZzYAYsI4bs2n2c0eZeiIDkwg01 Spa1RFP5wtTIe74Zz98qCbef8JbDSOHXbIwL/Wt/sXT1vrrliLCVwWC4TEKU3ioCS0Nl ctGw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=wlWZD+se; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 207-v6si13808091pgf.245.2018.10.16.10.25.21; Tue, 16 Oct 2018 10:25:37 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=wlWZD+se; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731850AbeJQBQZ (ORCPT + 99 others); Tue, 16 Oct 2018 21:16:25 -0400 Received: from mail.kernel.org ([198.145.29.99]:35142 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730396AbeJQBQY (ORCPT ); Tue, 16 Oct 2018 21:16:24 -0400 Received: from localhost (ip-213-127-77-176.ip.prioritytelecom.net [213.127.77.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 068B320658; Tue, 16 Oct 2018 17:24:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1539710698; bh=2DtYbCb6d3gF5tRg6tJrig58Vchbqfu2lEjBBNb6H70=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wlWZD+seQrHa0hhAHMLz6vxLsUenLS30m9LDKxnGPIR2BD8wnOPe/dp92bSj5MvxY bH8KIRslkinXIp4uUY8hSxZFxr2dsCVJ8vVASkpZ1tzbSBSNPvLvO09yVikZzgqWjg RFZqeU6klf52Ux0MKfDcUp2v2lrE5+OIPfIIEsfY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org, netdev@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Eric Dumazet , "David S. Miller" Subject: [PATCH 4.9 59/71] inet: frags: get rid of ipfrag_skb_cb/FRAG_CB Date: Tue, 16 Oct 2018 19:09:56 +0200 Message-Id: <20181016170542.323641535@linuxfoundation.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181016170539.315587743@linuxfoundation.org> References: <20181016170539.315587743@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.9-stable review patch. If anyone has any objections, please let me know. ------------------ From: Eric Dumazet ip_defrag uses skb->cb[] to store the fragment offset, and unfortunately this integer is currently in a different cache line than skb->next, meaning that we use two cache lines per skb when finding the insertion point. By aliasing skb->ip_defrag_offset and skb->dev, we pack all the fields in a single cache line and save precious memory bandwidth. Note that after the fast path added by Changli Gao in commit d6bebca92c66 ("fragment: add fast path for in-order fragments") this change wont help the fast path, since we still need to access prev->len (2nd cache line), but will show great benefits when slow path is entered, since we perform a linear scan of a potentially long list. Also, note that this potential long list is an attack vector, we might consider also using an rb-tree there eventually. Signed-off-by: Eric Dumazet Signed-off-by: David S. Miller (cherry picked from commit bf66337140c64c27fa37222b7abca7e49d63fb57) Signed-off-by: Greg Kroah-Hartman --- include/linux/skbuff.h | 5 +++++ 1 file changed, 5 insertions(+) --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h @@ -645,6 +645,11 @@ struct sk_buff { }; struct rb_node rbnode; /* used in netem & tcp stack */ }; + + union { + int ip_defrag_offset; + }; + struct sock *sk; struct net_device *dev;