Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp4537854imm; Mon, 17 Sep 2018 16:06:02 -0700 (PDT) X-Google-Smtp-Source: ANB0VdbKAvzIfXfAZFqvhIbe5CnKG1mNzLDy8X0/wjOF5+9Rlkp9/2/cFrvrb/O6exNb6Ql7gL/h X-Received: by 2002:a17:902:4381:: with SMTP id j1-v6mr26021004pld.227.1537225562380; Mon, 17 Sep 2018 16:06:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537225562; cv=none; d=google.com; s=arc-20160816; b=FEm2v+CUlflsdAahlT+q+/JnaLYMvOV4kzs9n+CJtWcesQen/0tcNdQlbZBPSK1j3+ 90pMSPikQGjrSHREjmutcH4xwe+DAdvitgGNutLyL6bUj0IurpXaDz5S6KmOVVLaKiBH w28Ey45ETcqdAmVoMZy3ZjdkrXyLbPZQSrOUZ0MOsZkEYzoLeMszqG+Z7OONwH6N453X p/FGEVKbs/L1S9nqcHKk9s3nn4CunSQUesh8GJMFp10UKfbq2e36bvwBRZjP39tl5VV6 Ilv4jAJVryuDSYybxdwSgCY2uhIDiGckAX6gsTXGefbEUCpFcjf1UbPcjVm3rdFOVfHh kM1g== 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; bh=Mpwx+7MHH4OVPU49bAbUBe/quVeTenb+lvZXPLQGKb0=; b=kXyvGl0b+4BxHUT+hvWg86389eZ+AKKhg904HGeyo8y4jCrEvypmviXVYN6i3La+vw 33WUhacdoEdOLX4OG3k1zUIetRXID+eVYH7+2OkUjhqPawpvP29mouUA/WcJa4T5+OMC WZvLQKY+U/AiyDeXWtIzsM3rGlU7QrIzQ/pEQ0G0Sx7aY74TnPknRjwyKgckkXqBWWvS wvvqkus0mN8MZQ3NbyMM1kXPPM8kUe8jEpMG6zcNAoFubPF09Pik94NcTO/lCpCkvi3j AHoNBl3mUaEcOvoMVsfvp3eDBcpm+W16xI/XvRWoQ/scxC19+mniwBafYoGhIDELiua0 fvnA== ARC-Authentication-Results: i=1; mx.google.com; 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 w71-v6si15683679pgd.362.2018.09.17.16.05.47; Mon, 17 Sep 2018 16:06:02 -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; 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 S1731098AbeIREex (ORCPT + 99 others); Tue, 18 Sep 2018 00:34:53 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:49310 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731087AbeIREew (ORCPT ); Tue, 18 Sep 2018 00:34:52 -0400 Received: from localhost (li1825-44.members.linode.com [172.104.248.44]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id D880BC77; Mon, 17 Sep 2018 23:05:23 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Eric Dumazet , "David S. Miller" Subject: [PATCH 4.14 107/126] rhashtable: reorganize struct rhashtable layout Date: Tue, 18 Sep 2018 00:42:35 +0200 Message-Id: <20180917211710.991475116@linuxfoundation.org> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20180917211703.481236999@linuxfoundation.org> References: <20180917211703.481236999@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.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Eric Dumazet While under frags DDOS I noticed unfortunate false sharing between @nelems and @params.automatic_shrinking Move @nelems at the end of struct rhashtable so that first cache line is shared between all cpus, because almost never dirtied. Signed-off-by: Eric Dumazet Signed-off-by: David S. Miller (cherry picked from commit e5d672a0780d9e7118caad4c171ec88b8299398d) Signed-off-by: Greg Kroah-Hartman --- include/linux/rhashtable.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) --- a/include/linux/rhashtable.h +++ b/include/linux/rhashtable.h @@ -152,25 +152,25 @@ struct rhashtable_params { /** * struct rhashtable - Hash table handle * @tbl: Bucket table - * @nelems: Number of elements in table * @key_len: Key length for hashfn - * @p: Configuration parameters * @max_elems: Maximum number of elements in table + * @p: Configuration parameters * @rhlist: True if this is an rhltable * @run_work: Deferred worker to expand/shrink asynchronously * @mutex: Mutex to protect current/future table swapping * @lock: Spin lock to protect walker list + * @nelems: Number of elements in table */ struct rhashtable { struct bucket_table __rcu *tbl; - atomic_t nelems; unsigned int key_len; - struct rhashtable_params p; unsigned int max_elems; + struct rhashtable_params p; bool rhlist; struct work_struct run_work; struct mutex mutex; spinlock_t lock; + atomic_t nelems; }; /**