From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id AE867A2EDB for ; Wed, 2 Oct 2019 10:15:51 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id B59C81B9A9; Wed, 2 Oct 2019 10:15:50 +0200 (CEST) Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) by dpdk.org (Postfix) with ESMTP id 6AFCD1B94D for ; Wed, 2 Oct 2019 10:15:49 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1570004148; 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=Gj+XdkCtKRrN9n2XxPYX8ASX0cF8h9FlR4CR54RSuTM=; b=gfA9o3D9gk9Ic++mXAXg9EvOiyzcttyOTeiCWklyfhsqsNzDcNAUCqeuznusojB0YVGQp3 70JzukNKsnuL0J8zaqaSOcurxHKbVguQIbhefxbHVN900JPDs+pzmAVhnCwZpOgXTCo2W/ UuahS208Lmsa0OunPsPR8BosBY1lDbA= Received: from mail-vk1-f200.google.com (mail-vk1-f200.google.com [209.85.221.200]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-304-87f4j8IgO0mwjvviSvI1Xg-1; Wed, 02 Oct 2019 04:15:46 -0400 Received: by mail-vk1-f200.google.com with SMTP id a7so9264630vkg.2 for ; Wed, 02 Oct 2019 01:15:46 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=A1gEFRZoOtInVNqCgj9hb80Cp5IPvdsIt6fSa0g/C1I=; b=qrK0+qcL39aUKDvWd39nurEkc2bo2RhAXrNHPNfbouSAtRnGUDRauHRg1GSk7cT4ZU Yw6Y3XlClWETDHhjDk+OXUnaebXWj+ciE6gtrcTFbOFEOt1/mdjIaxKGhfHjQHj1ItcV 06OFHIWdb2yonQUmz/Vi0SwZ714FwaZ5065DU5Xi6of58YNjMZ82xbJWD0HXrcX+ZhSS HoYH4av5krNp7z/VKZhHD0aZ5FE7rj3VyJgHtgc7iZZkNXDAjvDTbA8mH2tJBIJUGAQB ost96PgdTwoOJw07RiNwzgsYg9Hgq4vf3JZ5LiVULBWpGk1/SKbWQuEVlSI+jtb9pJtS EepQ== X-Gm-Message-State: APjAAAXw+Q2W2JKxQR7Ly5D6sHXJJMSZrCr/oWQW1YcYtBPEEf7yupUQ d0/Lxhbo94k1Zg0MVh2AHhphZVQ+S1aVgZOsJV28EzdmST1z+TfX7FBuEY009Qh5tV/lzW2GK9b 5SrOsjctf7ctbd2uDNHo= X-Received: by 2002:a67:be15:: with SMTP id x21mr1105915vsq.141.1570004145636; Wed, 02 Oct 2019 01:15:45 -0700 (PDT) X-Google-Smtp-Source: APXvYqwEhjcLzTOAJBdDRfjdNyEK+52/JW6Y+W9a29p/4VtUfPmTsZCn6hIyUnvxC7kbBp4qMlL0U5xQMdDUB4YUoR8= X-Received: by 2002:a67:be15:: with SMTP id x21mr1105912vsq.141.1570004145324; Wed, 02 Oct 2019 01:15:45 -0700 (PDT) MIME-Version: 1.0 References: <20190925161013.3656-1-stephen@networkplumber.org> In-Reply-To: <20190925161013.3656-1-stephen@networkplumber.org> From: David Marchand Date: Wed, 2 Oct 2019 10:15:34 +0200 Message-ID: To: Stephen Hemminger Cc: dev X-MC-Unique: 87f4j8IgO0mwjvviSvI1Xg-1 X-Mimecast-Spam-Score: 0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [dpdk-dev] [PATCH v7] eal: make lcore_config private X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Thanks for working on this. On Wed, Sep 25, 2019 at 6:10 PM Stephen Hemminger wrote: > > The internal structure of lcore_config is no longer be part of > visible API/ABI. Make it private to EAL. > > Rearrange and resize the fields in the structure so it takes > less memory (and cache footprint). This patch is missing the release notes update. > > Signed-off-by: Stephen Hemminger > --- > v7 - add eal_private.h to windows > > lib/librte_eal/common/eal_common_launch.c | 2 ++ > lib/librte_eal/common/eal_private.h | 22 +++++++++++++++++++++ > lib/librte_eal/common/include/rte_lcore.h | 24 ----------------------- > lib/librte_eal/common/rte_service.c | 2 ++ > lib/librte_eal/rte_eal_version.map | 1 - > lib/librte_eal/windows/eal/eal_thread.c | 1 + > 6 files changed, 27 insertions(+), 25 deletions(-) > > diff --git a/lib/librte_eal/common/eal_common_launch.c b/lib/librte_eal/c= ommon/eal_common_launch.c > index fe0ba3f0d617..cf52d717f68e 100644 > --- a/lib/librte_eal/common/eal_common_launch.c > +++ b/lib/librte_eal/common/eal_common_launch.c > @@ -15,6 +15,8 @@ > #include > #include > > +#include "eal_private.h" > + > /* > * Wait until a lcore finished its job. > */ > diff --git a/lib/librte_eal/common/eal_private.h b/lib/librte_eal/common/= eal_private.h > index 798ede553b21..25e80547904f 100644 > --- a/lib/librte_eal/common/eal_private.h > +++ b/lib/librte_eal/common/eal_private.h > @@ -10,6 +10,28 @@ > #include > > #include > +#include > + > +/** > + * Structure storing internal configuration (per-lcore) > + */ > +struct lcore_config { > + uint32_t core_id; /**< core number on socket for this lcore = */ > + uint32_t core_index; /**< relative index, starting from 0 */ > + uint16_t socket_id; /**< physical socket id for this lcore */ > + uint8_t core_role; /**< role of core eg: OFF, RTE, SERVIC= E */ > + uint8_t detected; /**< true if lcore was detected */ > + volatile enum rte_lcore_state_t state; /**< lcore state */ > + rte_cpuset_t cpuset; /**< cpu set which the lcore affinity = to */ > + pthread_t thread_id; /**< pthread identifier */ > + int pipe_master2slave[2]; /**< communication pipe with master */ > + int pipe_slave2master[2]; /**< communication pipe with master */ > + lcore_function_t * volatile f; /**< function to call */ > + void * volatile arg; /**< argument of function */ > + volatile int ret; /**< return value of function */ > +}; > + > +extern struct lcore_config lcore_config[RTE_MAX_LCORE]; Everything but cpuset can fit in a cache line. You could just move the cpuset field at the end of the structure and change detected to uint8_t. This gives the following layout: struct lcore_config { pthread_t thread_id; /* 0 8 */ int pipe_master2slave[2]; /* 8 8 */ int pipe_slave2master[2]; /* 16 8 */ volatile lcore_function_t * f; /* 24 8 */ volatile void * arg; /* 32 8 */ volatile int ret; /* 40 4 */ volatile enum rte_lcore_state_t state; /* 44 4 */ unsigned int socket_id; /* 48 4 */ unsigned int core_id; /* 52 4 */ int core_index; /* 56 4 */ uint8_t detected; /* 60 1 */ uint8_t core_role; /* 61 1 */ /* XXX 2 bytes hole, try to pack */ /* --- cacheline 1 boundary (64 bytes) --- */ rte_cpuset_t cpuset; /* 64 128 */ /* --- cacheline 3 boundary (192 bytes) --- */ /* size: 192, cachelines: 3, members: 13 */ /* sum members: 190, holes: 1, sum holes: 2 */ }; The resulting structure is only two bytes bigger than your proposal and does not touch existing integer types (avoiding the risk of some integer conversion on socket_id for example). --=20 David Marchand