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: <20090325133028.GE5976@nowhere>
Date:	Wed, 25 Mar 2009 14:30:29 +0100
From:	Frederic Weisbecker <fweisbec@...il.com>
To:	Lai Jiangshan <laijs@...fujitsu.com>
Cc:	Ingo Molnar <mingo@...e.hu>, Steven Rostedt <srostedt@...hat.com>,
	LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 1/2] trace_stat: keep original order

On Wed, Mar 25, 2009 at 04:58:39PM +0800, Lai Jiangshan wrote:
> 
> Impact: make trace_stat files show items with the original order
> 
> trace_stat tracer reverse the items, it makes the output
> looks a little ugly.
> 
> Example, when we read trace_stat/workqueues, we get cpu#7's stat.
> at first, and then cpu#6... cpu#0.
> 
> Signed-off-by: Lai Jiangshan <laijs@...fujitsu.com>
> ---
> diff --git a/kernel/trace/trace_stat.c b/kernel/trace/trace_stat.c
> index f71b85b..c08e7f1 100644
> --- a/kernel/trace/trace_stat.c
> +++ b/kernel/trace/trace_stat.c
> @@ -125,23 +125,21 @@ static int stat_seq_init(struct tracer_stat_session *session)
>  		INIT_LIST_HEAD(&new_entry->list);
>  		new_entry->stat = stat;
>  
> -		list_for_each_entry(iter_entry, &session->stat_list, list) {
> +		list_for_each_entry_reverse(iter_entry, &session->stat_list,
> +				list) {
>  
>  			/* Insertion with a descendent sorting */
> -			if (ts->stat_cmp(new_entry->stat,
> -						iter_entry->stat) > 0) {
> +			if (ts->stat_cmp(iter_entry->stat,
> +					new_entry->stat) >= 0) {
>  
> -				list_add_tail(&new_entry->list,
> -						&iter_entry->list);
> -				break;
> -
> -			/* The current smaller value */
> -			} else if (list_is_last(&iter_entry->list,
> -						&session->stat_list)) {
>  				list_add(&new_entry->list, &iter_entry->list);
>  				break;
>  			}
>  		}
> +
> +		/* The current larger value */
> +		if (list_empty(&new_entry->list))
> +			list_add(&new_entry->list, &session->stat_list);
>  	}
>  exit:
>  	mutex_unlock(&session->stat_mutex);
> 
> 


Nice!

Acked-by: Frederic Weisbecker <fweisbec@...il.com>

--
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