Commit cad60d93 authored by Ingo Molnar's avatar Ingo Molnar

[PATCH] sched: ->task_new cleanup

make sched_class.task_new == NULL a 'default method', this
allows the removal of task_rt_new.
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent 4e6f96f3
...@@ -874,7 +874,7 @@ struct sched_class { ...@@ -874,7 +874,7 @@ struct sched_class {
void (*set_curr_task) (struct rq *rq); void (*set_curr_task) (struct rq *rq);
void (*task_tick) (struct rq *rq, struct task_struct *p); void (*task_tick) (struct rq *rq, struct task_struct *p);
void (*task_new) (struct rq *rq, struct task_struct *p); void (*task_new) (struct rq *rq, struct task_struct *p, u64 now);
}; };
struct load_weight { struct load_weight {
......
...@@ -1641,22 +1641,27 @@ void fastcall wake_up_new_task(struct task_struct *p, unsigned long clone_flags) ...@@ -1641,22 +1641,27 @@ void fastcall wake_up_new_task(struct task_struct *p, unsigned long clone_flags)
unsigned long flags; unsigned long flags;
struct rq *rq; struct rq *rq;
int this_cpu; int this_cpu;
u64 now;
rq = task_rq_lock(p, &flags); rq = task_rq_lock(p, &flags);
BUG_ON(p->state != TASK_RUNNING); BUG_ON(p->state != TASK_RUNNING);
this_cpu = smp_processor_id(); /* parent's CPU */ this_cpu = smp_processor_id(); /* parent's CPU */
now = rq_clock(rq);
p->prio = effective_prio(p); p->prio = effective_prio(p);
if (!sysctl_sched_child_runs_first || (clone_flags & CLONE_VM) || if (!p->sched_class->task_new || !sysctl_sched_child_runs_first ||
task_cpu(p) != this_cpu || !current->se.on_rq) { (clone_flags & CLONE_VM) || task_cpu(p) != this_cpu ||
!current->se.on_rq) {
activate_task(rq, p, 0); activate_task(rq, p, 0);
} else { } else {
/* /*
* Let the scheduling class do new task startup * Let the scheduling class do new task startup
* management (if any): * management (if any):
*/ */
p->sched_class->task_new(rq, p); p->sched_class->task_new(rq, p, now);
inc_nr_running(p, rq, now);
} }
check_preempt_curr(rq, p); check_preempt_curr(rq, p);
task_rq_unlock(rq, &flags); task_rq_unlock(rq, &flags);
......
...@@ -1041,11 +1041,10 @@ static void task_tick_fair(struct rq *rq, struct task_struct *curr) ...@@ -1041,11 +1041,10 @@ static void task_tick_fair(struct rq *rq, struct task_struct *curr)
* monopolize the CPU. Note: the parent runqueue is locked, * monopolize the CPU. Note: the parent runqueue is locked,
* the child is not running yet. * the child is not running yet.
*/ */
static void task_new_fair(struct rq *rq, struct task_struct *p) static void task_new_fair(struct rq *rq, struct task_struct *p, u64 now)
{ {
struct cfs_rq *cfs_rq = task_cfs_rq(p); struct cfs_rq *cfs_rq = task_cfs_rq(p);
struct sched_entity *se = &p->se; struct sched_entity *se = &p->se;
u64 now = rq_clock(rq);
sched_info_queued(p); sched_info_queued(p);
...@@ -1072,7 +1071,6 @@ static void task_new_fair(struct rq *rq, struct task_struct *p) ...@@ -1072,7 +1071,6 @@ static void task_new_fair(struct rq *rq, struct task_struct *p)
p->se.wait_runtime = -(sysctl_sched_granularity / 2); p->se.wait_runtime = -(sysctl_sched_granularity / 2);
__enqueue_entity(cfs_rq, se); __enqueue_entity(cfs_rq, se);
inc_nr_running(p, rq, now);
} }
#ifdef CONFIG_FAIR_GROUP_SCHED #ifdef CONFIG_FAIR_GROUP_SCHED
......
...@@ -229,15 +229,6 @@ static void task_tick_rt(struct rq *rq, struct task_struct *p) ...@@ -229,15 +229,6 @@ static void task_tick_rt(struct rq *rq, struct task_struct *p)
requeue_task_rt(rq, p); requeue_task_rt(rq, p);
} }
/*
* No parent/child timeslice management necessary for RT tasks,
* just activate them:
*/
static void task_new_rt(struct rq *rq, struct task_struct *p)
{
activate_task(rq, p, 1);
}
static struct sched_class rt_sched_class __read_mostly = { static struct sched_class rt_sched_class __read_mostly = {
.enqueue_task = enqueue_task_rt, .enqueue_task = enqueue_task_rt,
.dequeue_task = dequeue_task_rt, .dequeue_task = dequeue_task_rt,
...@@ -251,5 +242,4 @@ static struct sched_class rt_sched_class __read_mostly = { ...@@ -251,5 +242,4 @@ static struct sched_class rt_sched_class __read_mostly = {
.load_balance = load_balance_rt, .load_balance = load_balance_rt,
.task_tick = task_tick_rt, .task_tick = task_tick_rt,
.task_new = task_new_rt,
}; };
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment