public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Michael Buesch <mbuesch@freenet.de>
To: linux-kernel@vger.kernel.org, ck@vds.kolivas.org
Cc: kernel@kolivas.org
Subject: [PATCH, RFC] protect call to set_tsk_need_resched() by the rq-lock
Date: Mon, 6 Dec 2004 23:39:47 +0100	[thread overview]
Message-ID: <200412062339.52695.mbuesch@freenet.de> (raw)


[-- Attachment #1.1: Type: text/plain, Size: 296 bytes --]

Hi,

The two attached patches (one against vanilla kernel and one
against ck patchset) moves the rq-lock a few lines up in
scheduler_tick() to also protect set_tsk_need_resched().

Is that neccessary?
If yes, please apply.

-- 
Regards Michael Buesch  [ http://www.tuxsoft.de.vu ]



[-- Attachment #1.2: mainline_sched-rqlock.diff --]
[-- Type: text/x-diff, Size: 821 bytes --]

Index: linux-2.5/kernel/sched.c
===================================================================
RCS file: /home/mb/develop/linux/rsync/linux-2.5/kernel/sched.c,v
retrieving revision 1.382
diff -u -p -r1.382 sched.c
--- linux-2.5/kernel/sched.c	19 Nov 2004 22:51:35 -0000	1.382
+++ linux-2.5/kernel/sched.c	6 Dec 2004 22:32:09 -0000
@@ -2318,12 +2318,12 @@ void scheduler_tick(int user_ticks, int 
 		cpustat->user += user_ticks;
 	cpustat->system += sys_ticks;
 
+	spin_lock(&rq->lock);
 	/* Task might have expired already, but not scheduled off yet */
 	if (p->array != rq->active) {
 		set_tsk_need_resched(p);
-		goto out;
+		goto out_unlock;
 	}
-	spin_lock(&rq->lock);
 	/*
 	 * The task was running during this tick - update the
 	 * time slice counter. Note: we do not update a thread's

[-- Attachment #1.3: staircase_sched-rqlock.diff --]
[-- Type: text/x-diff, Size: 754 bytes --]

--- linux-2.6.10-rc3-ck1-nozeroram/kernel/sched.c.orig	2004-12-05 01:55:08.000000000 +0100
+++ linux-2.6.10-rc3-ck1-nozeroram/kernel/sched.c	2004-12-06 23:27:41.000000000 +0100
@@ -2147,18 +2147,18 @@
 		cpustat->user += user_ticks;
 	cpustat->system += sys_ticks;
 
+	spin_lock(&rq->lock);
 	/* Task might have expired already, but not scheduled off yet */
 	if (unlikely(!task_queued(p))) {
 		set_tsk_need_resched(p);
-		goto out;
+		goto out_unlock;
 	}
 	/*
 	 * SCHED_FIFO tasks never run out of timeslice.
 	 */
 	if (unlikely(p->policy == SCHED_FIFO))
-		goto out;
+		goto out_unlock;
 
-	spin_lock(&rq->lock);
 	debit = ns_diff(rq->timestamp_last_tick, p->timestamp);
 	p->ns_debit += debit;
 	if (p->ns_debit < NSJIFFY)

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

             reply	other threads:[~2004-12-06 23:18 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-12-06 22:39 Michael Buesch [this message]
2004-12-07 13:10 ` [PATCH, RFC] protect call to set_tsk_need_resched() by the rq-lock Ingo Molnar
2004-12-07 23:30   ` Michael Buesch
2004-12-08  8:26     ` Ingo Molnar
2004-12-08  9:49       ` Michael Buesch
2004-12-08 10:29         ` Michael Buesch
2004-12-08 11:15         ` 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=200412062339.52695.mbuesch@freenet.de \
    --to=mbuesch@freenet.de \
    --cc=ck@vds.kolivas.org \
    --cc=kernel@kolivas.org \
    --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