[dpdk-dev] [PATCH v8 01/21] mem: add length to memseg list

Burakov, Anatoly anatoly.burakov at intel.com
Tue Oct 2 11:03:35 CEST 2018


On 01-Oct-18 6:01 PM, Stephen Hemminger wrote:
> On Mon,  1 Oct 2018 13:56:09 +0100
> Anatoly Burakov <anatoly.burakov at 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


More information about the dev mailing list