Fast path efficiency (Re: [rfc][patch] dynamic data structure switching)

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Nick Piggin <npiggin@...>
Cc: Linux Kernel Mailing List <linux-kernel@...>, David Miller <davem@...>, Paul McKenney <paulmck@...>
Date: Wednesday, September 5, 2007 - 7:05 pm

* Sun, 2 Sep 2007 20:36:19 +0200

I see, that in many places all pre-checks are done in negative form
with resulting return or jump out. In this case, if function was called,
what likely() path is?


that one or this?

==
	if (system_state == SYSTEM_RUNNING) {
		old_shift = cur_pid_hash->shift;
		new_shift = ilog2(nr_pids * 2 - 1);
		if (new_shift != old_shift && mutex_trylock(&dyn_pidhash.resize_mutex)) {
==
		> +	old_shift = cur_pid_hash->shift;
		> +	new_shift = ilog2(nr_pids * 2 - 1);

/* hope this repetition is needed by design */

		...
		
		> +	mutex_unlock(&dyn_pidhash.resize_mutex);
		}

What is more efficient in general sense,
as opposed to s,3,2,1,0 Optimized?


Thanks.
____
-
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[rfc][patch] dynamic data structure switching, Nick Piggin, (Sun Sep 2, 2:27 pm)
Re: [rfc][patch] dynamic data structure switching, Peter Zijlstra, (Mon Sep 10, 7:55 am)
Re: [rfc][patch] dynamic data structure switching, Nick Piggin, (Mon Sep 10, 9:39 am)
Re: [rfc][patch] dynamic data structure switching, Nick Piggin, (Sun Sep 2, 2:36 pm)
Fast path efficiency (Re: [rfc][patch] dynamic data structur..., Oleg Verych, (Wed Sep 5, 7:05 pm)