2008-06-11 20:54:49

by Daniel Walker

[permalink] [raw]
Subject: [PATCH 2/5] futex: update prio on requeue

Since the priority may have changed, the requeue is a good place to update
the priority since we're already deleting and adding to a new list.

Signed-off-by: Daniel Walker <[email protected]>

---
kernel/futex.c | 3 +++
1 file changed, 3 insertions(+)

Index: linux-2.6.25/kernel/futex.c
===================================================================
--- linux-2.6.25.orig/kernel/futex.c
+++ linux-2.6.25/kernel/futex.c
@@ -980,7 +980,10 @@ static int futex_requeue(u32 __user *uad
* requeue.
*/
if (likely(head1 != &hb2->chain)) {
+ struct task_struct *task = this->task;
+ int prio = min(task->normal_prio, MAX_RT_PRIO);
plist_del(&this->list, &hb1->chain);
+ plist_node_init(&this->list, prio);
plist_add(&this->list, &hb2->chain);
this->lock_ptr = &hb2->lock;
#ifdef CONFIG_DEBUG_PI_LIST

--


2008-06-12 05:22:56

by Peter Zijlstra

[permalink] [raw]
Subject: Re: [PATCH 2/5] futex: update prio on requeue

On Wed, 2008-06-11 at 13:49 -0700, Daniel Walker wrote:
> plain text document attachment (futex-update-prio-on-requeue.patch)
> Since the priority may have changed, the requeue is a good place to update
> the priority since we're already deleting and adding to a new list.
>
> Signed-off-by: Daniel Walker <[email protected]>
>
> ---
> kernel/futex.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> Index: linux-2.6.25/kernel/futex.c
> ===================================================================
> --- linux-2.6.25.orig/kernel/futex.c
> +++ linux-2.6.25/kernel/futex.c
> @@ -980,7 +980,10 @@ static int futex_requeue(u32 __user *uad
> * requeue.
> */
> if (likely(head1 != &hb2->chain)) {
> + struct task_struct *task = this->task;
> + int prio = min(task->normal_prio, MAX_RT_PRIO);

we want whitespace between var declarations and code

> plist_del(&this->list, &hb1->chain);
> + plist_node_init(&this->list, prio);
> plist_add(&this->list, &hb2->chain);
> this->lock_ptr = &hb2->lock;
> #ifdef CONFIG_DEBUG_PI_LIST
>