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

# New semaphore __wake_up() implementation ...

Davide Libenzi (dlibenzi@maticad.it)
Fri, 11 Jun 1999 03:45:53 +0200 (CEST)

- Messages sorted by: [ date ][ thread ][ subject ][ author ]
- Next message: Bradley M Keryan: "Re: Partition nightmare Was: Migrating to larger numbers"
- Previous message: Vassili Leonov: "A silly 2.2 question"
- Next in thread: Andrea Arcangeli: "Re: New semaphore __wake_up() implementation ..."
- Reply: Andrea Arcangeli: "Re: New semaphore __wake_up() implementation ..."
- Reply: V Ganesh: "Re: New semaphore __wake_up() implementation ..."
- Reply: Davide Libenzi: "Re: New semaphore __wake_up() implementation ..."
- Reply: Davide Libenzi: "Re: New semaphore __wake_up() implementation ..."
- Reply: V Ganesh: "Re: New semaphore __wake_up() implementation ..."
- Reply: Mark Hull-Richter: "Re: New semaphore __wake_up() implementation ..."
- Reply: Davide Libenzi: "Re: New semaphore __wake_up() implementation ..."
- Reply: Davide Libenzi: "Re: New semaphore __wake_up() implementation ..."
- Reply: V Ganesh: "Re: New semaphore __wake_up() implementation ..."

Hi guys,

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

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

TCn = L + W

The new code linear scan the semaphore queue list and pick the best
task to wakeup ( in a goodness sense ).
If the process counters is exhausted ( it happens very rarely ) I've 2
way to follow:
1) Do a recalculate loop inside __wake_up()
2) Leave this case to fall into the previous implementation and releasing all tasks

I choose 2 to leave process counter recharging inside the schedule() function.

Tomorrow I'll post to linux-kernel my patch as long as a test program and
speed results.

Cheers,
Davide.

    --
    "Debian, the Freedom in Freedom."

    -
    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: Bradley M Keryan: "Re: Partition nightmare Was: Migrating to larger numbers"
- Previous message: Vassili Leonov: "A silly 2.2 question"
- Next in thread: Andrea Arcangeli: "Re: New semaphore __wake_up() implementation ..."
- Reply: Andrea Arcangeli: "Re: New semaphore __wake_up() implementation ..."
- Reply: V Ganesh: "Re: New semaphore __wake_up() implementation ..."
- Reply: Davide Libenzi: "Re: New semaphore __wake_up() implementation ..."
- Reply: Davide Libenzi: "Re: New semaphore __wake_up() implementation ..."
- Reply: V Ganesh: "Re: New semaphore __wake_up() implementation ..."
- Reply: Mark Hull-Richter: "Re: New semaphore __wake_up() implementation ..."
- Reply: Davide Libenzi: "Re: New semaphore __wake_up() implementation ..."
- Reply: Davide Libenzi: "Re: New semaphore __wake_up() implementation ..."
- Reply: V Ganesh: "Re: New semaphore __wake_up() implementation ..."