[PATCH v9 1/7] eal: add static per-lcore memory allocation facility
Mattias Rönnblom
hofors at lysator.liu.se
Thu Oct 10 18:17:56 CEST 2024
On 2024-10-10 17:54, Stephen Hemminger wrote:
> On Thu, 10 Oct 2024 16:21:59 +0200
> Mattias Rönnblom <mattias.ronnblom at ericsson.com> wrote:
>
>> Introduce DPDK per-lcore id variables, or lcore variables for short.
>>
>> An lcore variable has one value for every current and future lcore
>> id-equipped thread.
>>
>> The primary <rte_lcore_var.h> use case is for statically allocating
>> small, frequently-accessed data structures, for which one instance
>> should exist for each lcore.
>>
>> Lcore variables are similar to thread-local storage (TLS, e.g., C11
>> _Thread_local), but decoupling the values' life time with that of the
>> threads.
>>
>> Lcore variables are also similar in terms of functionality provided by
>> FreeBSD kernel's DPCPU_*() family of macros and the associated
>> build-time machinery. DPCPU uses linker scripts, which effectively
>> prevents the reuse of its, otherwise seemingly viable, approach.
>>
>> The currently-prevailing way to solve the same problem as lcore
>> variables is to keep a module's per-lcore data as RTE_MAX_LCORE-sized
>> array of cache-aligned, RTE_CACHE_GUARDed structs. The benefit of
>> lcore variables over this approach is that data related to the same
>> lcore now is close (spatially, in memory), rather than data used by
>> the same module, which in turn avoid excessive use of padding,
>> polluting caches with unused data.
>>
>> Signed-off-by: Mattias Rönnblom <mattias.ronnblom at ericsson.com>
>> Acked-by: Morten Brørup <mb at smartsharesystems.com>
>> Acked-by: Konstantin Ananyev <konstantin.ananyev at huawei.com>
>> Acked-by: Chengwen Feng <fengchengwen at huawei.com>
>> Acked-by: Stephen Hemminger <stephen at networkplumber.org>
>
> If you need to send v10, fix this please.
>
>
OK, will do.
>
> WARNING:TYPO_SPELLING: 'varibles' may be misspelled - perhaps 'variables'?
> #336: FILE: doc/guides/prog_guide/env_abstraction_layer.rst:447:
> +Lcore varibles are suitable for small object statically allocated at
>
> WARNING:TYPO_SPELLING: 'identifer' may be misspelled - perhaps 'identifier'?
> #867: FILE: lib/eal/include/rte_lcore_var.h:360:
> + * The pointer returned is only an opaque identifer of the variable. To
I wonder why my checkpatch doesn't spot this, but the DPDK CI version does.
More information about the dev
mailing list