* Scheduling policy
@ 2011-04-04 13:13 Laurențiu Dascălu
2011-04-04 15:36 ` Daniel Baluta
0 siblings, 1 reply; 2+ messages in thread
From: Laurențiu Dascălu @ 2011-04-04 13:13 UTC (permalink / raw)
To: kernelnewbies
Hello,
I'm trying to implement a simple scheduling policy in the Linux kernel,
but I'm not sure if I correctly understand the sched_class interface.
Specifically, I would like to know more about the following functions:
* put_prev_task(struct rq *rq, struct task_struct *prev)
Q: It means the prev was preempted and I have to reschedule another
task? Or I have just to add prev to the running queue?
The code should look something like:
if (prev->se.on_rq)
{
enqueue_task(rq, prev);
}
or I'm wrong?
* task_tick(struct rq *rq, struct task_struct *p, int queued)
Q: Should I preempt the task p, by calling resched_task? What does
"queued" means?
Thanks,
--
Lauren?iu Dasc?lu
^ permalink raw reply [flat|nested] 2+ messages in thread
* Scheduling policy
2011-04-04 13:13 Scheduling policy Laurențiu Dascălu
@ 2011-04-04 15:36 ` Daniel Baluta
0 siblings, 0 replies; 2+ messages in thread
From: Daniel Baluta @ 2011-04-04 15:36 UTC (permalink / raw)
To: kernelnewbies
On Mon, Apr 4, 2011 at 4:13 PM, Lauren?iu Dasc?lu
<dascalu.laurentziu@gmail.com> wrote:
> Hello,
>
> I'm trying to implement a simple scheduling policy in the Linux kernel,
> but I'm not sure if I correctly understand the sched_class interface.
> Specifically, I would like to know more about the following functions:
There's some useful information about sched_class interface
inside [1], check 'Scheduler Classes', page 89.
>
> * put_prev_task(struct rq *rq, struct task_struct *prev)
> Q: It means the prev was preempted and I have to reschedule another
> task? Or I have just to add prev to the running queue?
put_prev_task first announces to the scheduler class that the currently running
task is going to be replaced by another one.
So I guess, that prev was preempted but it is still in the running queue. Now
the scheduler has to dequeue it, and to schedule another task.
>
> The code should look something like:
>
> if (prev->se.on_rq)
> {
> ? enqueue_task(rq, prev);
> }
>
> or I'm wrong?
Why do you want to enqueue prev? Isn't rq supposed to hold
the current running tasks?
> * task_tick(struct rq *rq, struct task_struct *p, int queued)
> Q: Should I preempt the task p, by calling resched_task? What does
> "queued" means?
thanks,
Daniel.
[1] Professional Linux Kernel Architecture, W. Mauerer
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-04-04 15:36 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-04-04 13:13 Scheduling policy Laurențiu Dascălu
2011-04-04 15:36 ` Daniel Baluta
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).