Linux-kernel mailing list archive 1999-23,: Re: New semaphore __wake_up() implementation ...

# Re: New semaphore __wake_up() implementation ...

Andrea Arcangeli (andrea@suse.de)
Fri, 11 Jun 1999 04:20:57 +0200 (CEST)

- Messages sorted by: [ date ][ thread ][ subject ][ author ]
- Next message: B. James Phillippe: "Re: inlines not showing up..."
- Previous message: Keith Owens: "Re: booting secondary kernels"
- In reply to: Davide Libenzi: "New semaphore __wake_up() implementation ..."
- Next in thread: V Ganesh: "Re: New semaphore __wake_up() implementation ..."

On Fri, 11 Jun 1999, Davide Libenzi wrote:

>I've modified the "up" routine coded in file sched.c to get
>more speed and, IMVHO more correctness.
>Previous code in __wake_up() release all task that ( except one )
>goes immediatly scheduled.
>Given:
>
>N = Number of tasks in runqueue
>M = Number of tasks in semaphore queue
>L = The cost of linear scan of wait queue of semaphore
>W = The cost of a wakeup() operation
>S = The cost of a schedule() search of next to run
>
>the total cost of a "up" operation is:
>
>TCo = L + M * W + (M - 1) * S

The above is wrong. __wake_up in general only does a wake_up_process() for
the number of tasks in the waitqueue.

>My new implementation release only the best suitable process to run,
>resulting in a cost:

The most suitable process to run in general is the last one inserted in
the waitqueue even if is going to expire its timeslice because it has more
probability to be still in cache. Anyway this is an issue only for
TASK_EXCLUSIVE sleeps, if they are not EXCLUSIVE you _must_ wake up all
tasks in the runqueue (in LIFO order too even if you won't be sure that
the task that goes ahead will be the last running one). (really in some
case like flock() probably it woud be better to do a FIFO wakeup but this
is another issue)

Andrea Arcangeli

-
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/

- Next message: B. James Phillippe: "Re: inlines not showing up..."
- Previous message: Keith Owens: "Re: booting secondary kernels"
- In reply to: Davide Libenzi: "New semaphore __wake_up() implementation ..."
- Next in thread: V Ganesh: "Re: New semaphore __wake_up() implementation ..."