[PATCH v9 00/17] Use malloc function attribute to uncover bugs
David Marchand
david.marchand at redhat.com
Thu Oct 10 18:58:13 CEST 2024
On Tue, Oct 8, 2024 at 6:49 PM Stephen Hemminger
<stephen at networkplumber.org> wrote:
>
> Recent versions of GCC have some additional function attributes that can
> help with DPDK performance and stability.
>
> The alloc_align attribute tells the compiler what the alignment
> of the allocation will be, and the optimizer can use this to produce
> better code (especially memcpy and structure copies).
>
> The malloc attribute tells compiler that object is not overlapping
> and potentially aliasing. It also as an additional variant in GCC 11
> or later that allows for detecting all sorts of common errors like
> calling free() on memory allocated with rte_malloc().
>
> In order to use the malloc attribute the free function prototype
> needs to be moved before the allocator/create function prototype
> so that the malloc attribute can refer to it.
>
> This uncovered at least 16 pre-existing bugs in DPDK, these
> should go to stable. This patch set is structured with:
> - fix any new warnings that were discovered
> - add macros for enable the macros
> - enable the attributes
>
> The same attributes could be added to lots more functions in DPDK,
> but this patch set focuses on the key ones, and where problems
> exist in current code base.
Series applied.
Thanks Stephen.
--
David Marchand
More information about the dev
mailing list