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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20100118213028.GD4521@psychotron.redhat.com>
Date:	Mon, 18 Jan 2010 22:30:29 +0100
From:	Jiri Pirko <jpirko@...hat.com>
To:	Ben Hutchings <bhutchings@...arflare.com>
Cc:	linux-kernel@...r.kernel.org, davem@...emloft.net,
	netdev@...r.kernel.org
Subject: Re: [PATCH] list.h: add list_for_each_struct_entry macro

Mon, Jan 18, 2010 at 10:14:18PM CET, bhutchings@...arflare.com wrote:
>On Mon, 2010-01-18 at 22:07 +0100, Jiri Pirko wrote:
>> Mon, Jan 18, 2010 at 06:17:13PM CET, bhutchings@...arflare.com wrote:
>[...]
>> >#define list_for_each_struct_entry(pos, head, type, posmember, member)	     \
>> >	for (pos = list_empty(head) ? NULL :				     \
>> >		&list_first_entry(head, type, member)->posmember;	     \
>> >	     prefetch(container_of(pos, type, posmember)->member.next), pos; \
>> >	     pos = list_is_last(&container_of(pos, type, posmember)->member, \
>> >				head) ?	NULL :				     \
>> >		&list_entry(container_of(pos, type, posmember)->member.next, \
>> >			    type, member)->posmember)
>> >
>> 
>> At the first glance, this would take even more cputime for lists longer
>> than 2 or so, wouldn't it?
>
>If you're concerned about speed, measure it, don't guess.

Well I just see extra code
"list_is_last(&container_of(pos, type, posmember)->member, head)"
to be done in each iteration. Also I do not see additional value in doing this.
(Unlike in checking list_empty(head)).

Anyway, if you want to use this optimization, I guess more code in list.h could
use this.

Jirka
>
>Ben.
>
>-- 
>Ben Hutchings, Senior Software Engineer, Solarflare Communications
>Not speaking for my employer; that's the marketing department's job.
>They asked us to note that Solarflare product names are trademarked.
>
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ