lkml.org 
[lkml]   [2008]   [Mar]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectQ: (stupid) can't we "fix" hlist_for_each_entry() ?
hlist_for_each_entry/hlist_for_each_entry_rcu doesn't actually need 4
arguments, it could be

#define hlist_for_each_entry_rcu(pos, head, member) \
for (pos = hlist_entry((head)->first, typeof(*(pos)), member); \
rcu_dereference(pos) != hlist_entry(NULL, typeof(*(pos)), member) && \
({ prefetch((pos)->member.next); 1; }); \
(pos) = hlist_entry((pos)->member.next, typeof(*(pos)), member))
Or,

#define hlist_for_each_entry_rcu(pos, head, member) \
for (pos = (void*)(head)->first; \
rcu_dereference(pos) && ({ prefetch(((hlist_node*)pos)->next); 1; }) && \
({ (pos) = hlist_entry((void*)(pos), typeof(*(pos)), member)); 1; }); \
(pos) = (void*)(pos)->member.next)
Q: is it worth "fixing" ?

If yes, what is the "right" way to do this? These macros are spread all over
the kernel...

Oleg.



\
 
 \ /
  Last update: 2008-03-12 09:15    [from the cache]
©2003-2014 Jasper Spaans. Advertise on this site