Re: [PATCH] list.h: add list_for_each_struct_entry macro
From: Ben Hutchings
Date: Mon Jan 18 2010 - 16:15:13 EST
On Mon, 2010-01-18 at 22:07 +0100, Jiri Pirko wrote:
> Mon, Jan 18, 2010 at 06:17:13PM CET, bhutchings@xxxxxxxxxxxxxx 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.
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 linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/