Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp4701072rwl; Mon, 10 Apr 2023 15:39:40 -0700 (PDT) X-Google-Smtp-Source: AKy350YpkLzraTaov6MOWKSN1oZobw7MwfBq+MMYauHzY3nLXojiZiV9jPidtVHpRlxCo+9dRtPj X-Received: by 2002:a05:6a20:b2a4:b0:dd:44a8:9d2c with SMTP id ei36-20020a056a20b2a400b000dd44a89d2cmr11008279pzb.47.1681166380085; Mon, 10 Apr 2023 15:39:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681166380; cv=none; d=google.com; s=arc-20160816; b=GldFdJf7gImnyks25OyKp4105fsqQ6+hsS6qEf3BSEI+UOSEYVgPezlpN9MDXPEmvK axL78spyrkBEPqhRVOMXrd+znmNYc+DW0vIDoNIfYFOZB9MA4K1B/EzC1wEeIW+chY2u ZpJPYMuiLCIJjIKxhbZxIEUef3k8xF4CHAq5pRnKY75qkXMCg1Ou/YAfeesxkDHumFBn 9BHVgAvE6Mdz/Mq9qagsFDi9M/fDaLSirDilsmUWmHYWXb/tjO8n8UIm7KcuPxmEqkoY 0Uizr4rVsiqoiW8zvasxvGhECuAP/APahuFZykCpZnhsZkJxyFUup5sbzN3CIAdRZ96+ /AQw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:dkim-signature:dkim-filter; bh=/lYt8/XY4xRlf2u3bBtJmDZ8TPXQC6ureYYFEZbdOYU=; b=jxCL4M3GMhoq+w7KIs+ZBYaArxmpnWkXvetdtH8g5pCVCk3OyRBdZi782msG63T/Mp CKAeM6LugzHZPeDPmsiPWB2BIO9cxRvlVarCvuM9KxL8owVP10jEo2rXOZ7psrRCI36U fKmeT6XkUqMkLK1i1jujjGiJNyS1HCJxASmvXiSL6iosshzbN0loeOVrjv2qDpSI4TDZ HdJwTUDeUDR1twdikQcZw1AX+iEp9vWxsU3neSe+Kk16TVnlrP5Q31oQSikVs8t+fKRS f+Q6416sfvovH+d/kFeJ/Ze2NfA+/85UlD1G13V5o/I2lVs35xxhoCxgZZq/4/1HQOLq l97w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lwn.net header.s=20201203 header.b=LSndp042; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h30-20020aa79f5e000000b005a8b856ad47si11871516pfr.7.2023.04.10.15.39.28; Mon, 10 Apr 2023 15:39:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@lwn.net header.s=20201203 header.b=LSndp042; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229656AbjDJWiW (ORCPT + 99 others); Mon, 10 Apr 2023 18:38:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34532 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229485AbjDJWiV (ORCPT ); Mon, 10 Apr 2023 18:38:21 -0400 Received: from ms.lwn.net (ms.lwn.net [IPv6:2600:3c01:e000:3a1::42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C7D7E1BCC; Mon, 10 Apr 2023 15:38:20 -0700 (PDT) Received: from localhost (unknown [IPv6:2601:281:8300:73::5f6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ms.lwn.net (Postfix) with ESMTPSA id 566856D9; Mon, 10 Apr 2023 22:38:20 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 ms.lwn.net 566856D9 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lwn.net; s=20201203; t=1681166300; bh=/lYt8/XY4xRlf2u3bBtJmDZ8TPXQC6ureYYFEZbdOYU=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=LSndp042OPJEi1j120AU19XQQQXYjEOwhKVMHzh7KXLHvffiEou/JQ5zIEjVvGrLJ 6NGAqrcWl+kuBJanGgSy5pHmAJGa5Q95FsjIMZN90D6G9ysdV5pJMnyRTm3qXcp1YF tUwPL/BsQu/FKBKCQ2a2wn+iQ7PhP0W8RaffmE5Yd2OpuLIcsTjktf9s0pQ3OSOBht Z3//wpXrcOPY+Qa9zQQcmiyUb4RunnQCKY7VfkhzsBl/4MbsMkx7/ZVK3WEx9JiuM4 BisVkpONIHCPBpUY7DEPk741Ea6sQXoa2YS7rvg48vwSqpSxfm9qI4/Cm+QREtKYsD I3h+Gp84z6DZg== From: Jonathan Corbet To: Feng Tang , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, Randy Dunlap , Bagas Sanjaya , Shakeel Butt , Tim Chen Cc: Arnaldo Carvalho de Melo , Joe Mario , Ingo Molnar , Peter Zijlstra , Linus Torvalds , Andrew Morton , Eric Dumazet , Thomas Gleixner , dave.hansen@intel.com, ying.huang@intel.com, andi.kleen@intel.com, Feng Tang Subject: Re: [PATCH v4] Documentation: Add document for false sharing In-Reply-To: <20230407041235.37886-1-feng.tang@intel.com> References: <20230407041235.37886-1-feng.tang@intel.com> Date: Mon, 10 Apr 2023 16:38:19 -0600 Message-ID: <877cuje52c.fsf@meer.lwn.net> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Feng Tang writes: > When doing performance tuning or debugging performance regressions, > more and more cases are found to be related to false sharing [1][2][3], > and the situation can be worse for newer platforms with hundreds of > CPUs. There are already many commits in current kernel specially > for mitigating the performance degradation due to false sharing. > > False sharing could harm the performance silently without being > noticed, due to reasons like: > * data members of a big data structure randomly sitting together > in one cache line > * global data of small size are linked compactly together > > So it's better to make a simple document about the normal pattern > of false sharing, basic ways to mitigate it and call out to > developers to pay attention during code-writing. > > [ Many thanks to Dave Hansen, Ying Huang, Tim Chen, Julie Du and > Yu Chen for their contributions ] > > [1]. https://lore.kernel.org/lkml/20220619150456.GB34471@xsang-OptiPlex-9020/ > [2]. https://lore.kernel.org/lkml/20201102091543.GM31092@shao2-debian/ > [3]. https://lore.kernel.org/lkml/20230307125538.818862491@linutronix.de/ > > Signed-off-by: Feng Tang > Reviewed-by: Randy Dunlap > Reviewed-by: Shakeel Butt Applied, thanks. jon