Re: [PATCH] Priority Lists for the RT mutex

From: Paul E. McKenney
Date: Tue Apr 12 2005 - 18:13:37 EST


On Thu, Apr 07, 2005 at 10:52:25AM -0700, Daniel Walker wrote:
>
> Source: Daniel Walker <dwalker@xxxxxxxxxx> MontaVista Software, Inc
> Description:
> This patch adds the priority list data structure from Inaky Perez-Gonzalez
> to the Preempt Real-Time mutex.
>
> the patch order is (starting with a 2.6.11 kernel tree),
>
> patch-2.6.12-rc2
> realtime-preempt-2.6.12-rc2-V0.7.44-01
>
> Signed-off-by: Daniel Walker <dwalker@xxxxxxxxxx>
>
> Index: linux-2.6.11/include/linux/plist.h
> ===================================================================
> --- linux-2.6.11.orig/include/linux/plist.h 1970-01-01 00:00:00.000000000 +0000
> +++ linux-2.6.11/include/linux/plist.h 2005-04-07 17:47:42.000000000 +0000
> @@ -0,0 +1,310 @@

[ . . . ]

> +/* Grunt to do the real removal work of @pl from the plist. */
> +static inline
> +void __plist_del (struct plist *pl)
> +{
> + struct list_head *victim;
> + if (list_empty (&pl->dp_node)) /* SP-node, not head */
> + victim = &pl->sp_node;
> + else if (list_empty (&pl->sp_node)) /* DP-node, empty SP list */
> + victim = &pl->dp_node;
> + else { /* SP list head, not empty */
> + struct plist *pl_new = container_of (pl->sp_node.next,
> + struct plist, sp_node);
> + victim = &pl->sp_node;
> + list_replace_rcu (&pl->dp_node, &pl_new->dp_node);

If you are protecting this list with RCU...

> + }
> + list_del_init (victim);

... you need to wait for a grace period before deleting the element
removed from the list.

Or are you just using list_replace_rcu() for its replacement capability?
If so, seems like it might be worthwhile to make a list_replace().
This would get rid of the memory barrier, and also keep from confusing
people like myself. ;-)

Thanx, Paul
-
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/