From: Con Kolivas <kernel@kolivas.org>
To: linux kernel mailing list <linux-kernel@vger.kernel.org>
Cc: Andrew Morton <akpm@osdl.org>
Subject: [PATCH] O16.2int
Date: Sat, 16 Aug 2003 19:02:52 +1000 [thread overview]
Message-ID: <200308161902.52337.kernel@kolivas.org> (raw)
[-- Attachment #1: Type: text/plain, Size: 18 bytes --]
Much simpler
Con
[-- Attachment #2: patch-O16.1-O16.2int --]
[-- Type: text/x-diff, Size: 2799 bytes --]
--- linux-2.6.0-test3-mm2-O16/kernel/sched.c 2003-08-16 17:38:49.000000000 +1000
+++ linux-2.6.0-test3-mm2-O16.2/kernel/sched.c 2003-08-16 17:38:28.000000000 +1000
@@ -143,6 +143,9 @@
#define VARYING_CREDIT(p) \
(!(HIGH_CREDIT(p) || LOW_CREDIT(p)))
+#define TASK_PREEMPTS_CURR(p, rq) \
+ ((p)->prio < (rq)->curr->prio)
+
/*
* BASE_TIMESLICE scales user-nice values [ -20 ... 19 ]
* to time slice values.
@@ -463,24 +466,15 @@ static inline void activate_task(task_t
* of time they spend on the runqueue, waiting for execution
* on a CPU, first time around:
*/
- if (in_interrupt()){
+ if (in_interrupt())
p->activated = 2;
- p->waker = p;
- } else {
+ else
/*
* Normal first-time wakeups get a credit too for on-runqueue
* time, but it will be weighted down:
*/
p->activated = 1;
- p->waker = current;
}
- } else {
- if (in_interrupt())
- p->waker = p;
- else
- p->waker = current;
- }
-
p->timestamp = now;
__activate_task(p, rq);
@@ -564,20 +558,6 @@ repeat:
}
#endif
-static inline int task_preempts_curr(task_t *p, runqueue_t *rq)
-{
- if (p->prio < rq->curr->prio) {
- /*
- * Prevent a task preempting it's own waker
- * to avoid starvation
- */
- if (unlikely(rq->curr == p->waker))
- return 0;
- return 1;
- }
- return 0;
-}
-
/***
* try_to_wake_up - wake up a thread
* @p: the to-be-woken-up thread
@@ -629,8 +609,9 @@ repeat_lock_task:
__activate_task(p, rq);
else {
activate_task(p, rq);
- if (task_preempts_curr(p, rq))
- resched_task(rq->curr);
+ if (TASK_PREEMPTS_CURR(p, rq) &&
+ (in_interrupt() || !p->mm))
+ resched_task(rq->curr);
}
success = 1;
}
@@ -684,7 +665,6 @@ void wake_up_forked_process(task_t * p)
p->sleep_avg = JIFFIES_TO_NS(CURRENT_BONUS(p) *
CHILD_PENALTY / 100 * MAX_SLEEP_AVG / MAX_BONUS);
- p->waker = p->parent;
p->interactive_credit = 0;
p->prio = effective_prio(p);
@@ -1131,7 +1111,7 @@ static inline void pull_task(runqueue_t
* Note that idle threads have a prio of MAX_PRIO, for this test
* to be always true for them.
*/
- if (task_preempts_curr(p, this_rq))
+ if (TASK_PREEMPTS_CURR(p, this_rq))
set_need_resched();
}
--- linux-2.6.0-test3-mm2-O16/include/linux/sched.h 2003-08-15 15:18:36.000000000 +1000
+++ linux-2.6.0-test3-mm2-O16.2/include/linux/sched.h 2003-08-16 17:39:20.000000000 +1000
@@ -378,7 +378,6 @@ struct task_struct {
*/
struct task_struct *real_parent; /* real parent process (when being debugged) */
struct task_struct *parent; /* parent process */
- struct task_struct *waker; /* waker process */
struct list_head children; /* list of my children */
struct list_head sibling; /* linkage in my parent's children list */
struct task_struct *group_leader;
next reply other threads:[~2003-08-16 8:56 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-08-16 9:02 Con Kolivas [this message]
2003-08-16 13:29 ` [PATCH] O16.2int Wiktor Wodecki
2003-08-17 7:40 ` Andrew Morton
2003-08-17 9:30 ` Con Kolivas
2003-08-17 14:59 ` Con Kolivas
2003-08-17 21:06 ` Andrew Morton
-- strict thread matches above, loose matches on Subject: below --
2003-08-16 11:07 Voluspa
2003-08-16 14:09 ` Con Kolivas
2003-08-16 14:41 ` Nick Piggin
2003-08-16 15:00 ` Con Kolivas
2003-08-16 14:44 ` Voluspa
2003-08-17 20:37 Benjamin Weber
2003-08-17 21:47 ` Tom Sightler
2003-08-18 1:21 ` Con Kolivas
2003-08-18 16:51 ` Antonio Vargas
2003-08-18 23:47 ` Con Kolivas
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=200308161902.52337.kernel@kolivas.org \
--to=kernel@kolivas.org \
--cc=akpm@osdl.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 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.