From: Oleg Nesterov <oleg@tv-sign.ru>
To: Daniel Walker <dwalker@mvista.com>
Cc: Ingo Molnar <mingo@elte.hu>,
linux-kernel@vger.kernel.org,
Steven Rostedt <rostedt@goodmis.org>,
Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
Subject: Re: [PATCH rc5-rt2 0/3] plist: alternative implementation
Date: Tue, 20 Dec 2005 21:31:25 +0300 [thread overview]
Message-ID: <43A84DFD.D8B2151F@tv-sign.ru> (raw)
In-Reply-To: <1135096463.3834.3.camel@localhost.localdomain>
Daniel Walker wrote:
>
> On Tue, 2005-12-20 at 15:38 +0100, Ingo Molnar wrote:
> > * Oleg Nesterov <oleg@tv-sign.ru> wrote:
> >
> I think there is a bug in the new plist_add() , which was in the
> original code. It doesn't properly handle the new maximum node scenario,
> or INT_MAX .
>
> If the list is 1 2 3 4
>
> and you insert 5 , you'll end up with the list 1 2 3 5 4 . Or something
> like that .
I think you are not right, please look at the code.
The code under list_for_each_entry() can break the loop only
when node->prio <= iter->prio.
void plist_add(struct pl_node *node, struct pl_head *head)
{
struct pl_node *iter;
list_for_each_entry(iter, &head->prio_list, plist.prio_list)
if (node->prio < iter->prio)
goto lt_prio;
else if (node->prio == iter->prio)
...
// So, node->prio is a new maximum, or the list was empty.
// &iter.plist == head. We don't touch iter->prio, so it
// is ok that this pl_node is fake, it is really pl_head.
// We are doing list_add_tail(), this means that new node
// will stay _after_ all other nodes.
// In this case the code below is equal to:
//
// list_add_tail(&node->plist.prio_list, &head->prio_list);
// list_add_tail(&node->plist.prio_list, &head->node_list);
lt_prio:
list_add_tail(&node->plist.prio_list, &iter->plist.prio_list);
eq_prio:
list_add_tail(&node->plist.node_list, &iter->plist.node_list);
}
Note that this also garantees FIFO ordering, which was documented
in plist.h, but was not true for plist_for_each().
Daniel, do you agree ?
Oleg.
next prev parent reply other threads:[~2005-12-20 17:15 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-12-18 18:17 Oleg Nesterov
2005-12-18 17:21 ` Steven Rostedt
2005-12-18 17:25 ` Steven Rostedt
2005-12-20 14:38 ` Ingo Molnar
2005-12-20 16:08 ` Oleg Nesterov
2005-12-20 15:04 ` Ingo Molnar
2005-12-20 16:11 ` Oleg Nesterov
2005-12-20 16:34 ` Daniel Walker
2005-12-20 18:31 ` Oleg Nesterov [this message]
2005-12-20 17:29 ` Daniel Walker
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=43A84DFD.D8B2151F@tv-sign.ru \
--to=oleg@tv-sign.ru \
--cc=dwalker@mvista.com \
--cc=inaky.perez-gonzalez@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=rostedt@goodmis.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome