mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jupyung Lee <jupyung@gmail.com>
To: LKML <linux-kernel@vger.kernel.org>
Cc: Jupyung Lee <jupyung@gmail.com>
Subject: [PATCH -rt 1/1] sched_rt: change spinlock primitive in post_schedule_rt()
Date: Mon, 16 Nov 2009 13:49:19 +0900	[thread overview]
Message-ID: <1258346959-7166-1-git-send-email-jupyung@gmail.com> (raw)

A problem is that after finishing post_schedule_rt(), interrupt is always
re-enabled regardless of the previous condition. In practice, the function
post_schedule_rt() is called by finish_task_switch() with the interrupt disabled.
Thus, the interrupt should not be re-enabled at the moment.

The problem can simply be resolved by replacing atomic_spin_lock_irq() and
atomic_spin_unlock_irq() with atomic_spin_lock_irqsave() and
atomic_spin_unlock_irqrestore().

As a sidenote, the other way to resolve the problem might be to modify codes
in accordance with commit 3f029d3c6d62068d59301d90c18dbde8ee402107, titled
"sched: Enhance the pre/post scheduling logic", in the vanilla tree.

Signed-off-by: Jupyung Lee <jupyung@gmail.com>
---
 kernel/sched_rt.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/kernel/sched_rt.c b/kernel/sched_rt.c
index 274c976..bd16998 100644
--- a/kernel/sched_rt.c
+++ b/kernel/sched_rt.c
@@ -1536,9 +1536,10 @@ static void post_schedule_rt(struct rq *rq)
 	 * This is only called if needs_post_schedule_rt() indicates that
 	 * we need to push tasks away
 	 */
-	atomic_spin_lock_irq(&rq->lock);
+	unsigned long flags;
+	atomic_spin_lock_irqsave(&rq->lock, flags);
 	push_rt_tasks(rq);
-	atomic_spin_unlock_irq(&rq->lock);
+	atomic_spin_unlock_irqrestore(&rq->lock, flags);
 }
 
 /*
-- 
1.6.5.GIT


             reply	other threads:[~2009-11-16  4:49 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-16  4:49 Jupyung Lee [this message]
2009-11-16  5:33 Jupyung Lee

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=1258346959-7166-1-git-send-email-jupyung@gmail.com \
    --to=jupyung@gmail.com \
    --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®