lkml.org 
[lkml]   [2003]   [Sep]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
SubjectRe: [PATCH] kernel/futex.c: Uneeded memory barrier
Date
In message <3F621160.5020502@terra.com.br> you write:
> > Kills an unneeded set_current_state after schedule_timeout, since it
> > already guarantees that the task will be TASK_RUNNING.

In fact, furthur cleanups are possible.

Thanks!
Rusty.
--
Anyone who quotes me in their sig is an idiot. -- Rusty Russell.

Name: Clean up futex task state setting
Author: Rusty Russell, Felipe W Damasio <felipewd@terra.com.br>
Depends: Misc/futex-jamie-plus1.patch.gz
Status: Trivial

D: Felipe points out that set_task_state is overkill. In fact,
D: futex_lock protects us so we can set if after the queued test,
D: simplifying the whole function slightly

diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .7327-2.6.0-test5-bk3-futex-task_state.pre/kernel/futex.c .7327-2.6.0-test5-bk3-futex-task_state/kernel/futex.c
--- .7327-2.6.0-test5-bk3-futex-task_state.pre/kernel/futex.c 2003-09-15 19:37:14.000000000 +1000
+++ .7327-2.6.0-test5-bk3-futex-task_state/kernel/futex.c 2003-09-15 19:37:14.000000000 +1000
@@ -374,20 +374,16 @@ static int futex_wait(unsigned long uadd
*/
add_wait_queue(&q.waiters, &wait);
spin_lock(&futex_lock);
- set_current_state(TASK_INTERRUPTIBLE);

if (unlikely(list_empty(&q.list))) {
- /*
- * We were woken already.
- */
+ /* We were woken already. */
spin_unlock(&futex_lock);
- set_current_state(TASK_RUNNING);
return 0;
}

+ __set_current_state(TASK_INTERRUPTIBLE);
spin_unlock(&futex_lock);
time = schedule_timeout(time);
- set_current_state(TASK_RUNNING);

/*
* NOTE: we don't remove ourselves from the waitqueue because
-
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/
\
 
 \ /
  Last update: 2005-03-22 13:48    [W:0.697 / U:0.008 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site