2003-03-26 05:12:44

by Perez-Gonzalez, Inaky

[permalink] [raw]
Subject: How to force another (FIFO) task to yield from inside the kernel?


Hi All

I am dealing with this problem and it is time to ask (read the source
already). I have this in the rtfutex priority inheritance code: when task A
boosts task B's priority (both FIFO), task B runs with A's priority until B
decides to stop waiting for A to finish (ie: timeout/signal).

Then, task A goes through timer.c:process_timeout() [did not verify the
signal path yet] and gets woken up; however, I need to force B to yield to
give A a chance to run so it can boost down B to the proper place (doing the
boost down from process_timeout() is kind of a no-no).

I tried kick_if_running(), resched_task() and friends and they would work
sometimes, some not [what means it is not the right answer] - so I realized
I need to ask it to yield more convincently. The question is: how?

yield() does not work, as it assumes that the current task is the one to
yield. Is the only solution to craft another version of sys_sched_yield() to
do other tasks?

I am using 2.5.64 (the code is in http://sost.net/pub/linux/rtfutex*). Be
advised cut 4 has now some changes versus my current WIP; but the structure
is very similar (timer.c:process_timeout() calls
rtfutex.c:__rtfutex_yield_boosted() with tries to force task B to yield).

Thanks :)

I?aky P?rez-Gonz?lez -- Not speaking for Intel -- all opinions are my own
(and my fault)