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] [day] [month] [year] [list]
Message-ID: <4B46EDF7.3040205@dcl.info.waseda.ac.jp>
Date:	Fri, 08 Jan 2010 17:33:59 +0900
From:	Hitoshi Mitake <mitake@....info.waseda.ac.jp>
To:	Peter Zijlstra <peterz@...radead.org>
CC:	Ingo Molnar <mingo@...e.hu>, linux-kernel@...r.kernel.org,
	Paul Mackerras <paulus@...ba.org>,
	Frederic Weisbecker <fweisbec@...il.com>
Subject: Re: [PATCH] perf lock: Implement basic sorting function of perf lock

On 2009年12月28日 20:01, Peter Zijlstra wrote:
> On Sun, 2009-12-20 at 11:56 +0900, Hitoshi Mitake wrote:
>> +static struct lock_stat *lock_stat_findnew(void *addr, const char *name)
>> +{
>> +       struct list_head *entry = lockhashentry(addr);
>> +       struct lock_stat *ret, *new;
>
>
> Right, so you use a hash table to match lock instances, I suppose that's
> faster than an rb-tree?

Maybe. But it is hard to determine which data structure is better.
This is a histogram from perf.data produced by "perf bench sched messaging",

(left is length of list, right is number of list whose length is value 
of left)
0: 3333
1: 153
2: 91
3: 114
4: 96
5: 75
6: 61
7: 43
8: 29
9: 32
10: 23
11: 15
12: 9
13: 5
14: 7
15: 3
16: 1
17: 3
18: 0
19: 3   # 19 means "longer than 19"

Total number of lock instances is 3459,
so if perf lock use rb-tree for storing info of lock instances,
average order of accessing stored node is lg 4096 == 12.
And the histogram above describes,
there are relatively very few lists with length over 12.
So I think hash list is better thing for storing info of lock instances 
than rb-tree.
(Sorting result is another issue, of course.)

>
> Do you also remove instances after a match to keep the hash relatively
> small?
>
>

No, I don't.
At the last phase of profiling,
perf lock makes rb-tree sorted by the key user specified.

static void sort_result(void)
{
	unsigned int i;
	struct lock_stat *st;

	for (i = 0; i < LOCKHASH_SIZE; i++) {
		list_for_each_entry(st, &lockhash_table[i], hash_entry) {
			insert_to_result(st, compare); # insert to rb-tree
		}
	}
}

As this code describes,
referencing the completed hash list is done only once.
So removing instances to keep the hash list relatively small
is not required, I think.
--
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