Thread (14 messages) 14 messages, 3 authors, 2017-06-20

Re: [PATCH net-next 09/10] net/mlx4_en: Replace TXBB_SIZE multiplications with shift operations

flat view

From: Tariq Toukan <hidden>
Date: 2017-06-20 10:53:44


On 20/06/2017 11:45 AM, David Laight wrote:
From: Tariq Toukan
quoted
Sent: 15 June 2017 12:36
Define LOG_TXBB_SIZE, log of TXBB_SIZE, and use it with a shift
operation instead of a multiplication with TXBB_SIZE.
Operations are equivalent as TXBB_SIZE is a power of two.

Performance tests:
Tested on ConnectX3Pro, Intel(R) Xeon(R) CPU E5-2680 v3 @ 2.50GHz

Gain is too small to be measurable, no degradation sensed.
Results are similar for IPv4 and IPv6.
I can't imagine there is any difference at all.
The compiler will use a shift for a 'multiply by a constant power of 2'.
Yeah i guess my compiler does that, because it's a constant known at compile-time.
...
If you want to save a few cycles I think the loop:
quoted
-		for (i = 0; i < tx_info->nr_txbb * TXBB_SIZE;
+		for (i = 0; i < tx_info->nr_txbb << LOG_TXBB_SIZE;
requires the compiler generate code to read nr_txbb every
iteration.
Caching the values might help (unless it causes a different
register spill).
That sounds good!
I'll prepare and send this after testing.
I'll also look for similar cases in driver.
	David
Thank you David!
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help