[RFC/PATCH] FUSYN 9/10: stub for priority protection

From: inaky . perez-gonzalez
Date: Wed Jan 14 2004 - 18:00:45 EST


fulock-pp.c | 66 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 66 insertions(+)

--- /dev/null Wed Jan 14 14:39:30 2004
+++ linux/kernel/fulock-pp.c Wed Jan 14 11:13:33 2004
@@ -0,0 +1,66 @@
+
+/*
+ * Fast User real-time/pi/pp/robust/deadlock SYNchronization
+ * (C) 2002-2003 Intel Corp
+ * Inaky Perez-Gonzalez <inaky.perez-gonzalez@xxxxxxxxx>.
+ *
+ * Licensed under the FSF's GNU Public License v2 or later.
+ *
+ * Based on normal futexes (futex.c), (C) Rusty Russell.
+ * Please refer to Documentation/fusyn.txt for more info.
+ *
+ * Stuff for priority-protected fulocks
+ */
+
+#include <linux/fulock.h>
+#include <linux/plist.h>
+#include <linux/time.h> /* struct timespec */
+#include <linux/sched.h> /* MAX_SCHEDULE_TIMEOUT */
+#include <linux/errno.h>
+#include <linux/fulock.h>
+
+/**
+ * Check if a process is allowed to lock a PP fulock.
+ *
+ * @fulock: fulock to check on.
+ * @task: Task to check for acquisition.
+ */
+int __fulock_pp_allowed (struct fulock *fulock)
+{
+ int policy = fulock->flags & FULOCK_FL_PP_PLC_MK > 20;
+ int priority = fulock->flags & FULOCK_FL_PP_PRIO_MK > 12;
+ int prio;
+
+ if (policy != SCHED_NORMAL)
+ prio = MAX_USER_RT_PRIO - 1 - priority;
+ else
+ prio = priority;
+ fulock->flags &= ~FULOCK_FL_PP_PRIO_MK;
+ fulock->flags |= prio & FULOCK_FL_PP_PRIO_MK;
+#warning FIXME: interaction with PI? Compare against static, not dynamic?
+ if (prio > current->prio)
+ return -EINVAL;
+ return 0;
+}
+
+
+/** FIXME */
+void __fulock_pp_boost (struct fulock *fulock)
+{
+#warning FIXME: finish me
+}
+
+
+/**
+ * Remove the boosting in priority of the owner of a
+ * priority-protected @fulock.
+ *
+ * @fulock: fulock whose owner's priority is to be boosted.
+ *
+ * If the fulock is a priority-protected lock, boost the priority of
+ * the owner to the fulock's priority ceiling.
+ */
+void __fulock_pp_unboost (struct fulock *fulock)
+{
+}
+
-
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/