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: <1290556830.30543.415.camel@gandalf.stny.rr.com>
Date:	Tue, 23 Nov 2010 19:00:30 -0500
From:	Steven Rostedt <rostedt@...dmis.org>
To:	Mathieu Desnoyers <mathieu.desnoyers@...ymtl.ca>
Cc:	Jason Baron <jbaron@...hat.com>, mingo@...e.hu,
	peterz@...radead.org, hpa@...or.com, tglx@...utronix.de,
	andi@...stfloor.org, roland@...hat.com, rth@...hat.com,
	masami.hiramatsu.pt@...achi.com, fweisbec@...il.com,
	avi@...hat.com, davem@...emloft.net, sam@...nborg.org,
	ddaney@...iumnetworks.com, michael@...erman.id.au,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/3] jump label: add enabled/disabled state to jump
 label key entries

On Tue, 2010-11-23 at 18:43 -0500, Mathieu Desnoyers wrote:
> * Jason Baron (jbaron@...hat.com) wrote:
> [...]
> > +static void update_jump_label_module(struct module *mod)
> > +{
> > +	struct hlist_head *head;
> > +	struct hlist_node *node, *node_next, *module_node, *module_node_next;
> > +	struct jump_label_entry *e;
> > +	struct jump_label_module_entry *e_module;
> > +	struct jump_entry *iter;
> > +	int i, count;
> > +
> > +	/* if the module doesn't have jump label entries, just return */
> > +	if (!mod->num_jump_entries)
> > +		return;
> > +
> > +	for (i = 0; i < JUMP_LABEL_TABLE_SIZE; i++) {
> > +		head = &jump_label_table[i];
> > +		hlist_for_each_entry_safe(e, node, node_next, head, hlist) {
> > +			if (!e->enabled)
> > +				continue;
> > +			hlist_for_each_entry_safe(e_module, module_node,
> > +						  module_node_next,
> > +						  &(e->modules), hlist) {
> > +				if (e_module->mod != mod)
> > +					continue;
> 
> Ouch.
> 
> Could you iterate on the loaded/unloaded module jump labels and do hash
> table lookups rather than doing this O(n^3) iteration ?

This does not look O(n^3) to me.

It's a hash table, thus the first two loops is just iterating O(n) items
in the hash.

And the third loop is all the modules that use a particular event.

So it is O(n*m)  where n is the number of events, and m is the number of
modules attached to the events. And that's only if all events are used
by those modules. The actual case is much smaller.

-- Steve


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