Re: [PATCH] Optimise apply_slack() for faster execution

From: Chinmay V S
Date: Tue Dec 27 2011 - 06:36:58 EST


The patch reduces code complexity by:
- Eliminating the need for intermediate expires_limit and mask variables.
- Simplifying the timer-coalescing logic of discarding lesser significant bits.

This leads to smaller mod_timer() and add_timer() subroutines in which
apply_slack() is inlined. For example, on a typical x86-build, the
patch reduces the size of mod_timer() by 16 instructions.The total
mod_timer() function is 173 instructions i.e. the patch makes the
function 9% smaller. A typical ARM-build also shows similar savings.

original masking-logic:
shlÂÂÂ %cl,%edx
subÂÂÂ $0x1,%edx
movÂÂÂ %edx,-0x10(%ebp)
notÂÂÂ %edx
andÂÂÂ %esi,%edx
movÂÂÂ %edx,-0x14(%ebp)

patched bitwise logic:
shrlÂÂ %cl,-0x14(%ebp)
shllÂÂ %cl,-0x14(%ebp)

Enabling function-traces shows us that the mod_timer() and add_timer()
functions are called ~1300 times every minute. Hence optimising these
functions gives us some significant improvement.

regards
ChinmayVS
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/