Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp5452190imm; Tue, 16 Oct 2018 10:25:47 -0700 (PDT) X-Google-Smtp-Source: ACcGV63QLBHJd2VoqFsbWF6/Ss7L4Hlc6YT4+YC6sf9JoAO7+7/dJTIii4I4xOoshtl3habVGNSd X-Received: by 2002:a63:6d83:: with SMTP id i125-v6mr20421115pgc.215.1539710747453; Tue, 16 Oct 2018 10:25:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539710747; cv=none; d=google.com; s=arc-20160816; b=tJCXtJv/v1Ixo+OpQqOJKCP01dLNKx9UXIjve2j1JCsnvbzNVminL0RHBPuqwadY3B srz7zJfQh+3icgQbmH1GY6ft2Bt6o83ZXR+BukCyBKcTfZ1uBGbZt1JqB3pE2erApddr 1CF7MWMKSnsSfGmSNJsJmONpS7uHMnM9cEsGWB01DD/Zeyvr5KGw2t/SAz/KrrBHKobK X3+LwHyHFJ40nlDVH9wDJ+FlA8IXSYc9+MMNueGVVqMBQ4KTCTsH1DRt1Ca1SCT+n3Mf nC+gyvt/mpg8iG6uk/fs8kz/9ymOHOPl4L7LF5OC1zvhIPNg+e6kSsvZtqjsJfNFr3Zf WqKw== 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=l9MTOFc6fKCGSbuBoYA0BoXmCS0GfKN4eNwptZRNVEc=; b=dEaIgqe0SxJgNMJye46sf1IirY08h5QVPchniqip4CwRwVPUnrWX1sx9spA29Zak7N eWi62/cjiTc+QbmCAly43tcuolsSIEYPstg9Qj/xQCBAN0ShvBLgifXjCfpxCgV4wlnz V2b8YLdEBs+G0IKhsc1GN7mybx3TQiVFVe2pwLRIVTVJoKS6LS2itquIIysqpuJIZWxQ 7tbfVYzdTJcTD8tiksMEChsXRS7NpNIsK65fas8O0L6O0I+0cklL2CDmHYoAosIhR0Qa AVumhSS9RuBC9uVxNOkkZRATvhXXVDHT7WDOmeFj7xhBT8/Yj4ZEn28Wus8BX/h+BtE5 hKBg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=i4ax68rA; 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 g27-v6si13843384pfj.37.2018.10.16.10.25.31; Tue, 16 Oct 2018 10:25:47 -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=i4ax68rA; 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 S1731814AbeJQBQT (ORCPT + 99 others); Tue, 16 Oct 2018 21:16:19 -0400 Received: from mail.kernel.org ([198.145.29.99]:35038 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730396AbeJQBQS (ORCPT ); Tue, 16 Oct 2018 21:16:18 -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 A7FD420658; Tue, 16 Oct 2018 17:24:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1539710692; bh=q/ZqAPODWuFhzaoSc9mdOCZVLhG9//5r99SyhUlS3fw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=i4ax68rANEZh/5xIhZb3eBDh8uX4DjVVOUxPhhmJHPHkvMYjJhopeoKpElhhULGgK BlDO1wn7Q5TG6RwYH3prz3mR8wqgb9Yb1xqAVWH/50vgU/7dMZsjsMyKZW2w4Jdmmd HOpvcZ2R/dKtAwYkhfl7lsaPNwT16dtamYXojn50= 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 57/71] rhashtable: reorganize struct rhashtable layout Date: Tue, 16 Oct 2018 19:09:54 +0200 Message-Id: <20181016170542.218605806@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 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 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/include/linux/rhashtable.h +++ b/include/linux/rhashtable.h @@ -138,7 +138,6 @@ struct rhashtable_params { /** * struct rhashtable - Hash table handle * @tbl: Bucket table - * @nelems: Number of elements in table * @key_len: Key length for hashfn * @elasticity: Maximum chain length before rehash * @p: Configuration parameters @@ -146,10 +145,10 @@ struct rhashtable_params { * @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; unsigned int elasticity; struct rhashtable_params p; @@ -157,6 +156,7 @@ struct rhashtable { struct work_struct run_work; struct mutex mutex; spinlock_t lock; + atomic_t nelems; }; /**