From patchwork Tue Jan 29 09:44:14 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jesper Dangaard Brouer X-Patchwork-Id: 216476 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 1B94C2C0080 for ; Tue, 29 Jan 2013 20:40:50 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753481Ab3A2Jkp (ORCPT ); Tue, 29 Jan 2013 04:40:45 -0500 Received: from mx1.redhat.com ([209.132.183.28]:22616 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752100Ab3A2Jko (ORCPT ); Tue, 29 Jan 2013 04:40:44 -0500 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r0T9dpao002852 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 29 Jan 2013 04:39:51 -0500 Received: from dragon.localdomain (ovpn-116-81.ams2.redhat.com [10.36.116.81]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r0T9doRd004336; Tue, 29 Jan 2013 04:39:50 -0500 Received: from [127.0.0.1] (localhost [IPv6:::1]) by dragon.localdomain (Postfix) with ESMTP id E46BDE406E9; Tue, 29 Jan 2013 10:44:14 +0100 (CET) From: Jesper Dangaard Brouer Subject: [net-next PATCH V2 1/6] net: cacheline adjust struct netns_frags for better frag performance To: Eric Dumazet , "David S. Miller" , Florian Westphal Cc: Jesper Dangaard Brouer , netdev@vger.kernel.org, Pablo Neira Ayuso , Cong Wang , "Patrick McHardy" , Herbert Xu , Daniel Borkmann Date: Tue, 29 Jan 2013 10:44:14 +0100 Message-ID: <20130129094406.13513.80799.stgit@dragon> In-Reply-To: <20130129094331.13513.28377.stgit@dragon> References: <20130129094331.13513.28377.stgit@dragon> User-Agent: StGIT/0.14.3 MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org This small cacheline adjustment of struct netns_frags improves performance significantly for the fragmentation code. Struct members 'lru_list' and 'mem' are both hot elements, and it hurts performance, due to cacheline bouncing at every call point, when they share a cacheline. Also notice, how mem is placed together with 'high_thresh' and 'low_thresh', as they are used in the compare operations together. Signed-off-by: Jesper Dangaard Brouer --- include/net/inet_frag.h | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/include/net/inet_frag.h b/include/net/inet_frag.h index 32786a0..91e7797 100644 --- a/include/net/inet_frag.h +++ b/include/net/inet_frag.h @@ -3,9 +3,12 @@ struct netns_frags { int nqueues; - atomic_t mem; struct list_head lru_list; + /* Its important for performance to keep lru_list and mem on + * separate cachelines + */ + atomic_t mem ____cacheline_aligned_in_smp; /* sysctls */ int timeout; int high_thresh;