Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 18FAFC64EC7 for ; Tue, 28 Feb 2023 21:31:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229834AbjB1Vbr (ORCPT ); Tue, 28 Feb 2023 16:31:47 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47096 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229511AbjB1Vbp (ORCPT ); Tue, 28 Feb 2023 16:31:45 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D240D31E17; Tue, 28 Feb 2023 13:31:42 -0800 (PST) From: Thomas Gleixner DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1677619901; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=XULtfbjBIz1FOvEFn9iDb0SfXe5T/4fLkxxvSGAFW0M=; b=tic/nKZ149irgSP9iKVwHFJbfKbDi1D3UVaBOOE5QP9GTFjHwjR4I22PZtg+dMHF+LxcSf OIfzB61ntCyQoFy8Y70esCCND+3tmhntLmjFkaaNjUq7i2a4MuMwT/6QnOoxQ1lgGiqcZv Z4LZQDIRaskUEC6ttIFYLr6sP0TXdCN5RAqKN10kDbeLODrGk6S9hesy/dMfYrOimHJet1 8Am2Bf3MCx7A9c4X9lFep+YfNU3O/a33UbnXEF7T4m69hPvWglbMVCF0RWJza2kew5APOS XHZp5rQ+vlsCINlAofqxvD6ZD0fmwTSGaFY2dK8MYz8PUZIR2Jc4wk4CSmkIuA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1677619901; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=XULtfbjBIz1FOvEFn9iDb0SfXe5T/4fLkxxvSGAFW0M=; b=FM2gRf0I7HrFgzvT8zYbO5Zsn1H8mTbWPNmrKRvIQhH6Id5COoNLHZ8v/28GX5CW0M3aRQ bcbZ7I26FKTlodBw== To: Eric Dumazet Cc: LKML , Linus Torvalds , x86@kernel.org, Wangyang Guo , Arjan van De Ven , "David S. Miller" , Jakub Kicinski , Paolo Abeni , netdev@vger.kernel.org, Will Deacon , Peter Zijlstra , Boqun Feng , Mark Rutland , Marc Zyngier Subject: Re: [patch 1/3] net: dst: Prevent false sharing vs. dst_entry::__refcnt In-Reply-To: References: <20230228132118.978145284@linutronix.de> <20230228132910.934296889@linutronix.de> Date: Tue, 28 Feb 2023 22:31:40 +0100 Message-ID: <875yblmq83.ffs@tglx> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Eric! On Tue, Feb 28 2023 at 16:17, Eric Dumazet wrote: > On Tue, Feb 28, 2023 at 3:33=E2=80=AFPM Thomas Gleixner wrote: >> perf top identified two affected read accesses. dst_entry::lwtstate and >> rtable::rt_genid. >> >> dst_entry:__refcnt is located at offset 64 of dst_entry, which puts it i= nto >> a seperate cacheline vs. the read mostly members located at the beginning >> of the struct. > > This will probably increase struct rt6_info past the 4 cache line > size, right ? pahole says: /* size: 256, cachelines: 4, members: 11 */ > It would be nice to allow sharing the 'hot' cache line with seldom > used fields. Sure. > Instead of mere pads, add some unions, and let rt6i_uncached/rt6i_uncache= d_list > use them. If I understand correctly, you suggest to move rt6_info::rt6i_uncached[_list], rtable::rt_uncached[_list] =20=20=20 into struct dst_entry and fixup the usage sites, right? I don't see why that would need a union. dst_entry::rt_uncached[_list] would work for both, no? Thanks, tglx