From: Ingo Molnar <mingo@elte.hu>
To: Pekka J Enberg <penberg@cs.helsinki.fi>
Cc: Linus Torvalds <torvalds@osdl.org>,
Pekka Enberg <penberg@gmail.com>, Andrew Morton <akpm@osdl.org>,
Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: [patch] TASK_NONINTERACTIVE (was: Machine Freezes while Running Crossover Office)
Date: Wed, 1 Jun 2005 09:35:44 +0200 [thread overview]
Message-ID: <20050601073544.GA21384@elte.hu> (raw)
In-Reply-To: <courier.429C05C1.00005CC5@courier.cs.helsinki.fi>
Pekka, could you check whether the patch below solves your Wine problem
(without hurting interactivity otherwise)?
Ingo
----
this patch implements a task state bit (TASK_NONINTERACTIVE), which can
be used by blocking points to mark the task's wait as "non-interactive".
This does not mean the task will be considered a CPU-hog - the wait will
simply not have an effect on the waiting task's priority - positive or
negative alike. Right now only pipe_wait() will make use of it, because
it's a common source of not-so-interactive waits (kernel compilation
jobs, etc.).
Signed-off-by: Ingo Molnar <mingo@elte.hu>
--- linux/fs/pipe.c.orig
+++ linux/fs/pipe.c
@@ -39,7 +39,11 @@ void pipe_wait(struct inode * inode)
{
DEFINE_WAIT(wait);
- prepare_to_wait(PIPE_WAIT(*inode), &wait, TASK_INTERRUPTIBLE);
+ /*
+ * Pipes are system-local resources, so sleeping on them
+ * is considered a noninteractive wait:
+ */
+ prepare_to_wait(PIPE_WAIT(*inode), &wait, TASK_INTERRUPTIBLE|TASK_NONINTERACTIVE);
up(PIPE_SEM(*inode));
schedule();
finish_wait(PIPE_WAIT(*inode), &wait);
--- linux/kernel/sched.c.orig
+++ linux/kernel/sched.c
@@ -1085,6 +1085,16 @@ out_activate:
}
/*
+ * Tasks that have marked their sleep as noninteractive get
+ * woken up without updating their sleep average. (i.e. their
+ * sleep is handled in a priority-neutral manner, no priority
+ * boost and no penalty.)
+ */
+ if (old_state & TASK_NONINTERACTIVE)
+ __activate_task(p, rq);
+ else
+ activate_task(p, rq, cpu == this_cpu);
+ /*
* Sync wakeups (i.e. those types of wakeups where the waker
* has indicated that it will leave the CPU in short order)
* don't trigger a preemption, if the woken up task will run on
@@ -1092,7 +1102,6 @@ out_activate:
* the waker guarantees that the freshly woken up task is going
* to be considered on this CPU.)
*/
- activate_task(p, rq, cpu == this_cpu);
if (!sync || cpu != this_cpu) {
if (TASK_PREEMPTS_CURR(p, rq))
resched_task(rq->curr);
--- linux/include/linux/sched.h.orig
+++ linux/include/linux/sched.h
@@ -112,6 +112,7 @@ extern unsigned long nr_iowait(void);
#define TASK_TRACED 8
#define EXIT_ZOMBIE 16
#define EXIT_DEAD 32
+#define TASK_NONINTERACTIVE 64
#define __set_task_state(tsk, state_value) \
do { (tsk)->state = (state_value); } while (0)
next prev parent reply other threads:[~2005-06-01 7:39 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-05-28 14:46 [PROBLEM] Machine Freezes while Running Crossover Office Pekka Enberg
2005-05-29 18:12 ` Linus Torvalds
2005-05-29 18:20 ` Pekka Enberg
2005-05-29 18:49 ` Linus Torvalds
2005-05-29 20:49 ` Pekka Enberg
2005-05-29 22:59 ` Linus Torvalds
2005-05-29 23:06 ` Kyle Moffett
2005-05-30 15:23 ` Pekka Enberg
2005-05-30 17:31 ` Linus Torvalds
2005-05-30 18:07 ` Kyle Moffett
2005-05-30 18:22 ` Ingo Molnar
2005-05-30 18:22 ` Linus Torvalds
2005-05-30 18:25 ` Linus Torvalds
2005-05-30 19:12 ` Ingo Molnar
2005-05-31 13:54 ` Greg Stark
2005-05-31 6:15 ` Pekka J Enberg
2005-05-31 6:35 ` Pekka J Enberg
2005-05-31 6:54 ` Ingo Molnar
2005-05-31 16:53 ` Pekka Enberg
2005-05-31 17:24 ` Linus Torvalds
2005-05-31 18:41 ` Ingo Molnar
2005-05-31 21:20 ` Pekka Enberg
2005-06-01 0:07 ` Con Kolivas
2005-06-01 2:31 ` David Lang
2005-06-01 7:35 ` Ingo Molnar [this message]
2005-06-01 8:42 ` TASK_NONINTERACTIVE (was: Machine Freezes while Running Crossover Office) Pekka J Enberg
2005-06-01 8:55 ` [patch] " Con Kolivas
2005-06-01 10:26 ` Pekka J Enberg
2005-06-01 18:06 ` [patch] " Gene Heskett
2005-06-03 8:34 ` Pekka J Enberg
2005-06-03 10:57 ` Ingo Molnar
2005-06-07 13:14 ` Pekka Enberg
2005-10-17 15:10 ` [patch] " Pekka Enberg
2005-10-17 15: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=20050601073544.GA21384@elte.hu \
--to=mingo@elte.hu \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=penberg@cs.helsinki.fi \
--cc=penberg@gmail.com \
--cc=torvalds@osdl.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 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.