public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* highest and lowest priority job of a runqueue
@ 2007-07-25  9:48 Martin Roehricht
  0 siblings, 0 replies; 2+ messages in thread
From: Martin Roehricht @ 2007-07-25  9:48 UTC (permalink / raw)
  To: linux-kernel

Hi,

I have some questions concerning the current 2.6.22 scheduler 
implementation. I was wondering how I may retrieve
(a) the priority/load of the highest and the lowest priority task of a
    runqueue (in a multiprocessor system), and
(b) the corresponding pointer to this task?

I thought I might use (given a list with tmp pointers to all CPUs)
	rq = cpu_rq(tmp->cpu);
	task_load = rq->curr->load_weight;
but this always returns 128 regardless of the fact if a task currently
runs on that CPU or not. I guess it returns the load of the migration
thread, but I'm not sure. I would like to migrate specific tasks
throughout find_busiest_group().

Furthermore, is it correct, that the current migration strategy
(move_tasks()) chooses automatically the highest priority task?

Thanks for your help,
Martin

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: highest and lowest priority job of a runqueue
       [not found] <8KLFD-G9-5@gated-at.bofh.it>
@ 2007-07-25 15:18 ` Martin Roehricht
  0 siblings, 0 replies; 2+ messages in thread
From: Martin Roehricht @ 2007-07-25 15:18 UTC (permalink / raw)
  To: linux-kernel; +Cc: mingo

On 07/25/2007 11:50 AM, Martin Roehricht wrote:
> I thought I might use (given a list with tmp pointers to all CPUs)
> 	rq = cpu_rq(tmp->cpu);
> 	task_load = rq->curr->load_weight;
> but this always returns 128 regardless of the fact if a task currently
> runs on that CPU or not. I guess it returns the load of the migration
> thread, but I'm not sure. I would like to migrate specific tasks
> throughout find_busiest_group().

Okay, I think I found that my assumption should be just fine and I had 
trouble with some debugging output via the show_schedstat() function.
The "rq->curr->load_weight" returns what it is supposed to return. :-)

I am still uncertain on how to resolve the specific highest or lowest 
priority job:
> I was wondering how I may retrieve
> (a) the priority/load of the highest and the lowest priority task of a
>     runqueue (in a multiprocessor system), and
> (b) the corresponding pointer to this task?

I will try something of the form (pseudocode like):

int idx;
struct list_head *head;
struct task_struct *task;

idx = sched_find_first_bit(rq->active->bitmap);
head = array->queue + idx;
task = list_entry(head, struct task_struct, run_list);

For the lowest priority task a function like "sched_find_last_bit()" 
might be useful.
Would this be a good way to succeed?

> Furthermore, is it correct, that the current migration strategy
> (move_tasks()) chooses automatically the highest priority task?

Thanks,
Martin

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-07-25 15:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-25  9:48 highest and lowest priority job of a runqueue Martin Roehricht
     [not found] <8KLFD-G9-5@gated-at.bofh.it>
2007-07-25 15:18 ` Martin Roehricht

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox