lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87ppdic9e9.fsf@sejong.aot.lge.com>
Date:	Fri, 24 Oct 2014 14:41:02 +0900
From:	Namhyung Kim <namhyung@...nel.org>
To:	Adrian Hunter <adrian.hunter@...el.com>
Cc:	Arnaldo Carvalho de Melo <acme@...nel.org>,
	Peter Zijlstra <peterz@...radead.org>,
	linux-kernel@...r.kernel.org, David Ahern <dsahern@...il.com>,
	Frederic Weisbecker <fweisbec@...il.com>,
	Jiri Olsa <jolsa@...hat.com>,
	Paul Mackerras <paulus@...ba.org>,
	Stephane Eranian <eranian@...gle.com>
Subject: Re: [PATCH 04/16] perf tools: Add a thread stack for synthesizing call chains

On Thu, 23 Oct 2014 13:45:12 +0300, Adrian Hunter wrote:
> +static void thread_stack__pop(struct thread_stack *ts, u64 ret_addr)
> +{
> +	if (!ts->cnt)
> +		return;
> +
> +	if (ts->stack[ts->cnt - 1].ret_addr == ret_addr) {
> +		ts->cnt -= 1;
> +	} else {
> +		size_t i = ts->cnt - 1;
> +
> +		while (i--) {
> +			if (ts->stack[i].ret_addr == ret_addr) {
> +				ts->cnt = i;
> +				return;
> +			}
> +		}
> +	}
> +}

Why not making it a single loop like:

	int i;

	for (i = ts->cnt - 1; i >= 0; i--) {
		if (ts->stack[i].ret_addr == ret_addr) {
			ts->cnt = i;
			return;
		}
        }

Thanks,
Namhyung
--
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

Powered by Openwall GNU/*/Linux Powered by OpenVZ