> From: Stephen Hemminger [mailto:step...@networkplumber.org] > Sent: Wednesday, 31 August 2022 18.23 > Subject: Re: [PATCH V2 0/6] pipeline: make the hash function > configurable per table > > On Fri, 19 Aug 2022 19:52:19 +0000 > Cristian Dumitrescu <cristian.dumitre...@intel.com> wrote: > > > Also, since this flexibility has some performance cost, this patch > set > > also introduces key comparison functions specialized for each key > size > > value. Since the key size is fixed for each table, the key comparison > > function can be selected at initialization as opposed to using a > > generic function that can handle any key size. This strategy result > in > > a performance improvement for the table lookup operation of around > 5%. > > I wonder if DPDK should start to adopt the Linux kernel optimizations > around indirect calls. For most all cases, the function pointer will be > a certain value and the cpu can do direct rather than indirect call. > > As in: > > if (likely(hash_func == crc32_hash)) > crc32_hash(x, y) > else > (*hash_func)(x, y) > > This was done in Linux kernel because of the overhead of the > Spectre/Meltdown > mitigation's, but could apply more generally in DPDK.
+1 to that! Along the very same lines, I remember reading on LWN about the Linux kernel using some magic to avoid function pointers, or to install optimized functions: At locations in the code where multiple variants of a function could be used, the address of the correct/optimized function is written directly into those locations in the code at startup. I didn't read the article in depth back then, and I can't find it now. Perhaps you know what I'm referring to, Stephen? I wonder if that also might be relevant for DPDK.