From patchwork Fri Apr 17 14:10:23 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Dumazet X-Patchwork-Id: 221100 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.4 required=3.0 tests=DKIMWL_WL_MED, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT, USER_IN_DEF_DKIM_WL autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 71F59C2D0EF for ; Fri, 17 Apr 2020 14:10:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5006A21924 for ; Fri, 17 Apr 2020 14:10:30 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="rswe3m6Z" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730861AbgDQOK3 (ORCPT ); Fri, 17 Apr 2020 10:10:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60560 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730563AbgDQOK2 (ORCPT ); Fri, 17 Apr 2020 10:10:28 -0400 Received: from mail-pg1-x549.google.com (mail-pg1-x549.google.com [IPv6:2607:f8b0:4864:20::549]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6C602C061A0C for ; Fri, 17 Apr 2020 07:10:28 -0700 (PDT) Received: by mail-pg1-x549.google.com with SMTP id c22so591186pgb.7 for ; Fri, 17 Apr 2020 07:10:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:message-id:mime-version:subject:from:to:cc; bh=l/ubaUKeAg8N1Fd1hG4KHPkWsmXk4oxdzdO6tlSczSw=; b=rswe3m6ZkBhYk60C7EqcAsWBxMswWed3fMpumuTLViKJfN04hFuO00WvJ4bS+F45Ng N2kP9rVumzJpgMAHjs+WQufMLkx3S9a4G9VUYWNEey3cdlepQuPsqwFnh1mFT1TZO8WL qf2iw7HHlsoWUDJ8d9MMnA5o3/yCH9dj5dHULJApgmG6N/JvOj1QJvu9xUiuh8HOKX2g Za3vxkWy0i8gh+KzkQXbrclCB4/ibclh4Ps5C5dnCQNohFxvlJ97LW04yIOUwGJ3IaOm tQmg2rUXpngW+skvwYMkzmMpgUB6vek7KbcGiTw87pc+li8dZLChXyOHy3yHsEcghSfy di2g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:message-id:mime-version:subject:from:to:cc; bh=l/ubaUKeAg8N1Fd1hG4KHPkWsmXk4oxdzdO6tlSczSw=; b=iXnApIMd/CO2GroMSIrPksS4W2Ih/ONpPT5f3zewtavfS84MZcBCttL1KaCAahM12n C6+k6KCIxgIttccMHl51FWbybqnyz7YYQujHOxZIiIXAIipPC/u/lKUVkif3FzLX1EN5 OM0Mf/9QUTTJidZHbrB+Hb80QDpWM5OPcT0uPP8MQ8C1hdh5weUPQZ6qzYtoULkb/Kbg lR1hT+pk9Othyh0+J/rqKQ1kjHu3gpOnhLL1sFu/XuWujmmRKgV3QM5wqfMK2aVIAt81 zdKhIPmpVYGCfxeVW96B22I28K82CpgpToW60B86d6wkOaoXxmMJKiJ21GM6OsPlIYaO XVxw== X-Gm-Message-State: AGi0PuZmByVqTDpLTJDe1XR5s/lXR0O1sPC01Or9FuOOZFAgMrbWMgQo Wty63wIs4+r6Q7N2SazHPqAOhVRloXag0g== X-Google-Smtp-Source: APiQypKTwVX6TmSzHsTnQtBfoPl/CRNmbNjUPh1EyI7PsEJ9aGEpfg2Zz1/AZQLVJZw4tfatVCr2rORjsr72/Q== X-Received: by 2002:a17:90a:23ad:: with SMTP id g42mr4487754pje.35.1587132627955; Fri, 17 Apr 2020 07:10:27 -0700 (PDT) Date: Fri, 17 Apr 2020 07:10:23 -0700 Message-Id: <20200417141023.113008-1-edumazet@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.26.1.301.g55bc3eb7cb9-goog Subject: [PATCH net] tcp: cache line align MAX_TCP_HEADER From: Eric Dumazet To: "David S . Miller" Cc: netdev , Eric Dumazet , Eric Dumazet , Soheil Hassas Yeganeh Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org TCP stack is dumb in how it cooks its output packets. Depending on MAX_HEADER value, we might chose a bad ending point for the headers. If we align the end of TCP headers to cache line boundary, we make sure to always use the smallest number of cache lines, which always help. Signed-off-by: Eric Dumazet Cc: Soheil Hassas Yeganeh --- include/net/tcp.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/net/tcp.h b/include/net/tcp.h index 5fa9eacd965a4abd6a4dd5262fa0d439aa9fe64e..dcf9a72eeaa6912202e8a1ca6cf800f7401bf517 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h @@ -51,7 +51,7 @@ extern struct inet_hashinfo tcp_hashinfo; extern struct percpu_counter tcp_orphan_count; void tcp_time_wait(struct sock *sk, int state, int timeo); -#define MAX_TCP_HEADER (128 + MAX_HEADER) +#define MAX_TCP_HEADER L1_CACHE_ALIGN(128 + MAX_HEADER) #define MAX_TCP_OPTION_SPACE 40 #define TCP_MIN_SND_MSS 48 #define TCP_MIN_GSO_SIZE (TCP_MIN_SND_MSS - MAX_TCP_OPTION_SPACE)