Re: hlist_for_each_entry && pos (Was: task_work_queue)

From: Oleg Nesterov
Date: Tue Apr 17 2012 - 16:43:59 EST


On 04/16, Paul E. McKenney wrote:
>
> On Thu, Apr 12, 2012 at 06:00:59AM +0200, Oleg Nesterov wrote:
> >
> > hlist_for_each_entry_*() do not need "pos", it can be
> >
> > #define hlist_for_each_entry(pos, head, member) \
> > for (pos = (void*)(head)->first; \
> > pos && ({ pos = hlist_entry((void*)pos, typeof(*pos), member); 1; }); \
> > pos = (void*)(pos)->member.next)
> >
> > The only problem, is there any possibility to change the callers
> > somehow??? I even wrote the script which converts them all, but the
> > patch is huge.
> >
> > Please see the old (2008-04-21) message I sent to lkml below, today
> > the diffstat is even "worse":
> >
> > 152 files changed, 611 insertions(+), 906 deletions(-)
> >
> > and the patch size is 242k.
> >
> > No? we can't?
>
> Maybe this needs a phased approach:
>
> 1. Add a new API name without the "pos" argument.

and this is the first (or main?) problem. Which name??

> 2. Send individual patches to the uses, which allows time to
> clean up stragglers.
>
> 3. Remove the old API name. If any patches from #2 have been
> ignored, push them with the removal patch.
>
> 4. Rename the new API name to the old one, if desired.

Yes, this is much safer, I agree. But I'm afraid that 2. will be
never finished.

And 4. is not trivial anyway, even if it is trivial to generate
the obviously correct patch. Too many trees I guess.


This reminds me I promised to check the code generation. Will do
anyway. But I do not expect any improvement, just it should not
be worse. The only point is too make the usage more simple (you
seem to agree). But at the same time I agree with "the pain
changing the interface" from Linus.

Oleg.

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