Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp247890imj; Thu, 7 Feb 2019 03:46:51 -0800 (PST) X-Google-Smtp-Source: AHgI3IakT0QiLjAd9DmMH9BzRzrLwy/VwSCfLQ8ahGRY7DIdoGOhnAk/LN1E7zgp9bE9QuUsd90q X-Received: by 2002:a17:902:7598:: with SMTP id j24mr16140580pll.7.1549540011088; Thu, 07 Feb 2019 03:46:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549540011; cv=none; d=google.com; s=arc-20160816; b=gZHb2RnWD8ogWGybLuC/R8hmuD0xBuwuHZg+g3KaaUjOK55kPDiNeh2eMiyn6e04Ka ID0cTomBmbS+g9yLR31Xi58uLpRXqk5OKyJoHQ3UMUEpHlt3kGE8p2rRZntL1QWVjQTy +Rci3ns6W7QH2GbjUwH9epgQEO7AM2i8HSZuYGO+RU2Y4F86oADtgm+P9kcWHABhVp63 DvrxtqKw5jKznwUHYWnz7OLohbud1Ay/54RwbaznIVOSLKFvTNaP8/3fB6VaXU9aSwZR UC5TWWGKo8pHnHx+OOLJx6rz/oZcJkr+MQkaRS6tAvncc+5z5deZy8uOI+ztv3CqN9ng Yj7Q== 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=IqB5sF2Z3bvY3/g8ecGwCLQBcr1wbHPdcUUCu5rUNyU=; b=ScsZiEVQpxy7EGQmo49P4wpY2cva9T4Gk8NfmzZJWHqMa8yGzW4eGKMRJBsJXzMp9g jlrDgRcs0ka91+cwddvXN5P1Bv3VRbmsbBOBwYIKnkAnqQzhD1GC8zZIhkJgBDZC9XWy fpuVvjn2iUnlagsEBo/fGC1GCl3pjcU9Oj3yCrtkERPObhBHztna/uNSE1X5530xCuZn znPkcdwvzIGylOe7NwzuTdhWERCfDHNT3iQnU87EeL+E8aDbZRIka3kIjtL71s0DMqX6 uHUNWe/2XVf8gQ+/LJENLsqsE4uT57EdwjE4LPjkNqKpuvWj75UAmZxC8FK4DCNC4RK/ xdeg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=y4dCLTtk; 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 z63si8770844pfz.132.2019.02.07.03.46.35; Thu, 07 Feb 2019 03:46:51 -0800 (PST) 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=y4dCLTtk; 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 S1727273AbfBGLnB (ORCPT + 99 others); Thu, 7 Feb 2019 06:43:01 -0500 Received: from mail.kernel.org ([198.145.29.99]:33090 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727249AbfBGLm7 (ORCPT ); Thu, 7 Feb 2019 06:42:59 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (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 C424721904; Thu, 7 Feb 2019 11:42:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1549539778; bh=7RNYN+uRtxRQ7agnUfIJ7uzbPpJGK5QJNVm2RN+mbe0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=y4dCLTtkMQALaWDpCiqdDcfbLrobVEW5Pg0l3fKbWXMBOHraIltM8KyzA3N3aXjkr X1XmTmoycD1eiuFf6Ss7ZbkS3xxuQ9win+qqdKaBb3tfnQ6DgVmWzK3sGZ13lJnnxL jdyTBnmShtOe7XFsK4Pkog3de5y6kK0ggr79cWbk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Eric Dumazet , "David S. Miller" , Ben Hutchings Subject: [PATCH 4.4 20/34] inet: frags: get rid of ipfrag_skb_cb/FRAG_CB Date: Thu, 7 Feb 2019 12:42:02 +0100 Message-Id: <20190207113026.358197610@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190207113025.552605181@linuxfoundation.org> References: <20190207113025.552605181@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore 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.4-stable review patch. If anyone has any objections, please let me know. ------------------ From: Eric Dumazet commit bf66337140c64c27fa37222b7abca7e49d63fb57 upstream. 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 Signed-off-by: Ben Hutchings 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 @@ -558,6 +558,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;