lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:	Fri, 20 Aug 2010 09:54:35 -0700
From:	Tim Chen <tim.c.chen@...ux.intel.com>
To:	Ingo Molnar <mingo@...e.hu>
Cc:	Linus Torvalds <torvalds@...ux-foundation.org>,
	Thomas Gleixner <tglx@...utronix.de>,
	Frédéric Weisbecker <fweisbec@...il.com>,
	peterz@...radead.org, Andrew Morton <akpm@...ux-foundation.org>,
	linux-kernel@...r.kernel.org, Andi Kleen <ak@...ux.intel.com>,
	Tony Luck <tony.luck@...el.com>
Subject: Re: [PATCH  1/1] mutex: prevent optimistic spinning from spinning
 longer than neccessary (Repost)

On Fri, 2010-08-20 at 15:19 +0200, Ingo Molnar wrote:

> 
> Thanks! The performance results you've posted so far IMO more than justifies 
> its inclusion.
> 
> 	Ingo

Thanks to everyone for your review.  I've updated the patch to add
comments explaining the change per suggestion from Andrew.

Signed-off-by: Tim Chen <tim.c.chen@...ux.intel.com>
diff --git a/kernel/sched.c b/kernel/sched.c
index 41541d7..3747d04 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -3865,8 +3865,15 @@ int mutex_spin_on_owner(struct mutex *lock, struct thread_info *owner)
 		/*
 		 * Owner changed, break to re-assess state.
 		 */
-		if (lock->owner != owner)
+		if (lock->owner != owner) {
+			/* if lock has switched to a different owner,
+			 * we have heavy contention. Return 0 to
+			 * quit optimistic spinning and not contend further.
+			 */
+			if (lock->owner)
+				return 0;
 			break;
+		}
 
 		/*
 		 * Is that owner really running on that cpu?


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ