[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20141105.220306.359839190322444593.davem@davemloft.net>
Date: Wed, 05 Nov 2014 22:03:06 -0500 (EST)
From: David Miller <davem@...emloft.net>
To: hannes@...essinduktion.org
Cc: netdev@...r.kernel.org, kernel@...r.kernel.org,
dborkman@...hat.com, tgraf@...g.ch
Subject: Re: [PATCH net-next] fast_hash: avoid indirect function calls
From: Hannes Frederic Sowa <hannes@...essinduktion.org>
Date: Wed, 5 Nov 2014 00:23:04 +0100
> By default the arch_fast_hash hashing function pointers are initialized
> to jhash(2). If during boot-up a CPU with SSE4.2 is detected they get
> updated to the CRC32 ones. This dispatching scheme incurs a function
> pointer lookup and indirect call for every hashing operation.
>
> rhashtable as a user of arch_fast_hash e.g. stores pointers to hashing
> functions in its structure, too, causing two indirect branches per
> hashing operation.
>
> Using alternative_call we can get away with one of those indirect branches.
>
> Acked-by: Daniel Borkmann <dborkman@...hat.com>
> Cc: Thomas Graf <tgraf@...g.ch>
> Signed-off-by: Hannes Frederic Sowa <hannes@...essinduktion.org>
Applied, thanks Hannes.
> Would it make sense to start suppressing the generation of local
> functions for static inline functions which address is taken?
>
> E.g. we could use extern inline in a few cases (dst_output is often used
> as a function pointer but marked static inline). We could mark it as
> extern inline and copy&paste the code to a .c file to prevent multiple
> copies of machine code for this function. But because of the copy&paste I
> did not in this case.
I'd say that perhaps dst_output() can be handled in the "traditional"
way, by not inlining it ever.
If we have indirect function invocations and non-direct inlines, maybe
in the end it's better to have it in a single hot cache location, no?
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists