Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 63489e45 authored by Steven Rostedt's avatar Steven Rostedt Committed by Ingo Molnar
Browse files

sched: count # of queued RT tasks



This patch adds accounting to keep track of the number of RT tasks running
on a runqueue. This information will be used in later patches.

Signed-off-by: default avatarSteven Rostedt <srostedt@redhat.com>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent 82a1fcb9
Loading
Loading
Loading
Loading
+1 −0
Original line number Original line Diff line number Diff line
@@ -342,6 +342,7 @@ struct rt_rq {
	struct rt_prio_array active;
	struct rt_prio_array active;
	int rt_load_balance_idx;
	int rt_load_balance_idx;
	struct list_head *rt_load_balance_head, *rt_load_balance_curr;
	struct list_head *rt_load_balance_head, *rt_load_balance_curr;
	unsigned long rt_nr_running;
};
};


/*
/*
+17 −0
Original line number Original line Diff line number Diff line
@@ -26,6 +26,19 @@ static void update_curr_rt(struct rq *rq)
	cpuacct_charge(curr, delta_exec);
	cpuacct_charge(curr, delta_exec);
}
}


static inline void inc_rt_tasks(struct task_struct *p, struct rq *rq)
{
	WARN_ON(!rt_task(p));
	rq->rt.rt_nr_running++;
}

static inline void dec_rt_tasks(struct task_struct *p, struct rq *rq)
{
	WARN_ON(!rt_task(p));
	WARN_ON(!rq->rt.rt_nr_running);
	rq->rt.rt_nr_running--;
}

static void enqueue_task_rt(struct rq *rq, struct task_struct *p, int wakeup)
static void enqueue_task_rt(struct rq *rq, struct task_struct *p, int wakeup)
{
{
	struct rt_prio_array *array = &rq->rt.active;
	struct rt_prio_array *array = &rq->rt.active;
@@ -33,6 +46,8 @@ static void enqueue_task_rt(struct rq *rq, struct task_struct *p, int wakeup)
	list_add_tail(&p->run_list, array->queue + p->prio);
	list_add_tail(&p->run_list, array->queue + p->prio);
	__set_bit(p->prio, array->bitmap);
	__set_bit(p->prio, array->bitmap);
	inc_cpu_load(rq, p->se.load.weight);
	inc_cpu_load(rq, p->se.load.weight);

	inc_rt_tasks(p, rq);
}
}


/*
/*
@@ -48,6 +63,8 @@ static void dequeue_task_rt(struct rq *rq, struct task_struct *p, int sleep)
	if (list_empty(array->queue + p->prio))
	if (list_empty(array->queue + p->prio))
		__clear_bit(p->prio, array->bitmap);
		__clear_bit(p->prio, array->bitmap);
	dec_cpu_load(rq, p->se.load.weight);
	dec_cpu_load(rq, p->se.load.weight);

	dec_rt_tasks(p, rq);
}
}


/*
/*