All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <a.p.zijlstra@chello.nl>
To: Ingo Molnar <mingo@elte.hu>
Cc: Mike Galbraith <efault@gmx.de>,
	LKML <linux-kernel@vger.kernel.org>,
	Peter Zijlstra <a.p.zijlstra@chello.nl>
Subject: [PATCH 6/6] sched: Add a lock break for PREEMPT=y
Date: Thu, 17 Dec 2009 19:50:27 +0100	[thread overview]
Message-ID: <20091217185430.655230380@chello.nl> (raw)
In-Reply-To: 20091217185021.684424629@chello.nl

[-- Attachment #1: sched-lb-6.patch --]
[-- Type: text/plain, Size: 742 bytes --]

Since load-balancing can hold rq->locks for quite a long while, allow
breaking out early when there is lock contention.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
---
 kernel/sched_fair.c |    4 ++++
 1 file changed, 4 insertions(+)

Index: linux-2.6/kernel/sched_fair.c
===================================================================
--- linux-2.6.orig/kernel/sched_fair.c
+++ linux-2.6/kernel/sched_fair.c
@@ -2065,6 +2065,10 @@ static int move_tasks(struct rq *this_rq
 		 */
 		if (idle == CPU_NEWLY_IDLE && this_rq->nr_running)
 			break;
+
+		if (raw_spin_is_contended(&this_rq->lock) ||
+				raw_spin_is_contended(&busiest->lock))
+			break;
 #endif
 	} while (load_moved && max_load_move > total_load_moved);
 

-- 


  parent reply	other threads:[~2009-12-17 18:59 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-17 18:50 [PATCH 0/6] Some load-balancer cleanups Peter Zijlstra
2009-12-17 18:50 ` [PATCH 1/6] sched: Move load balance code into sched_fair.c Peter Zijlstra
2009-12-17 18:50 ` [PATCH 2/6] sched: Remove the sched_class load_balance methods Peter Zijlstra
2009-12-17 18:50 ` [PATCH 3/6] sched: Remove rq_iterator usage from load_balance_fair Peter Zijlstra
2009-12-17 18:50 ` [PATCH 4/6] sched: Remove rq_iterator from move_one_task Peter Zijlstra
2009-12-17 18:50 ` [PATCH 5/6] sched: Remove from fwd decls Peter Zijlstra
2009-12-17 18:50 ` Peter Zijlstra [this message]
2009-12-18  6:57 ` [PATCH 0/6] Some load-balancer cleanups Ingo Molnar
2009-12-18  9:37   ` Peter Zijlstra
2009-12-23 15:13 ` [PATCH 7/6][RFC] sched: unify load_balance{,_newidle}() Peter Zijlstra
2009-12-24  4:43   ` Mike Galbraith
2009-12-24  9:29     ` Peter Zijlstra
2009-12-24 10:01       ` Mike Galbraith
2009-12-24 10:09       ` Mike Galbraith
2009-12-24 10:16         ` Mike Galbraith
2009-12-24 10:16         ` Peter Zijlstra
2009-12-24 12:55           ` Peter Zijlstra
2009-12-24 17:43             ` Mike Galbraith
2009-12-23 15:13 ` [PATCH 8/6][RFC] sched: Remove load_balance_newidle() Peter Zijlstra

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=20091217185430.655230380@chello.nl \
    --to=a.p.zijlstra@chello.nl \
    --cc=efault@gmx.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.