Re: Knowing which task is current in a CPU [ SMP ]

Ove Ewerlid (Ove.Ewerlid@syscon.uu.se)
Wed, 07 Jul 1999 04:35:12 +0200


Hugo Varotto wrote:
>
> I'm trying to implement a resource scheduler for multiprocessors. This
> is used for real-time tasks, and a part of it requires me to to do a
> task partition ( decide to which processor assign a task, and control
> the inherent migration of the goodness() funtion ) based on the
> requirements of the task. Sometimes I have the problem that, due to the
> characteristics/requirements of a task, I need to move it from the CPU
> that is running to another ( that's where my problem comes, 'cause it's
> possible that other task besides the idle is running at that CPU, and I
> will need to suspend it, migrate the desired task, and force a
> reschedule on that CPU ).

Take a look into arch/XXX/kernel/smp.c at the function
smp_send_reschedule.
This (and the similar IPI functions) allows CPU X to send IPI interrupts
to CPU Y. As a warmup, write some code that instruments the IPI
interrupts. You will find that in 2.3.9 you have quite some number of
smp_send_reschedule. Notice the use of smp_send_reschedule in the
wake_up
routines.

Tips, add your own variables to the task struct (sched.h) to mark your
processes, then write code that only deals with your processes. In this
way
you will at least get a system that boots and works until you enable
your "hacks" (using what ever means you choose to control your hacks).

Ove

-- 
Ove Ewerlid
Ove.Ewerlid@syscon.uu.se or Ove.Ewerlid@signal.uu.se
Phone: +46 70 666 23 63, Fax: +46 18 503 611, +46 18 555 096

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/