Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 58282
b: refs/heads/master
c: f2ac58e
h: refs/heads/master
v: v3
  • Loading branch information
Ingo Molnar committed Jul 9, 2007
1 parent 9d5d392 commit ccb90e7
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 98 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 45bf76df4814a4cd1c57226ae001c464467cb656
refs/heads/master: f2ac58ee617fd9f6cd9922fbcd291b661d7c9954
8 changes: 0 additions & 8 deletions trunk/include/linux/sched.h
Original file line number Diff line number Diff line change
Expand Up @@ -788,13 +788,6 @@ struct mempolicy;
struct pipe_inode_info;
struct uts_namespace;

enum sleep_type {
SLEEP_NORMAL,
SLEEP_NONINTERACTIVE,
SLEEP_INTERACTIVE,
SLEEP_INTERRUPTED,
};

struct prio_array;
struct rq;
struct sched_domain;
Expand Down Expand Up @@ -905,7 +898,6 @@ struct task_struct {
unsigned long sleep_avg;
unsigned long long timestamp, last_ran;
unsigned long long sched_time; /* sched_clock time spent running */
enum sleep_type sleep_type;

unsigned int policy;
cpumask_t cpus_allowed;
Expand Down
91 changes: 2 additions & 89 deletions trunk/kernel/sched.c
Original file line number Diff line number Diff line change
Expand Up @@ -990,32 +990,7 @@ static int recalc_task_prio(struct task_struct *p, unsigned long long now)
* with one single large enough sleep.
*/
p->sleep_avg = ceiling;
/*
* Using INTERACTIVE_SLEEP() as a ceiling places a
* nice(0) task 1ms sleep away from promotion, and
* gives it 700ms to round-robin with no chance of
* being demoted. This is more than generous, so
* mark this sleep as non-interactive to prevent the
* on-runqueue bonus logic from intervening should
* this task not receive cpu immediately.
*/
p->sleep_type = SLEEP_NONINTERACTIVE;
} else {
/*
* Tasks waking from uninterruptible sleep are
* limited in their sleep_avg rise as they
* are likely to be waiting on I/O
*/
if (p->sleep_type == SLEEP_NONINTERACTIVE && p->mm) {
if (p->sleep_avg >= ceiling)
sleep_time = 0;
else if (p->sleep_avg + sleep_time >=
ceiling) {
p->sleep_avg = ceiling;
sleep_time = 0;
}
}

/*
* This code gives a bonus to interactive tasks.
*
Expand Down Expand Up @@ -1069,29 +1044,6 @@ static void activate_task(struct task_struct *p, struct rq *rq, int local)
}

p->prio = recalc_task_prio(p, now);

/*
* This checks to make sure it's not an uninterruptible task
* that is now waking up.
*/
if (p->sleep_type == SLEEP_NORMAL) {
/*
* Tasks which were woken up by interrupts (ie. hw events)
* are most likely of interactive nature. So we give them
* the credit of extending their sleep time to the period
* of time they spend on the runqueue, waiting for execution
* on a CPU, first time around:
*/
if (in_interrupt())
p->sleep_type = SLEEP_INTERRUPTED;
else {
/*
* Normal first-time wakeups get a credit too for
* on-runqueue time, but it will be weighted down:
*/
p->sleep_type = SLEEP_INTERACTIVE;
}
}
p->timestamp = now;
out:
__activate_task(p, rq);
Expand Down Expand Up @@ -1641,23 +1593,8 @@ static int try_to_wake_up(struct task_struct *p, unsigned int state, int sync)

out_activate:
#endif /* CONFIG_SMP */
if (old_state == TASK_UNINTERRUPTIBLE) {
if (old_state == TASK_UNINTERRUPTIBLE)
rq->nr_uninterruptible--;
/*
* Tasks on involuntary sleep don't earn
* sleep_avg beyond just interactive state.
*/
p->sleep_type = SLEEP_NONINTERACTIVE;
} else

/*
* Tasks that have marked their sleep as noninteractive get
* woken up with their sleep average not weighted in an
* interactive way.
*/
if (old_state & TASK_NONINTERACTIVE)
p->sleep_type = SLEEP_NONINTERACTIVE;


activate_task(p, rq, cpu == this_cpu);
/*
Expand Down Expand Up @@ -3533,12 +3470,6 @@ EXPORT_SYMBOL(sub_preempt_count);

#endif

static inline int interactive_sleep(enum sleep_type sleep_type)
{
return (sleep_type == SLEEP_INTERACTIVE ||
sleep_type == SLEEP_INTERRUPTED);
}

/*
* schedule() is the main scheduler function.
*/
Expand All @@ -3549,7 +3480,7 @@ asmlinkage void __sched schedule(void)
struct list_head *queue;
unsigned long long now;
unsigned long run_time;
int cpu, idx, new_prio;
int cpu, idx;
long *switch_count;
struct rq *rq;

Expand Down Expand Up @@ -3642,24 +3573,6 @@ asmlinkage void __sched schedule(void)
queue = array->queue + idx;
next = list_entry(queue->next, struct task_struct, run_list);

if (!rt_task(next) && interactive_sleep(next->sleep_type)) {
unsigned long long delta = now - next->timestamp;
if (unlikely((long long)(now - next->timestamp) < 0))
delta = 0;

if (next->sleep_type == SLEEP_INTERACTIVE)
delta = delta * (ON_RUNQUEUE_WEIGHT * 128 / 100) / 128;

array = next->array;
new_prio = recalc_task_prio(next, next->timestamp + delta);

if (unlikely(next->prio != new_prio)) {
dequeue_task(next, array);
next->prio = new_prio;
enqueue_task(next, array);
}
}
next->sleep_type = SLEEP_NORMAL;
switch_tasks:
if (next == rq->idle)
schedstat_inc(rq, sched_goidle);
Expand Down

0 comments on commit ccb90e7

Please sign in to comment.