aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/sched.c
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2007-07-09 12:51:59 -0400
committerIngo Molnar <mingo@elte.hu>2007-07-09 12:51:59 -0400
commit71f8bd4600521fecb08644072052b85853a5a615 (patch)
tree4d0a963ee30df7a1f64fc8f5c0a6b2f8e541952a /kernel/sched.c
parentc24d20dbef948487cd14f15dbf04644142e9f886 (diff)
sched: cleanup: move dequeue/enqueue_task()
cleanup: move dequeue/enqueue_task() to a more logical place, to not split up __normal_prio()/normal_prio(). Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel/sched.c')
-rw-r--r--kernel/sched.c76
1 files changed, 38 insertions, 38 deletions
diff --git a/kernel/sched.c b/kernel/sched.c
index e642bfa61fe3..683d2a524e61 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -672,44 +672,6 @@ static inline void resched_task(struct task_struct *p)
672#include "sched_stats.h" 672#include "sched_stats.h"
673 673
674/* 674/*
675 * Adding/removing a task to/from a priority array:
676 */
677static void dequeue_task(struct task_struct *p, struct prio_array *array)
678{
679 array->nr_active--;
680 list_del(&p->run_list);
681 if (list_empty(array->queue + p->prio))
682 __clear_bit(p->prio, array->bitmap);
683}
684
685static void enqueue_task(struct task_struct *p, struct prio_array *array)
686{
687 sched_info_queued(p);
688 list_add_tail(&p->run_list, array->queue + p->prio);
689 __set_bit(p->prio, array->bitmap);
690 array->nr_active++;
691 p->array = array;
692}
693
694/*
695 * Put task to the end of the run list without the overhead of dequeue
696 * followed by enqueue.
697 */
698static void requeue_task(struct task_struct *p, struct prio_array *array)
699{
700 list_move_tail(&p->run_list, array->queue + p->prio);
701}
702
703static inline void
704enqueue_task_head(struct task_struct *p, struct prio_array *array)
705{
706 list_add(&p->run_list, array->queue + p->prio);
707 __set_bit(p->prio, array->bitmap);
708 array->nr_active++;
709 p->array = array;
710}
711
712/*
713 * __normal_prio - return the priority that is based on the static 675 * __normal_prio - return the priority that is based on the static
714 * priority but is modified by bonuses/penalties. 676 * priority but is modified by bonuses/penalties.
715 * 677 *
@@ -803,6 +765,44 @@ static inline void dec_nr_running(struct task_struct *p, struct rq *rq)
803} 765}
804 766
805/* 767/*
768 * Adding/removing a task to/from a priority array:
769 */
770static void dequeue_task(struct task_struct *p, struct prio_array *array)
771{
772 array->nr_active--;
773 list_del(&p->run_list);
774 if (list_empty(array->queue + p->prio))
775 __clear_bit(p->prio, array->bitmap);
776}
777
778static void enqueue_task(struct task_struct *p, struct prio_array *array)
779{
780 sched_info_queued(p);
781 list_add_tail(&p->run_list, array->queue + p->prio);
782 __set_bit(p->prio, array->bitmap);
783 array->nr_active++;
784 p->array = array;
785}
786
787/*
788 * Put task to the end of the run list without the overhead of dequeue
789 * followed by enqueue.
790 */
791static void requeue_task(struct task_struct *p, struct prio_array *array)
792{
793 list_move_tail(&p->run_list, array->queue + p->prio);
794}
795
796static inline void
797enqueue_task_head(struct task_struct *p, struct prio_array *array)
798{
799 list_add(&p->run_list, array->queue + p->prio);
800 __set_bit(p->prio, array->bitmap);
801 array->nr_active++;
802 p->array = array;
803}
804
805/*
806 * Calculate the expected normal priority: i.e. priority 806 * Calculate the expected normal priority: i.e. priority
807 * without taking RT-inheritance into account. Might be 807 * without taking RT-inheritance into account. Might be
808 * boosted by interactivity modifiers. Changes upon fork, 808 * boosted by interactivity modifiers. Changes upon fork,