From: Oleg Nesterov <oleg@tv-sign.ru>
To: "Perez-Gonzalez, Inaky" <inaky.perez-gonzalez@intel.com>
Cc: Ingo Molnar <mingo@elte.hu>,
linux-kernel@vger.kernel.org, Daniel Walker <dwalker@mvista.com>
Subject: Re: [PATCH 2/4] rt_mutex: add new plist implementation
Date: Tue, 10 May 2005 15:18:47 +0400 [thread overview]
Message-ID: <42809897.3956381A@tv-sign.ru> (raw)
In-Reply-To: <F989B1573A3A644BAB3920FBECA4D25A0335DBE0@orsmsx407>
"Perez-Gonzalez, Inaky" wrote:
>
> >From: Oleg Nesterov
>
> >+extern void plist_add(struct pl_node *node, struct pl_head *head);
> >+extern void plist_del(struct pl_node *node);
>
> At least I'd add return codes for this if the head's priority=20
> changes (or in this case, because head's have no prio, if the=20
> first node's prio change).
I am not sure I understand you. Why should we track ->prio=20 changes?
plist should be generic, I think.
Original code:
unsigned plist_add (struct plist *pl, struct plist *plist)
{
__plist_add_sorted (plist, pl);
if (pl->prio < plist->prio) {
plist->prio = pl->prio;
return !0;
}
return 0;
}
This could be:
int plist_add_and_check_min_prio_changed(node, head)
{
plist_add(node, head);
return plist_next(head) == node;
}
Or plist_add() could be easily changed to return -1,0,+1 to indicate
min/max prio changed/unchanged.
But may be it is better to return 'iter' from plist_add(). This way
we can avoid scanning ->prio_list when we add the node with the same
->prio next time. I am not sure.
And please note that pl_head "has" prio:
plist_empty(head) ? INT_MAX // -1 ?
: plist_next(head)->prio
> Both function's logic should make it easy to test and it'd save
> a lot of code in the caller.
Currently these functions are used in void context only. I think
it is better to add return codes when callers need them.
What do you think?
Oleg.
next prev parent reply other threads:[~2005-05-10 11:11 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-05-09 19:35 Perez-Gonzalez, Inaky
2005-05-10 11:18 ` Oleg Nesterov [this message]
-- strict thread matches above, loose matches on Subject: below --
2005-05-10 20:58 Perez-Gonzalez, Inaky
2005-05-10 18:51 Perez-Gonzalez, Inaky
2005-05-10 18:39 Perez-Gonzalez, Inaky
2005-05-10 18:49 ` Valdis.Kletnieks
2005-05-10 19:17 ` Valdis.Kletnieks
2005-05-10 19:44 ` Daniel Walker
2005-05-11 7:02 ` Oleg Nesterov
2005-05-09 14:39 Oleg Nesterov
2005-05-09 15:40 ` Daniel Walker
2005-05-09 16:20 ` Oleg Nesterov
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=42809897.3956381A@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 \
/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