* Q: (stupid) can't we "fix" hlist_for_each_entry() ?
@ 2008-03-12 8:12 Oleg Nesterov
2008-03-12 9:48 ` Peter Zijlstra
2008-03-12 12:53 ` Paul E. McKenney
0 siblings, 2 replies; 4+ messages in thread
From: Oleg Nesterov @ 2008-03-12 8:12 UTC (permalink / raw)
To: Andrew Morton, Christoph Hellwig, Paul E. McKenney; +Cc: linux-kernel
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.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Q: (stupid) can't we "fix" hlist_for_each_entry() ?
2008-03-12 8:12 Q: (stupid) can't we "fix" hlist_for_each_entry() ? Oleg Nesterov
@ 2008-03-12 9:48 ` Peter Zijlstra
2008-03-12 17:27 ` Andrew Morton
2008-03-12 12:53 ` Paul E. McKenney
1 sibling, 1 reply; 4+ messages in thread
From: Peter Zijlstra @ 2008-03-12 9:48 UTC (permalink / raw)
To: Oleg Nesterov
Cc: Andrew Morton, Christoph Hellwig, Paul E. McKenney, linux-kernel
On Wed, 2008-03-12 at 11:12 +0300, Oleg Nesterov wrote:
> 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" ?
I'm in favour.
> If yes, what is the "right" way to do this? These macros are spread all over
> the kernel...
The usual way would be to prepare a git tree for Linus to pull right
after -rc1 I think was the best point, and at the same time supply
Andrew with a bunch of patches fixing up the various users in his tree.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Q: (stupid) can't we "fix" hlist_for_each_entry() ?
2008-03-12 8:12 Q: (stupid) can't we "fix" hlist_for_each_entry() ? Oleg Nesterov
2008-03-12 9:48 ` Peter Zijlstra
@ 2008-03-12 12:53 ` Paul E. McKenney
1 sibling, 0 replies; 4+ messages in thread
From: Paul E. McKenney @ 2008-03-12 12:53 UTC (permalink / raw)
To: Oleg Nesterov; +Cc: Andrew Morton, Christoph Hellwig, linux-kernel
On Wed, Mar 12, 2008 at 11:12:01AM +0300, Oleg Nesterov wrote:
> 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" ?
I have already come out in favor: http://lwn.net/Articles/262464/
answer to Quick Quiz 3. ;-)
The first option above looks more straightforward to me.
> If yes, what is the "right" way to do this? These macros are spread all over
> the kernel...
Peter's approach looked reasonable to me.
Thanx, Paul
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Q: (stupid) can't we "fix" hlist_for_each_entry() ?
2008-03-12 9:48 ` Peter Zijlstra
@ 2008-03-12 17:27 ` Andrew Morton
0 siblings, 0 replies; 4+ messages in thread
From: Andrew Morton @ 2008-03-12 17:27 UTC (permalink / raw)
To: Peter Zijlstra
Cc: Oleg Nesterov, Christoph Hellwig, Paul E. McKenney, linux-kernel
On Wed, 12 Mar 2008 10:48:50 +0100 Peter Zijlstra <peterz@infradead.org> wrote:
> On Wed, 2008-03-12 at 11:12 +0300, Oleg Nesterov wrote:
> > 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" ?
>
> I'm in favour.
>
> > If yes, what is the "right" way to do this? These macros are spread all over
> > the kernel...
>
> The usual way would be to prepare a git tree for Linus to pull right
> after -rc1 I think was the best point, and at the same time supply
> Andrew with a bunch of patches fixing up the various users in his tree.
That, or create new functions with new names, migrate over to them
piecemeal and later remove the old functions.
It's a bit of a problem that there is no alternative name.
eh, send over the jumbopatch after 2.6.25 is released - I'll take care of it.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2008-03-12 17:28 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-03-12 8:12 Q: (stupid) can't we "fix" hlist_for_each_entry() ? Oleg Nesterov
2008-03-12 9:48 ` Peter Zijlstra
2008-03-12 17:27 ` Andrew Morton
2008-03-12 12:53 ` Paul E. McKenney
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox