MCPcopy Create free account
hub / github.com/F-Stack/f-stack / arch_mem_object_align

Function arch_mem_object_align

dpdk/lib/mempool/rte_mempool.c:89–109  ·  view source on GitHub ↗

* Depending on memory configuration on x86 arch, objects addresses are spread * between channels and ranks in RAM: the pool allocator will add * padding between objects. This function return the new size of the * object. */

Source from the content-addressed store, hash-verified

87 * object.
88 */
89static unsigned int
90arch_mem_object_align(unsigned int obj_size)
91{
92 unsigned nrank, nchan;
93 unsigned new_obj_size;
94
95 /* get number of channels */
96 nchan = rte_memory_get_nchannel();
97 if (nchan == 0)
98 nchan = 4;
99
100 nrank = rte_memory_get_nrank();
101 if (nrank == 0)
102 nrank = 1;
103
104 /* process new object size */
105 new_obj_size = (obj_size + RTE_MEMPOOL_ALIGN_MASK) / RTE_MEMPOOL_ALIGN;
106 while (get_gcd(new_obj_size, nrank * nchan) != 1)
107 new_obj_size++;
108 return new_obj_size * RTE_MEMPOOL_ALIGN;
109}
110#else
111static unsigned int
112arch_mem_object_align(unsigned int obj_size)

Callers 1

Calls 3

rte_memory_get_nchannelFunction · 0.85
rte_memory_get_nrankFunction · 0.85
get_gcdFunction · 0.85

Tested by

no test coverage detected