mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andreas Mohr <andi@rhlx01.fht-esslingen.de>
To: Andrew Morton <akpm@osdl.org>
Cc: len.brown@intel.com, linux-acpi@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH -mm] ACPI lock: cpu_relax() (was: [RFC -mm] more cpu_relax() places?)
Date: Wed, 14 Jun 2006 21:29:13 +0200	[thread overview]
Message-ID: <20060614192913.GC19938@rhlx01.fht-esslingen.de> (raw)
In-Reply-To: <20060613195418.GB24167@rhlx01.fht-esslingen.de>

Hi all,

just realized that x86_64 has the same thing. (patch untested here!)

Signed-off-by: Andreas Mohr <andi@lisas.de>


--- linux-2.6.17-rc6-mm2.orig/include/asm-x86_64/acpi.h	2006-06-13 19:28:16.000000000 +0200
+++ linux-2.6.17-rc6-mm2.my/include/asm-x86_64/acpi.h	2006-06-14 21:21:15.000000000 +0200
@@ -59,11 +59,14 @@
 __acpi_acquire_global_lock (unsigned int *lock)
 {
 	unsigned int old, new, val;
-	do {
+	while (1) {
 		old = *lock;
 		new = (((old & ~0x3) + 2) + ((old >> 1) & 0x1));
 		val = cmpxchg(lock, old, new);
-	} while (unlikely (val != old));
+		if (likely(val == old))
+			break;
+		cpu_relax();
+	}
 	return (new < 3) ? -1 : 0;
 }
 
@@ -71,11 +74,14 @@
 __acpi_release_global_lock (unsigned int *lock)
 {
 	unsigned int old, new, val;
-	do {
+	while (1) {
 		old = *lock;
 		new = old & ~0x3;
 		val = cmpxchg(lock, old, new);
-	} while (unlikely (val != old));
+		if (likely(val == old))
+			break;
+		cpu_relax();
+	}
 	return old & 0x1;
 }
 

  reply	other threads:[~2006-06-14 19:29 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-06-12 18:37 [RFC -mm] more cpu_relax() places? Andreas Mohr
2006-06-13 19:53 ` [PATCH -mm] i386: cpu_relax() smp.c (was: [RFC -mm] more cpu_relax() places?) Andreas Mohr
2006-06-14  2:10   ` [PATCH -mm] i386: cpu_relax() smp.c Nick Piggin
2006-06-14 19:32     ` Andreas Mohr
2006-06-13 19:54 ` [PATCH -mm] ACPI lock: cpu_relax() (was: [RFC -mm] more cpu_relax() places?) Andreas Mohr
2006-06-14 19:29   ` Andreas Mohr [this message]
2006-06-13 19:54 ` [PATCH -mm] x86_64 apic.h " Andreas Mohr
2006-06-14  5:34   ` Andi Kleen
2007-06-14 20:28 ` [PATCH -mm] i386: add cpu_relax() to cmos_lock() Andreas Mohr

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=20060614192913.GC19938@rhlx01.fht-esslingen.de \
    --to=andi@rhlx01.fht-esslingen.de \
    --cc=akpm@osdl.org \
    --cc=len.brown@intel.com \
    --cc=linux-acpi@vger.kernel.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®