Messages in this thread | | | Date | Fri, 06 May 2005 13:05:03 +0400 | From | Oleg Nesterov <> | Subject | Re: [PATCH] Priority Lists for the RT mutex |
| |
Daniel Walker wrote: > > Description: > This patch adds the priority list data structure from Inaky Perez-Gonzalez > to the Preempt Real-Time mutex. > > ... > > +#define plist_for_each(pos1, pos2, head) \ > + list_for_each_entry(pos1, &((head)->dp_node), dp_node) \ > + list_for_each_entry(pos2, &((pos1)->sp_node), sp_node)
I can't understand how this can work.
The fist list_for_each_entry(->dp_node) will iterate over nodes with different priorities, ok. But the second one will skip the first node (which starts new priority group), because list_for_each(head) does not count head.
To be sure, I wrote simple test:
#include <stdio.h> #include <limits.h> #include "list.h" #include "plist.h"
int main(void) { struct plist head, node, *pos1, *pos2;
plist_init(&head, 0); plist_init(&node, 0);
plist_add(&node, &head);
plist_for_each(pos1, pos2, &head) printf("Strange ???\n");
return 0; }
Prints nothing.
My apologies if I'm misunderstanding something.
Oleg. - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |