From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 11F4D430FC; Fri, 25 Aug 2023 08:45:18 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0160B40A7A; Fri, 25 Aug 2023 08:45:18 +0200 (CEST) Received: from dkmailrelay1.smartsharesystems.com (smartserver.smartsharesystems.com [77.243.40.215]) by mails.dpdk.org (Postfix) with ESMTP id 179B640695 for ; Fri, 25 Aug 2023 08:45:16 +0200 (CEST) Received: from smartserver.smartsharesystems.com (smartserver.smartsharesys.local [192.168.4.10]) by dkmailrelay1.smartsharesystems.com (Postfix) with ESMTP id E924C20433; Fri, 25 Aug 2023 08:45:15 +0200 (CEST) Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Subject: cache thrashing question X-MimeOLE: Produced By Microsoft Exchange V6.5 Date: Fri, 25 Aug 2023 08:45:12 +0200 Message-ID: <98CBD80474FA8B44BF855DF32C47DC35D87B39@smartserver.smartshare.dk> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: cache thrashing question Thread-Index: AdnXH7KYiGVIDvPCQAa99twQayHCJg== From: =?iso-8859-1?Q?Morten_Br=F8rup?= To: Cc: X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Bruce, With this patch [1], it is noted that the ring producer and consumer = data should not be on adjacent cache lines, for performance reasons. [1]: = https://git.dpdk.org/dpdk/commit/lib/librte_ring/rte_ring.h?id=3Dd9f0d3a1= ffd4b66e75485cc8b63b9aedfbdfe8b0 (It's obvious that they cannot share the same cache line, because they = are accessed by two different threads.) Intuitively, I would think that having them on different cache lines = would suffice. Why does having an empty cache line between them make a = difference? And does it need to be an empty cache line? Or does it suffice having = the second structure start at two cache lines after the start of the = first structure (e.g. if the size of the first structure is two cache = lines)? I'm asking because the same principle might apply to other code too. Med venlig hilsen / Kind regards, -Morten Br=F8rup