[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1193156793.6914.0.camel@twins>
Date: Tue, 23 Oct 2007 18:26:33 +0200
From: Peter Zijlstra <a.p.zijlstra@...llo.nl>
To: Steven Rostedt <rostedt@...dmis.org>
Cc: linux-kernel@...r.kernel.org, Daniel Walker <dwalker@...sta.com>,
Ingo Molnar <mingo@...e.hu>,
Thomas Gleixner <tglx@...utronix.de>,
Gregory Haskins <ghaskins@...ell.com>,
Oleg Nesterov <oleg@...sign.ru>
Subject: Re: [RFC/PATCH 3/5] rt: plist_head_splice
On Tue, 2007-10-23 at 11:10 -0400, Steven Rostedt wrote:
> --
> On Tue, 23 Oct 2007, Peter Zijlstra wrote:
> > +
> > +void plist_head_splice(struct plist_head *src, struct plist_head *dst)
> > +{
> > + struct plist_node *src_iter_first, *src_iter_last, *dst_iter;
> > + struct plist_node *tail = container_of(dst, struct plist_node, plist);
> > +
> > + dst_iter = next_prio(tail);
> > +
> > + while (!plist_head_empty(src) && dst_iter != tail) {
> > + src_iter_first = plist_first(src);
> > +
> > + src_iter_last = next_prio(src_iter_first);
> > + src_iter_last = prev_node(src_iter_last);
> > +
> > + WARN_ON(src_iter_first->prio != src_iter_last->prio);
> > + WARN_ON(list_empty(&src_iter_first->plist.prio_list));
> > +
> > + while (src_iter_first->prio > dst_iter->prio) {
> > + dst_iter = next_prio(dst_iter);
> > + if (dst_iter == tail)
> > + goto tail;
> > + }
> > +
> > + list_del_init(&src_iter_first->plist.prio_list);
> > +
> > + if (src_iter_first->prio < dst_iter->prio) {
>
> I may be confused here, but shouldn't we be linking the
> src_iter_first->prio_list somewhere here? Doesn't all different prios need
> to be in its separate prio_list? Otherwise two splices in a row can cause
> the above WARN_ON (prio != prio).
>
> > + list_add_tail(&src_iter_first->plist.node_list,
> > + &dst_iter->plist.node_list);
Uhm, yeah, that was supposed the be prio_list indeed.
Thanks!
> > + } else if (src_iter_first->prio == dst_iter->prio) {
> > + dst_iter = next_prio(dst_iter);
> > + } else BUG();
> > +
> > + list_splice2_tail(&src_iter_first->plist.node_list,
> > + &src_iter_last->plist.node_list,
> > + &dst_iter->plist.node_list);
> > + }
> > +
> > +tail:
> > + list_splice_tail_init(&src->prio_list, &dst->prio_list);
> > + list_splice_tail_init(&src->node_list, &dst->node_list);
> > +}
> >
> > --
> >
> >
> >
Download attachment "signature.asc" of type "application/pgp-signature" (190 bytes)
Powered by blists - more mailing lists