From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <anatoly.burakov@intel.com>
Received: from mga01.intel.com (mga01.intel.com [192.55.52.88])
 by dpdk.org (Postfix) with ESMTP id 2366B2952
 for <dev@dpdk.org>; Tue,  2 Oct 2018 11:03:40 +0200 (CEST)
X-Amp-Result: SKIPPED(no attachment in message)
X-Amp-File-Uploaded: False
Received: from fmsmga004.fm.intel.com ([10.253.24.48])
 by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;
 02 Oct 2018 02:03:40 -0700
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="5.54,331,1534834800"; d="scan'208";a="93840361"
Received: from unknown (HELO [10.237.220.113]) ([10.237.220.113])
 by fmsmga004.fm.intel.com with ESMTP; 02 Oct 2018 02:03:36 -0700
To: Stephen Hemminger <stephen@networkplumber.org>
Cc: dev@dpdk.org, John McNamara <john.mcnamara@intel.com>,
 Marko Kovacevic <marko.kovacevic@intel.com>,
 Bruce Richardson <bruce.richardson@intel.com>,
 laszlo.madarassy@ericsson.com, laszlo.vadkerti@ericsson.com,
 andras.kovacs@ericsson.com, winnie.tian@ericsson.com,
 daniel.andrasi@ericsson.com, janos.kobor@ericsson.com,
 geza.koblo@ericsson.com, srinath.mannam@broadcom.com,
 scott.branden@broadcom.com, ajit.khaparde@broadcom.com,
 keith.wiles@intel.com, thomas@monjalon.net, shreyansh.jain@nxp.com,
 shahafs@mellanox.com, arybchenko@solarflare.com,
 alejandro.lucero@netronome.com
References: <cover.1538398379.git.anatoly.burakov@intel.com>
 <be28865619fec52cb5456bb69cfed18a4aa85569.1538398379.git.anatoly.burakov@intel.com>
 <20181001190109.2b71f3d0@shemminger-XPS-13-9360>
From: "Burakov, Anatoly" <anatoly.burakov@intel.com>
Message-ID: <bc0fc130-5cc8-f8c1-fb02-0f924fe69bbe@intel.com>
Date: Tue, 2 Oct 2018 10:03:35 +0100
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101
 Thunderbird/52.9.1
MIME-Version: 1.0
In-Reply-To: <20181001190109.2b71f3d0@shemminger-XPS-13-9360>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Language: en-US
Content-Transfer-Encoding: 7bit
Subject: Re: [dpdk-dev] [PATCH v8 01/21] mem: add length to memseg list
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Tue, 02 Oct 2018 09:03:41 -0000

On 01-Oct-18 6:01 PM, Stephen Hemminger wrote:
> On Mon,  1 Oct 2018 13:56:09 +0100
> Anatoly Burakov <anatoly.burakov@intel.com> wrote:
> 
>> diff --git a/lib/librte_eal/common/include/rte_eal_memconfig.h b/lib/librte_eal/common/include/rte_eal_memconfig.h
>> index aff0688dd..1d8b0a6fe 100644
>> --- a/lib/librte_eal/common/include/rte_eal_memconfig.h
>> +++ b/lib/librte_eal/common/include/rte_eal_memconfig.h
>> @@ -30,6 +30,7 @@ struct rte_memseg_list {
>>   		uint64_t addr_64;
>>   		/**< Makes sure addr is always 64-bits */
>>   	};
>> +	size_t len; /**< Length of memory area covered by this memseg list. */
>>   	int socket_id; /**< Socket ID for all memsegs in this list. */
>>   	uint64_t page_sz; /**< Page size for all memsegs in this list. */
>>   	volatile uint32_t version; /**< version number for multiprocess sync. */
> 
> If you are going to break ABI, why not try and rearrange to eliminate holes:
> 
> Output of pahole (on x86 64 bit):
> 
> struct rte_memseg_list {
> 	union {
> 		void *             base_va;              /*     0     8 */
> 		uint64_t           addr_64;              /*     0     8 */
> 	};                                               /*     0     8 */
> 	size_t                     len;                  /*     8     8 */
> 	int                        socket_id;            /*    16     4 */
> 
> 	/* XXX 4 bytes hole, try to pack */
> 
> 	uint64_t                   page_sz;              /*    24     8 */
> 	volatile uint32_t          version;              /*    32     4 */
> 
> 	/* XXX 4 bytes hole, try to pack */
> 
> 	struct rte_fbarray         memseg_arr;           /*    40    96 */
> 
> 	/* XXX last struct has 4 bytes of padding */
> 
> 	/* size: 136, cachelines: 3, members: 6 */
> 	/* sum members: 128, holes: 2, sum holes: 8 */
> 	/* paddings: 1, sum paddings: 4 */
> 	/* last cacheline: 8 bytes */
> };
> 

Hi Stephen,

This data structure isn't performance-critical in any remote sense, but 
sure, I can do that.

-- 
Thanks,
Anatoly