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>,
Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: Machine Freezes while Running Crossover Office
Date: Tue, 31 May 2005 08:54:56 +0200 [thread overview]
Message-ID: <20050531065456.GA21948@elte.hu> (raw)
In-Reply-To: <courier.429C05C1.00005CC5@courier.cs.helsinki.fi>
* Pekka J Enberg <penberg@cs.helsinki.fi> wrote:
> Looks if the processes keep on waking up each other and thus eat up
> all CPU time. (Even more so if Crossover uses RT priority, have to
> check that.)
another possible effect would be the interactivity code: the Wine
processes gaining high priority via their scheduling pattern. I've
attached a patch to make it runtime switchable (see more details below).
> P.S. I can also verify that it is indeed the 64 KB change that breaks
> Crossover. I changed PIPE_BUFFERS to 1 and could not reproduce the
> hang. Increasing it to 8 makes the problem come up again.
very interesting. This should not have any direct effect on scheduling
correctness - but it might change the patterns and hence the priorities.
A couple of things to try:
- run the Wine processes with nice +19 priority? (just to check
whether it's the interactivity code. After you've made sure they dont
have RT priorities.)
- renice -20 the X server process
- run a shell-script with RT priority that captures 'ps aux' every
second or so:
chrt -f -p 1 $$ # switch shell to RT-SCHED_FIFO-prio-1
rm -f log.txt
while sleep 1; do
date
ps -eo pid,tid,class,rtprio,ni,pri,psr,pcpu,stat,wchan:14,comm
done > log.txt
(chrt comes from the schedutils package) Then send us log.txt and
identify the date where the 'hang' occured. (the hang will probably not
occur in this measurement script running at RT priority)
- apply the patch below and check whether doing:
echo 0 > /proc/sys/kernel/interactive
makes the hang go away.
- if the hang goes away then could you check whether removing the 2 new
sched_interactive lines in kernel/sched.c's effective_prio() function
(but keeping other portions of the patch applied) hang or not.
Ingo
--
hack to make the interactivity code runtime-switchable.
From: Con Kolivas <kernel@kolivas.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
--- linux/kernel/sched.c.orig
+++ linux/kernel/sched.c
@@ -144,8 +144,8 @@
#define DELTA(p) \
(SCALE(TASK_NICE(p), 40, MAX_BONUS) + INTERACTIVE_DELTA)
-#define TASK_INTERACTIVE(p) \
- ((p)->prio <= (p)->static_prio - DELTA(p))
+#define TASK_INTERACTIVE(p) ((sched_interactive) && \
+ ((p)->prio <= (p)->static_prio - DELTA(p)))
#define INTERACTIVE_SLEEP(p) \
(JIFFIES_TO_NS(MAX_SLEEP_AVG * \
@@ -574,6 +574,13 @@ static inline void enqueue_task_head(str
}
/*
+ * This is a sysctl which allows dynamic priorities to be applied based on
+ * interactive behaviour, and selective interactive reinsertion into the
+ * active array despite timeslice expiration.
+ */
+int sched_interactive = 0;
+
+/*
* effective_prio - return the priority that is based on the static
* priority but is modified by bonuses/penalties.
*
@@ -594,6 +601,10 @@ static int effective_prio(task_t *p)
if (rt_task(p))
return p->prio;
+ /* Dynamic priorities are not used with interactive mode off */
+ if (!sched_interactive)
+ return p->static_prio;
+
bonus = CURRENT_BONUS(p) - MAX_BONUS / 2;
prio = p->static_prio - bonus;
--- linux/kernel/sysctl.c.orig
+++ linux/kernel/sysctl.c
@@ -836,6 +836,14 @@ static ctl_table vm_table[] = {
.strategy = &sysctl_jiffies,
},
#endif
+ {
+ .ctl_name = KERN_INTERACTIVE,
+ .procname = "interactive",
+ .data = &sched_interactive,
+ .maxlen = sizeof (int),
+ .mode = 0644,
+ .proc_handler = &proc_dointvec,
+ },
{ .ctl_name = 0 }
};
--- linux/include/linux/sysctl.h.orig
+++ linux/include/linux/sysctl.h
@@ -136,6 +136,7 @@ enum
KERN_UNKNOWN_NMI_PANIC=66, /* int: unknown nmi panic flag */
KERN_BOOTLOADER_TYPE=67, /* int: boot loader type */
KERN_RANDOMIZE=68, /* int: randomize virtual address space */
+ KERN_INTERACTIVE=69, /* int: dynamic priorities */
};
--- linux/include/linux/sched.h.orig
+++ linux/include/linux/sched.h
@@ -839,6 +839,7 @@ extern int task_curr(const task_t *p);
extern int idle_cpu(int cpu);
extern int sched_setscheduler(struct task_struct *, int, struct sched_param *);
extern task_t *idle_task(int cpu);
+extern int sched_interactive;
void yield(void);
next prev parent reply other threads:[~2005-05-31 6:55 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 [this message]
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 ` [patch] TASK_NONINTERACTIVE (was: Machine Freezes while Running Crossover Office) Ingo Molnar
2005-06-01 8:42 ` 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=20050531065456.GA21948@elte.hu \
--to=mingo@elte.hu \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox