The following function is defined in ./kernel/sched/rt.c(v3.5.4):
static void enqueue_pushable_task(struct rq *rq, struct task_struct *p)
{
plist_del(&p->pushable_tasks, &rq->rt.pushable_tasks);
plist_node_init(&p->pushable_tasks, p->prio);
plist_add(&p->pushable_tasks, &rq->rt.pushable_tasks);
/* Update the highest prio pushable task */
if (p->prio < rq->rt.highest_prio.next)
rq->rt.highest_prio.next = p->prio;
}
What I am unable to understand is that why does one want to add and delete the same node form the same list over and over. First a node is deleted from the list by plist_del and same node is added to the same list by plist_add function. Any particular reasons why this is done
When the priority of a task changes, its position in the priority list must also change.