mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Rusty Russell <rusty@rustcorp.com.au>
To: Felipe W Damasio <felipewd@terra.com.br>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Jamie Lokier <jamie@shareable.org>
Subject: Re: [PATCH] kernel/futex.c: Uneeded memory barrier
Date: Mon, 15 Sep 2003 19:39:13 +1000	[thread overview]
Message-ID: <20030915143538.009B32C0C3@lists.samba.org> (raw)
In-Reply-To: Your message of "Fri, 12 Sep 2003 15:33:04 -0300." <3F621160.5020502@terra.com.br>

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

  reply	other threads:[~2003-09-15 14:35 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-09-12 18:20 Felipe W Damasio
2003-09-12 18:33 ` Felipe W Damasio
2003-09-15  9:39   ` Rusty Russell [this message]
2003-09-16 12:05     ` Jamie Lokier
2003-09-13 19:02 ` Jamie Lokier
2003-09-15  1:36   ` Rusty Russell
2003-09-14 11:39 ` Rusty Russell
2003-09-14 14:08   ` Jamie Lokier
2003-09-15  3:41     ` Rusty Russell
2003-09-15  9:23       ` Russell King
2003-09-15 16:32         ` Rusty Russell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20030915143538.009B32C0C3@lists.samba.org \
    --to=rusty@rustcorp.com.au \
    --cc=felipewd@terra.com.br \
    --cc=jamie@shareable.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®