From: Nick Piggin <nickpiggin@yahoo.com.au>
To: Ingo Molnar <mingo@elte.hu>
Cc: Andrew Morton <akpm@osdl.org>,
"Siddha, Suresh B" <suresh.b.siddha@intel.com>,
linux-kernel <linux-kernel@vger.kernel.org>,
Jack Steiner <steiner@sgi.com>
Subject: [patch 1/2] sched: reduce locking in newidle balancing
Date: Tue, 02 Aug 2005 22:24:31 +1000 [thread overview]
Message-ID: <42EF65FF.2000102@yahoo.com.au> (raw)
In-Reply-To: <42EF65A9.1060408@yahoo.com.au>
[-- Attachment #1: Type: text/plain, Size: 33 bytes --]
1/2
--
SUSE Labs, Novell Inc.
[-- Attachment #2: sched-less-newidle-locking.patch --]
[-- Type: text/plain, Size: 1600 bytes --]
Similarly to the earlier change in load_balance, only lock the runqueue
in load_balance_newidle if the busiest queue found has a nr_running > 1.
This will reduce frequency of expensive remote runqueue lock aquisitions
in the schedule() path on some workloads.
Signed-off-by: Nick Piggin <npiggin@suse.de>
Index: linux-2.6/kernel/sched.c
===================================================================
--- linux-2.6.orig/kernel/sched.c 2005-08-02 21:35:36.000000000 +1000
+++ linux-2.6/kernel/sched.c 2005-08-02 21:56:40.000000000 +1000
@@ -2080,8 +2080,7 @@ static int load_balance(int this_cpu, ru
*/
double_lock_balance(this_rq, busiest);
nr_moved = move_tasks(this_rq, this_cpu, busiest,
- imbalance, sd, idle,
- &all_pinned);
+ imbalance, sd, idle, &all_pinned);
spin_unlock(&busiest->lock);
/* All tasks on this runqueue were pinned by CPU affinity */
@@ -2176,18 +2175,22 @@ static int load_balance_newidle(int this
BUG_ON(busiest == this_rq);
- /* Attempt to move tasks */
- double_lock_balance(this_rq, busiest);
-
schedstat_add(sd, lb_imbalance[NEWLY_IDLE], imbalance);
- nr_moved = move_tasks(this_rq, this_cpu, busiest,
+
+ nr_moved = 0;
+ if (busiest->nr_running > 1) {
+ /* Attempt to move tasks */
+ double_lock_balance(this_rq, busiest);
+ nr_moved = move_tasks(this_rq, this_cpu, busiest,
imbalance, sd, NEWLY_IDLE, NULL);
+ spin_unlock(&busiest->lock);
+ }
+
if (!nr_moved)
schedstat_inc(sd, lb_failed[NEWLY_IDLE]);
else
sd->nr_balance_failed = 0;
- spin_unlock(&busiest->lock);
return nr_moved;
out_balanced:
next prev parent reply other threads:[~2005-08-02 12:29 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-08-02 12:23 [patch 0/2] sched: reduce locking Nick Piggin
2005-08-02 12:24 ` Nick Piggin [this message]
2005-08-02 12:25 ` [patch 2/2] sched: reduce locking in periodic balancing Nick Piggin
2005-08-03 7:59 ` Ingo Molnar
2005-08-03 10:25 ` Nick Piggin
2005-08-03 7:51 ` [patch 1/2] sched: reduce locking in newidle balancing Ingo Molnar
2005-08-02 12:40 ` [patch 0/2] sched: reduce locking Ingo Molnar
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=42EF65FF.2000102@yahoo.com.au \
--to=nickpiggin@yahoo.com.au \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=steiner@sgi.com \
--cc=suresh.b.siddha@intel.com \
/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.