]> git.baikalelectronics.ru Git - kernel.git/commit
Merge branch 'rhashtable-inlined-interface'
authorDavid S. Miller <davem@davemloft.net>
Fri, 20 Mar 2015 20:16:32 +0000 (16:16 -0400)
committerDavid S. Miller <davem@davemloft.net>
Fri, 20 Mar 2015 20:16:32 +0000 (16:16 -0400)
commit7074359002ae8663af9e04ffab78c966fd2edb7b
treea06b2334d07b4a9177963cb34ff2455cf224c83b
parent12749a7adbdbbfe15a871e96368ef188e482c550
parenta18ba3143703608177839f1dd1f144a997eb1bf2
Merge branch 'rhashtable-inlined-interface'

Herbert Xu says:

====================
rhashtable: Introduce inlined interface

This series of patches introduces the inlined rhashtable interface.

The idea is to make all the function pointers visible to the compiler
by providing the rhashtable_params structure explicitly to each
inline rhashtable function.  For example, instead of doing

obj = rhashtable_lookup(ht, key);

you would now do

obj = rhashtable_lookup_fast(ht, key, params);

Where params is the same data that you would give to rhashtable_init.
In particular, within rhashtable.c itself we would simply supply
ht->p.

So to convert users over, you simply have to make params globally
accessible, e.g., by placing it in a static const variable, which
can then be used at each inlined call site, as well as by the
rhashtable_init call.

The only ticky bit is that some users (i.e., netfilter) has a
dynamic key length.  This is dealt with by using params.key_len
in the inline functions when it is non-zero, and otherwise falling
back on ht->p.key_len.

Note that I've only tested this on one compiler, gcc 4.7.2.  So
please test this with your compilers as well and make sure that
the code is actually inlined without indirect function calls.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>