From: David S. Miller Date: Fri, 20 Mar 2015 20:16:32 +0000 (-0400) Subject: Merge branch 'rhashtable-inlined-interface' X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=ebd6af092a221fc38e28fbb7995c0c7e3f0df875;p=linux-beck.git 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 --- ebd6af092a221fc38e28fbb7995c0c7e3f0df875