[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <47A506B8.9030609@linux.intel.com>
Date:	Sat, 02 Feb 2008 16:11:36 -0800
From:	Arjan van de Ven <arjan@...ux.intel.com>
To:	Dmitry Adamushko <dmitry.adamushko@...il.com>
CC:	Ingo Molnar <mingo@...e.hu>,
	Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: latencytop: optimize LT_BACKTRACEDEPTH loops a bit
Dmitry Adamushko wrote:
> Subject: latencytop: optimize LT_BACKTRACEDEPTH loops a bit.
> 
> It looks like there is no need to loop any longer when 'same == 0'.
thanks for the contribution!
while I like your patch, I wonder if we should go even a little further in
cleaning this up
> @@ -73,12 +73,12 @@ account_global_scheduler_latency(struct task_struct *tsk, struct latency_record
>  			continue;
>  		}
>  		for (q = 0 ; q < LT_BACKTRACEDEPTH ; q++) {
> -			if (latency_record[i].backtrace[q] !=
> -				lat->backtrace[q])
> +			unsigned long record = lat->backtrace[q];
> +
> +			if (latency_record[i].backtrace[q] != record)
>  				same = 0;
> -			if (same && lat->backtrace[q] == 0)
> -				break;
> -			if (same && lat->backtrace[q] == ULONG_MAX)
> +
> +			if (!same || record == 0 || record == ULONG_MAX)
>  				break;
>  		}
I mean, we could make it look like this:
if (latency_record[i].backtrace[q] != record) {
	same = 0;
	break;
}
/* 0 and ULONG_MAX entries denote the end of backtrace */
if (record == 0)
	break;
if (record == ULONG_MAX)
	break;
to me at least this is a bit more readable/simple than the good first step you've
already taken..
Do you want to do it this way? I'd sure encourage/endorse such a patch...
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/
Powered by blists - more mailing lists