netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [v1 PATCH 0/7] rhashtable: Introduce inlined interface
@ 2015-03-20 10:54 Herbert Xu
  2015-03-20 10:56 ` [v1 PATCH 1/7] rhashtable: Make rhashtable_init params argument const Herbert Xu
                   ` (7 more replies)
  0 siblings, 8 replies; 21+ messages in thread
From: Herbert Xu @ 2015-03-20 10:54 UTC (permalink / raw)
  To: David S. Miller, Thomas Graf, Eric Dumazet, Patrick McHardy,
	netdev

Hi:

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.

Cheers,
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2015-03-21  4:17 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-20 10:54 [v1 PATCH 0/7] rhashtable: Introduce inlined interface Herbert Xu
2015-03-20 10:56 ` [v1 PATCH 1/7] rhashtable: Make rhashtable_init params argument const Herbert Xu
2015-03-20 13:16   ` Thomas Graf
2015-03-20 10:57 ` [v1 PATCH 2/7] rhashtable: Allow hash/comparison functions to be inlined Herbert Xu
2015-03-20 11:20   ` Patrick McHardy
2015-03-20 12:02     ` Herbert Xu
2015-03-20 12:06       ` Patrick McHardy
2015-03-20 10:57 ` [v1 PATCH 3/7] netlink: Move namespace into hash key Herbert Xu
2015-03-20 10:57 ` [v1 PATCH 4/7] netfilter: Convert nft_hash to inlined rhashtable Herbert Xu
2015-03-20 10:57 ` [v1 PATCH 5/7] test_rhashtable: Use inlined rhashtable interface Herbert Xu
2015-03-20 10:57 ` [v1 PATCH 6/7] tipc: " Herbert Xu
2015-03-20 10:57 ` [v1 PATCH 7/7] rhashtable: Rip out obsolete out-of-line interface Herbert Xu
2015-03-20 20:25   ` Thomas Graf
2015-03-20 21:24     ` Herbert Xu
2015-03-20 20:17 ` [v1 PATCH 0/7] rhashtable: Introduce inlined interface David Miller
2015-03-20 21:28   ` Herbert Xu
2015-03-20 22:17     ` David Miller
2015-03-20 22:21       ` Herbert Xu
2015-03-20 22:37         ` David Miller
2015-03-21  3:14           ` Herbert Xu
2015-03-21  4:17             ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).