From: Thomas Gleixner <tglx@linutronix.de>
To: LKML <linux-kernel@vger.kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>, Tejun Heo <tj@kernel.org>,
Jens Axboe <axboe@kernel.dk>, Ingo Molnar <mingo@elte.hu>,
Linus Torvalds <torvalds@linux-foundation.org>
Subject: [patch 2/4] sched: Move blk_schedule_flush_plug() out of __schedule()
Date: Wed, 22 Jun 2011 17:52:14 -0000 [thread overview]
Message-ID: <20110622174918.917236198@linutronix.de> (raw)
In-Reply-To: <20110622174659.496793734@linutronix.de>
[-- Attachment #1: sched-move-block-plug-out-of-scheduler-guts.patch --]
[-- Type: text/plain, Size: 1596 bytes --]
There is no real reason to run blk_schedule_flush_plug() with
interrupts and preemption disabled.
Move it into schedule() and call it when the task is going voluntarily
to sleep. There might be false positives when the task is woken
between that call and actually scheduling, but that's not really
different from being woken immediately after switching away.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
kernel/sched.c | 25 +++++++++++++++----------
1 file changed, 15 insertions(+), 10 deletions(-)
Index: linux-2.6/kernel/sched.c
===================================================================
--- linux-2.6.orig/kernel/sched.c
+++ linux-2.6/kernel/sched.c
@@ -4253,16 +4253,6 @@ need_resched:
if (to_wakeup)
try_to_wake_up_local(to_wakeup);
}
-
- /*
- * If we are going to sleep and we have plugged IO
- * queued, make sure to submit it to avoid deadlocks.
- */
- if (blk_needs_flush_plug(prev)) {
- raw_spin_unlock(&rq->lock);
- blk_schedule_flush_plug(prev);
- raw_spin_lock(&rq->lock);
- }
}
switch_count = &prev->nvcsw;
}
@@ -4301,8 +4291,23 @@ need_resched:
goto need_resched;
}
+static inline void sched_submit_work(struct task_struct *tsk)
+{
+ if (!tsk->state)
+ return;
+ /*
+ * If we are going to sleep and we have plugged IO queued,
+ * make sure to submit it to avoid deadlocks.
+ */
+ if (blk_needs_flush_plug(tsk))
+ blk_schedule_flush_plug(tsk);
+}
+
asmlinkage void schedule(void)
{
+ struct task_struct *tsk = current;
+
+ sched_submit_work(tsk);
__schedule();
}
EXPORT_SYMBOL(schedule);
next prev parent reply other threads:[~2011-06-22 17:52 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-22 17:52 [patch 0/4] sched: Move work out of the scheduler core Thomas Gleixner
2011-06-22 17:52 ` [patch 1/4] sched: Separate the scheduler entry for preemption Thomas Gleixner
2011-06-22 18:43 ` Christoph Hellwig
2011-06-22 18:52 ` Thomas Gleixner
2011-06-22 19:42 ` Jens Axboe
2011-06-22 20:15 ` Thomas Gleixner
2011-06-23 11:41 ` Jens Axboe
2011-08-29 14:55 ` [tip:sched/urgent] " tip-bot for Thomas Gleixner
2011-06-22 17:52 ` Thomas Gleixner [this message]
2011-06-22 17:52 ` [patch 3/4] block: Shorten interrupt disabled regions Thomas Gleixner
2011-06-22 17:52 ` [patch 4/4] sched: Distangle worker accounting from rq->lock Thomas Gleixner
2011-06-22 19:30 ` Thomas Gleixner
2011-06-23 8:37 ` Tejun Heo
2011-06-23 9:58 ` Thomas Gleixner
2011-06-23 10:15 ` Tejun Heo
2011-06-23 10:44 ` Ingo Molnar
2011-06-23 11:35 ` Tejun Heo
2011-06-23 12:51 ` Ingo Molnar
2011-06-24 9:01 ` Thomas Gleixner
2011-06-26 10:19 ` Tejun Heo
2011-06-23 15:07 ` Tejun Heo
2013-04-30 13:37 ` Steven Rostedt
2013-04-30 22:47 ` Steven Rostedt
2013-05-03 0:12 ` Tejun Heo
2013-05-03 0:57 ` Steven Rostedt
2013-07-24 10:04 ` Thomas Gleixner
2013-08-06 19:33 ` Steven Rostedt
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=20110622174918.917236198@linutronix.de \
--to=tglx@linutronix.de \
--cc=axboe@kernel.dk \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=peterz@infradead.org \
--cc=tj@kernel.org \
--cc=torvalds@linux-foundation.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®